Separating a foreground object, such as an actor, from a background is a crucial step in many visual effects and compositing workflows. When you’ve created a matte that isolates an object, you can replace the background, selectively apply effects to the foreground, and much more.

Conventionally, segmentation of a moving image into foreground and background elements has been accomplished through rotoscoping—defining mattes by manually drawing Bezier curves (masks) on most frames, with some interpolation. (See Rotoscoping introduction and resources.)

The Roto Brush tool provides an alternative, faster workflow for this segmentation and creation of a matte.

With the Roto Brush tool, you draw strokes on representative areas of the foreground and background elements, and then After Effects uses that information to create a segmentation boundary between the foreground and background elements. The strokes that you make on one area inform After Effects about what is foreground and what is background in adjacent areas and on adjacent frames. Various techniques are used to track regions across time, and this information is used to propagate segmentation forward and backward in time so that each stroke that you make is used to improve the results on nearby frames. Even if an object moves or changes shape from one frame to the next, the segmentation boundary adapts to match the object.

After you have created a segmentation boundary, you use the Refine Matte properties to improve the matte. The Refine Matte effect is also available separately for the improvement of mattes created using features other than the Roto Brush tool.

Note:

After Effects CC includes enhancements to make rotoscopy easier. See Roto Brush and Refine Edge tools in After Effects CC

Online resources for the Roto Brush tool and Refine Matte effect

For a collection of video tutorials and resources about the Roto Brush tool, see this article on the Adobe website.

For a video that demonstrates the use of the Roto Brush tool to quickly create a matte for selective color correction, see the Adobe website.

For a video that demonstrates the use of the Refine Matte properties in the Roto Brush effect to improve a matte, see the Adobe website.

Roto Brush and Refine Matte overview and workflow

  1. Activate the Roto Brush tool by pressing Alt+W (Windows) or Option+W (Mac OS).

  2. Open the layer that you want to work on in the Layer panel.

    note: Double-clicking a layer in the Timeline panel when the Roto Brush tool is active opens the layer in the Layer panel.

  3. Preview the movie in the Layer panel to find a frame in which the greatest amount of the foreground object is in the frame and in which the separation between the foreground and background is as clear as possible.

    The frame on which you draw your first stroke is the base frame. (See Roto Brush strokes, spans, and base frames.)

  4. Drag in the Layer panel to draw a foreground stroke on the object that you want to define as a foreground object. When you are drawing a foreground stroke, the Roto Brush tool’s pointer is a green circle with a plus sign in the middle.

    Note:

    Draw the stroke down the center of the object, not along the edge. (See Tips for working with the Roto Brush tool.)

    The magenta outline that appears around the foreground object in Alpha Boundary view mode is the segmentation boundary, the rough line that separates the foreground from the background. You can also view the segmentation using other view modes. (See Layer panel view options.)

  5. Alt+drag (Windows) or Option+drag (Mac OS) to draw a background stroke on the area that you want to define as the background. When you are drawing a background stroke, the Roto Brush tool’s pointer is a red circle with a minus sign in the middle.

  6. Repeat the steps of drawing foreground and background strokes on the base frame until the segmentation is as precise and complete as possible. You should make the segmentation on the base frame as good as possible; the segmentation of other frames is based on the segmentation defined on the base frame.

    Try for a segmentation boundary that is within a couple of pixels of your desired edge. You can modify properties in the Roto Brush effect, such as Smooth, to refine the initial segmentation further. (See Roto Brush effect and Refine Matte effect reference.)

    Note:

    You can resize the Roto Brush tool’s tip to make finer strokes. Broad strokes are best for initial work, but fine strokes are useful for details. (See Roto Brush strokes, spans, and base frames.)

  7. Press Page Down to move forward one frame.

    After Effects uses motion tracking, optical flow, and various other techniques to propagate the information from the base frame to the current frame to determine where to draw the segmentation boundary.

  8. If the segmentation boundary that After Effects calculates for the current frame is not where you want it to be, then you can make corrective strokes to teach After Effects what is foreground and what is background. Draw foreground strokes and background strokes as needed to correct the segmentation. Corrective strokes propagate in one direction, away from the base frame.

    note: You can also modify properties in the Propagation property group to affect how After Effects propagates the segmentation information from previous frames to the current frame. (See Roto Brush effect and Refine Matte effect reference.)

  9. Repeat the steps of moving one frame at a time and making corrective strokes until you have created a segmentation boundary for the entire duration that you want to segment.

  10. Select the Refine Matte option in the Roto Brush effect properties in the Effect Controls panel and modify properties in the Matte property group as needed. (See Roto Brush effect and Refine Matte effect reference.)

  11. When you are done, click the Freeze button in the lower-tight corner of the Layer panel to cache, lock, and save the Roto Brush segmentation information. (See Freezing (caching, locking, and saving) Roto Brush segmentation.)

