Track mattes and traveling mattes



When you want one layer to show through holes defined by another layer, set up a track matte. For example, you can use a text layer as a track matte for a video layer to allow the video to only show through the shapes defined by the text characters. The underlying layer (the fill layer) gets its transparency values from the values of certain channels in the track matte layer—either its alpha channel or the luminance of its pixels.

Defining the transparency of a layer based on the luminance of the track matte’s pixels is useful when you want to create a track matte using a layer without an alpha channel or a layer imported from a program that can’t create an alpha channel. In both cases—using alpha channel mattes and using luminance mattes—pixels with higher values are more transparent. In most cases, you use a high-contrast matte so that areas are either completely transparent or completely opaque. Intermediate shades should appear only where you want partial or gradual transparency, such as along a soft edge.

Traveling matte

A.
Track matte layer: a solid with a rectangular mask, set to Luma Matte. The mask is animated to travel across the screen.

B.
Fill layer: a solid with a pattern effect.

C.
Result: the pattern is seen in the shape of the track matte. This is then composited over an additional image layer.

A track matte only applies to the layer directly beneath it. To apply a track matte to multiple layers, first precompose the multiple layers, and then apply the track matte to the precomposition layer.

After Effects preserves the order of a layer and its track matte after you duplicate or split the layer. Within the duplicated or split layers, the track matte layer remains on top of the fill layer. For example, if your composition contains layers A and B, where A is the track matte and B the fill layer, duplicating or splitting both of these layers results in the layer order ABAB.

If you animate the position or other transformations of the track matte layer, it’s called a traveling matte. If you want to animate the track matte and fill layers using identical settings, consider precomposing them.

Convert a layer into a track matte

The TrkMat menu shares a column with the blending modes menu. To show the TrkMat menu, make sure that the Modes column is visible. (See Columns.)

  1. In the Timeline panel, drag the layer to use as the track matte directly above the layer to use as the fill layer.
  2. Define transparency for the track matte by choosing one of the following options from the TrkMat menu for the fill layer:
    No Track Matte
    No transparency created; next layer above acts as a normal layer.

    Alpha Matte
    Opaque when alpha channel pixel value is 100%.

    Alpha Inverted Matte
    Opaque when alpha channel pixel value is 0%.

    Luma Matte
    Opaque when the luminance value of a pixel is 100%.

    Luma Inverted Matte
    Opaque when the luminance value of a pixel is 0%.

If you choose an option other than No Track Matte, After Effects converts the next layer above into a track matte, turns off the video of the track matte layer, and adds a track matte icon  next to the name of the track matte layer in the Timeline panel.
Note: Although the video is turned off for the matte layer, you can still select the layer to reposition, scale, or rotate it. Select the layer in the Timeline panel, and then drag the center (indicated by a circle with an X) of the layer in the Composition panel.

Using a track matte is somewhat similar to using the Preserve Underlying Transparency option, which causes a layer to get its transparency from the transparency of the composite of the layers below it in the layer stacking order. (See Preserve underlying transparency during compositing.)

Tips for working with track mattes

  • Use the Levels effect to increase the contrast between light and dark parts of the matte layer. This reduces the problem of having a lot of mid-range values, which translate to partial transparency. (Usually, mattes are most useful when they define areas as entirely transparent or entirely opaque, except at the edges.)
  • To use a channel other than the alpha channel of the matte layer as a matte, use one of the Channel effects (such as the Shift Channels effect) to route the desired channel’s value into the alpha channel.
  • To animate a track matte to move with the layer that it’s matting, make the track matte a child of the layer that it’s matting. (See Parent and child layers.)

Online resources about track mattes

Trish and Chris Meyer provide an introduction to mattes in a PDF excerpt from the “All About Track Mattes” chapter of their book Creating Motion Graphics with After Effects (4th Edition).

Harry Frank provides a video tutorial on his graymachine website in which he demonstrates how to use effects on track matte layers to create custom fade-on transitions.