Tips for working with the Roto Brush tool

  • When drawing strokes to define a foreground object with the Roto Brush tool, begin by drawing strokes along the center of the object’s features. For example, draw a stroke along the skeleton rather than along the outline of an arm. Unlike conventional rotoscoping, which requires precise manual definition of boundaries, using the Roto Brush tool works by defining representative regions. After Effects can then extrapolate from those regions to determine where the boundaries are. Before you draw a stroke along a boundary to attempt to get a precise segmentation, be sure that you've drawn foreground strokes down the center of the object and made at least some rough background strokes on the other side of the boundary.

  • If you draw a Roto Brush stroke over the wrong area of the image, undo that stroke. (See Undo changes.) However, if After Effects misinterprets your stroke and includes or excludes too much of the image, don’t undo; further teach Roto Brush by drawing additional strokes to include or exclude regions.

  • Work with resolution set to Full when using the Roto Brush tool. Fast Previews modes, such as Adaptive Resolution, don’t work well with the Roto Brush tool, because switching resolutions requires a full recalculation of the segmentation information. For this reason, Fast Previews modes are turned off when you draw a Roto Brush stroke. This setting is shared by the Composition and Layer panels. (See Resolution.)

  • Use the Roto Brush tool in a composition with a frame rate set to match the frame rate of the layer's source footage item. A warning banner appears at the bottom of the frame in the Composition panel if the frame rate of the composition doesn't match the frame rate of the layer's source footage item. (See Frame rate.)

  • When you've gotten everything as good as you can with the Roto Brush effect, you can touch up the matte further using other compositing features in After Effects—such as by painting on the alpha channel. (See Compositing and transparency overview and resources.)

Roto Brush strokes, spans, and base frames

Base frames, Roto Brush spans, and corrective strokes

When you first draw a Roto Brush stroke, the frame on which you are drawing becomes a base frame. The segmentation information (the information about what is defined as foreground and what is defined as background) is propagated forward and backward through time—20 frames forward and 20 frames backward. The range of frames thus influenced by this base frame is its Roto Brush span. Little arrows in the span bar in the Layer panel show the direction in which the information is being propagated. If you draw a corrective stroke anywhere where the arrows point to the right, the information from that stroke is propagated forward; if you draw a corrective stroke anywhere where the arrows point to the left, information from that stroke is propagated backward. If you draw a stroke anywhere outside of a Roto Brush span, then you create a new base frame and span.

You can work your way forward a frame at a time from a base frame, making corrective strokes, and you don't have to worry about your strokes changing results on frames that you've already worked on. You can do the same thing going backward from a base frame.

The influence of each corrective stroke propagates forward or backward to affect all frames in that direction within the span, regardless of when the stroke is made. For example, if the base frame is at frame 10, you make a corrective stroke at frame 20, and then you make a corrective stroke at frame 15, then frame 20 will be affected by both of these corrective strokes—just as if you had made the corrective strokes in the other order.

Each time that you make a stroke within a span, the span grows, unless it can't because the span in which you're drawing is adjacent to another span.

  • To manually change a span duration, drag either end of a span.

  • To delete a span, right-click (Windows) or Control-click (Mac OS) a span and choose Remove Span.

  • To delete all spans, delete the instance of the Roto Brush effect.

When you move to a frame within a span, After Effects must calculate how the stroke information from the other frames in the span affects the frame to which you've moved. The Info panel shows the message “Roto Brush propagating” as this calculation is being performed. This information is cached, so this propagation doesn't need to happen every time that you move to a frame. Green bars in a span indicate frames with cached information. Choosing Edit > Purge Image Caches purges Roto Brush caches, too.

Roto Brush tool, Roto Brush strokes, and similarities to paint tools and strokes

The Roto Brush tool is similar in many ways to the paint tools, though it also has several important differences.

When the Roto Brush tool is selected, controls in the Paint panel are disabled. Roto Brush strokes have a duration of one frame, though their influence propagates forward or backward within a span.

You can change the brush size (Diameter) for the Roto Brush tool in the same way that you change it for the paint tools. You can use the Diameter control in the Brushes panel or Ctrl-drag (Windows) or Command-drag (Mac OS) in the Layer panel. Other controls in the Brushes panel do affect the Roto Brush tool, with the exception of Hardness.

You can copy Roto Brush Path properties, and paste them into masks, shapes, and instances of the Paint effect, just like you can with other kinds of paths. If you copy an individual stroke, the Roto Brush span information is not copied; however, if you copy the entire Roto Brush effect instance, it includes the Roto Brush span (and base frame) information.

You can use expressions on the Roto Brush effect's Path property in the same manner as the Paint effect's Path property.

When drawing a stroke with the Roto Brush tool, a new stroke is created even if another stroke is selected. This differs from the stroke replacement functionality for the paint tools.

Roto Brush strokes are in a Strokes property group within the Roto Brush property group in the Timeline panel.

Many keyboard shortcuts that work with paint strokes and paint tools also work with Roto Brush strokes and the Roto Brush tool. (See Paint tools (keyboard shortcuts).)

  • Press 1 or 2 on the main keyboard to move earlier and later (backward or forward) one frame.

  • Press PP to show paint strokes, Roto Brush strokes, and Puppet pins.

  • Press Ctrl+A (Windows) or Command+A (Mac OS) to select all strokes on current frame.

Roto Brush effect and Refine Matte effect reference

The Roto Brush effect properties in the Propagation property group affect segmentation between foreground and background and how that segmentation information is used for contiguous frames in a span. Other properties of the Roto Brush effect affect the matte that is generated based on the initial segmentation. The Refine Matte effect includes all of the properties of the Roto Brush effect outside of the Propagation property group (except for Invert Foreground/Background).

Propagation

Properties in the Propagation property group (except for View Search Region) affect all Roto Brush calculations. Any change to these properties requires a recalculation and propagation of the segmentation information from a base frame. Also, the results on a base frame itself are not affected by changes to these properties; therefore, it’s best to change these properties when the current-time indicator is a frame or two away from a base frame, so that you can see the result of the changes.

Search Radius

The radius of the area within which After Effects searches when looking for pixels that match from one frame to the next. You can change how the search radius adapts to regions with more or less motion using the Motion Threshold and Motion Damping properties. If the search radius is too small, some motion may be missed; if the search radius is too large, extraneous motion may be detected.

Motion Threshold and Motion Damping

These two properties control how the search region is constrained based on motion. Change Motion Threshold to set the motion level below which is considered no motion, where the search region will shrink to nothing. Motion Damping affects the remaining areas that are considered to be in motion. As you increase Motion Damping, the search region is tightened, with slow-moving areas tightening more than fast-moving areas. Constraining the search region in areas with little motion can reduce edge chatter in these regions. Constraining the search region too much will cause the automatic boundary detection to fall off the edge of the object.

View Search Region

Renders the search region as yellow, and the foreground and background as a grayscale image (with the background dimmer than the foreground). The value of this property affects the rendered output of the Roto Brush effect, not just an intermediate stage of the effect's operation. Its main use is to help you pick values for Search Radius, Motion Threshold, and Motion Damping.

note: For frames other than the base frame, viewing the search region shows the area that will be searched on the current frame, based on segmentation results of the previous frame. So, for frames other than the base frame, adding a stroke on a frame does not change the search region shown for that frame.

Edge Detection

Choose whether to favor the segmentation boundary calculated for the current frame in isolation or the segmentation calculated based on the previous frame when determining the edge between foreground and background. The Balanced option considers the current frame and surrounding frames equally. Foreground objects with colors that match the background will usually benefit from Favor Predicted Edges.

Use Alternate Color Estimation

Subtly changes the process by which the Roto Brush effect determines what is foreground and what is background. Sometimes checking it helps with segmentation; sometimes it doesn't.

Invert Foreground/Background

Inverts which strokes are considered foreground strokes and which strokes are considered background strokes in the segmentation phase of the Roto Brush effect.

Smooth

Increasing this value reduces the sharpness of the curves in the segmentation boundary by smoothing along the edge. Leave this number low when isolating a object with sharp features, such as hair.

Feather

Softness of the segmentation boundary. This property does nothing if Smooth is 0. In contrast to Smooth, Feather applies across the edge.

Choke

The amount of choking (contraction) of the matte relative to the value of the Smooth property. The result is very similar to that of the Choke property in the Matte Choker effect, but the value is given from -100% to 100% (instead of -127 to 127).

Reduce Chatter

Increase this property to reduce erratic changes to edges from one frame to the next. This property determines how much influence the current frame should have when performing a weighted average across adjacent frames to make the matte edges not move erratically from one frame to the next. If the Reduce Chatter value is high, the chatter reduction strong, and the current frame is considered less. If the Reduce Chatter value is low, the chatter reduction is weak, and the current frame is considered more. If the Reduce Chatter value is 0, only the current frame is considered for matte refinement.

Tip: If the foreground object isn’t moving, but the matte edges are moving and changing, increase the value of the Reduce Chatter property.

If the foreground object is moving, but the matte edge isn’t moving, decrease the value of the Reduce Chatter property.

Use Motion Blur

Check this option to render the matte with motion blur. The high quality option is slower, but generates a cleaner edge. You can also control the number of samples and the shutter angle, which have the same meaning as they do in the context of motion blur in the composition settings. (See Motion blur.)

Decontaminate Edge Colors

Check this option to decontaminate (clean) the color of edge pixels. The background color is removed from foreground pixels, which helps to fix halos and the contamination of motion-blurred foreground objects with background color. The strength of this cleaning is determined by Decontamination Amount.

Extend Where Smoothed

Only functional when Reduce Chatter is greater than 0 and Decontaminate Edge Colors is selected. Edges that are moved in order to reduce chatter are cleaned.

Increase Decontamination Radius

Amount (in pixels) by which to increase the radius value for the cleaning of edge colors, in addition to any cleaning that covers feather, motion blur, and extended decontamination.

View Decontamination Map

Shows which pixels will be cleaned by decontamination of edge colors (white pixels in the map).

Freezing (caching, locking, and saving) Roto Brush segmentation

When the View menu in the Layer panel is set to Roto Brush, a Freeze button appears in the lower-right corner of the Layer panel. Click this button to cache and lock segmentation for all Roto Brush spans for the layer within the composition work area. This preserves the matte and saves it with the project, preventing the Roto Brush effect from recalculating the segmentation when you open the project again or make changes.

If After Effects has already calculated Roto Brush segmentation information for a frame when you click the Freeze button, then this information is cached. If the segmentation has not been calculated for a frame within a Roto Brush span, then After Effects must calculate the segmentation before freezing.

Frames with frozen (cached and locked) segmentation information are represented by blue bars in the Roto Brush span view in the Layer panel.

Note:

If you click Stop in the Freezing Roto Brush dialog box, After Effects stops adding frames to the cache, but Roto Brush segmentation is still locked with the segmentation information cached up until the point that you clicked Stop.

To unfreeze Roto Brush segmentation, click the Freeze button again.

When Roto Brush segmentation is frozen, you can place the pointer over the Freeze button to see a tooltip that tells you when the cached information was created.

When Roto Brush segmentation is frozen, the pointer for the Roto Brush tool has a slash through it.

The information that is cached and locked is the result of Roto Brush strokes and the properties in the Propagation property group of the Roto Brush effect. Making changes to any of these items (for example, by drawing new Roto Brush strokes or modifying properties in the Propagation property group) has no influence on the result of the Roto Brush effect until you unfreeze segmentation. The properties in the Matte property group are not frozen.

Frozen Roto Brush segmentation information is cached and locked while the application is running, and the cached information is saved with the project.

Layer panel view options

You can choose these view modes from the Show Channel menu in the Layer panel, by clicking the buttons in the Layer panel, or by using keyboard shortcuts. You can use the controls at the bottom of the Layer panel to change the color and opacity of the overlays used in Alpha Boundary and Alpha Overlay mode.

Alpha

Shows alpha channel of layer (Alt+4 or Option+4).

Alpha Boundary

Shows source layer with foreground and background unchanged, with segmentation boundary overlaid as colored outline (Alt+5 or Option+5).

note: Alpha Boundary view mode is turned off when the View menu in the Layer panel is changed to anything other than Roto Brush.

Alpha Overlay

Shows source layer with foreground unchanged and background overlaid with a solid color (Alt+6 or Option+6).

Adobe recommends

Adobe recommends
Isolating a Subject with Roto Brush
Todd Kopriva

Adobe recommends

Adobe recommends
Making a quick matte with the Roto Brush
Mark Christiansen

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy