If you want to group some layers that are already in a composition, you can precompose those layers. Precomposing layers places them in a new composition, which replaces the layers in the original composition. The new nested composition becomes the source for a single layer in the original composition. The new composition appears in the Project panel and is available for rendering or use in any other composition. You can nest compositions by adding an existing composition to another composition, just as you would add any other footage item to a composition. Precomposing a single layer is useful for adding transform properties to a layer and influencing the order in which elements of a composition are rendered.
Nesting is the inclusion of one composition within another. The nested composition appears as a layer in the containing composition.
A nested composition is sometimes called a precomposition, which is occasionally abbreviated in casual use to precomp or pre-comp. When a precomposition is used as the source footage item for a layer, the layer is called a precomposition layer.
During rendering, the image data and other information can be said to flow from each nested composition into the composition that contains it. For this reason, nested compositions are sometimes referred to as being upstream of the compositions that contain them, and the containing compositions are said to be downstream of the nested compositions that they contain. A set of compositions connected through nesting is called a composition network. You can navigate within a composition network using the Composition Navigator and Mini-Flowchart. (See Opening and navigating nested compositions.)
Precompositions in After Effects are similar to Smart Objects in Adobe Photoshop.
Precomposing and nesting are useful for managing and organizing complex compositions. By precomposing and nesting, you can do the following:
- Apply complex changes to an entire composition - You can create a composition that contains multiple layers, nest the composition within the overall composition, and animate and apply effects to the nested composition so that all of the layers change in the same ways over the same time period.
- Reuse anything you build - You can build an animation in its own composition and then drag that composition into other compositions as many times as you want.
- Update in one step - When you make changes to a nested composition, those changes affect every composition in which it is used, just like changes made to a source footage item affect every composition in which it is used.
- Alter the default rendering order of a layer - You can specify that After Effects render a transformation (such as rotation) before rendering effects, so that the effect applies to the rotated footage.
- Add another set of transform properties to a layer - The layer that represents the composition has its own properties, in addition to the properties of the layers that it contains. This allows you to apply an additional set of transformations to a layer or set of layers.
Because a precomposition is itself a layer, you can control its behavior using layer switches and composition switches in the Timeline panel. You can choose whether changes made to the switches in the containing composition are propagated to the nested composition. To prevent layer switches from affecting nested compositions, choose Edit > Preferences > General (Windows) or After Effects > Preferences > General (Mac OS), and then deselect Switches Affect Nested Comps.
In the Advanced tab of the Composition Settings dialog box (Composition > Composition Settings), choose Preserve Resolution When Nested or Preserve Frame Rate When Nested Or In Render Queue for a composition to retain its own resolution or frame rate, and not inherit those settings from the containing composition. For example, if you deliberately used a low frame rate in a composition to create a jerky, hand-animated result, you should preserve the frame rate for that composition when it is nested. Similarly, the results of rotoscoping may look wrong when converted to a different frame rate or resolution. Use this setting instead of the Posterize Time effect, which is less efficient.
Jeff Almasol provides a script on his redefinery website that makes toggling the Preserve Resolution When Nested or Preserve Frame Rate When Nested Or In Render Queue preference setting more convenient.
Changing the current time in one panel updates the current time in other panels associated with that composition. By default, the current time is also updated for all compositions related to the current composition by nesting. To prevent compositions related by nesting from updating their current times when you change the current time in one composition, deselect the Synchronize Time Of All Related Items preference (Edit > Preferences > General (Windows) or After Effects > Preferences > General (Mac OS)).
Chris and Trish Meyer share tips on setting up a composition hierarchy so that making changes in a project is easier in this article from the ProVideo Coalition website.
See this page on
See this page on
Precomposing layers places them in a new composition (sometimes called a precomposition), which replaces the layers in the original composition. Precomposing a single layer is useful for adding transform properties to a layer and influencing the order in which elements of a composition are rendered.
Leave All Attributes In
Leaves the properties and keyframes of the precomposed layer in the original composition, applied to the new layer that represents the precomposition. The frame size of the new composition is the same as the size of the selected layer. This option is not available when you select more than one layer, a text layer, or a shape layer.
Move All Attributes Into The New Composition
Moves the properties and keyframes of the precomposed layers one level further from the root composition in the composition hierarchy. When you use this option, changes you applied to the properties of the layers remain with the individual layers within the precomposition. The frame size of the new composition is the same as the frame size of the original composition.
Nested compositions are sometimes referred to as being upstream of the compositions that contain them, and the containing compositions are said to be downstream of the nested compositions that they contain. The root composition is the most downstream; the most deeply nested composition is the most upstream. A composition flow path is a chain of compositions that are related to one another by containing or being nested within one another. A composition network is the entire set of compositions that are related to one another through nesting.
After Effects provides several ways to open a nested composition (precomposition):
- Double-click the composition entry in the Project panel.
- Double-click a precomposition layer in the Timeline panel. Alt-double-click (Windows) or Option-double-click (Mac OS) to open the precomposition layer as a layer in the Layer panel.
Double-clicking a precomposition layer when a paint tool or the Roto Brush tool is active opens the layer in the Layer panel.
To open the most recently active composition in the same composition network as the currently active composition, press Shift+Esc.
Use the Composition Navigator.
Use the Composition Mini-Flowchart.
The Composition Navigator is a bar along the top edge of the Composition panel that shows the composition active in that viewer in relation to other compositions in the same composition network. The compositions shown are the most recently active compositions in the flow path of the currently active composition.
Arrows between the composition names indicate the direction in which pixel information flows for this flow path. The default is to show compositions in the Composition Navigator bar with downstream compositions on the left and upstream compositions on the right. This default is indicated by the Flow Right To Left option in the Composition panel menu. To show compositions in the other order, choose Flow Left To Right. This setting is a global preference; it applies to all compositions and to the Composition Mini-Flowchart view.
The names of downstream compositions are dim to indicate that their contents are not used or shown in the active composition.
To show or hide the Composition Navigator bar, choose Show Composition Navigator from the Composition panel menu.
To activate any composition shown in the Composition Navigator bar, click the composition name.
If the flow path is too long to show in the Composition panel, an ellipsis button appears at the left or right edge of the Composition Navigator bar. To temporarily show the entire flow path, click the ellipsis button.
To scroll through a long flow path, place the pointer over a composition button in the Composition Navigator and roll the mouse scroll wheel.
The Composition Mini-Flowchart is a transient control that you can use to quickly navigate within a composition network. When you open the Composition Mini-Flowchart, it shows the compositions immediately upstream and downstream of the selected composition.
Colors in the Composition Mini-Flowchart are based on the label colors assigned to compositions in the Project panel. If a composition is used multiple times within one composition, the multiple instances of the nested composition appear as one entry with a number in parentheses indicating the number of instances.
To open the Composition Mini-Flowchart, do one of the following:
Click the arrow to the right of a composition name in the Composition Navigator bar.
Choose Composition Mini-Flowchart from the Composition menu, the Composition panel menu, or the Timeline panel menu.
Click the Composition Mini-Flowchart button at the top of the Timeline panel.
As with the Composition Navigator, you can choose whether to show the flow direction from left to right or from right to left. Arrows indicate the direction of the flow. If a composition has a next to it instead of an arrow, then the composition either does not have any compositions flowing into it or it does not flow into any compositions.
Upstream compositions in the Composition Mini-Flowchart are sorted from top to bottom either alphabetically or by layer order. To switch between these sorting orders, press the S key when the Composition Mini-Flowchart is open. When sorting by layer order, a composition used multiple times is sorted according to its topmost instance in the stacking order. Downstream compositions are always sorted alphabetically.
To navigate among and select compositions in the Composition Mini-Flowchart, use the arrow keys or click the arrow or buttons on either side of a composition. To activate the selected composition, press the spacebar or Enter (Windows) or Return (Mac OS). To close the Composition Mini-Flowchart without taking any action, press Esc, tap Shift, or click outside the Composition Mini-Flowchart.
Rich Young provides additional information about the Flowchart panel and the Composition Mini-flowchart on the After Effects Portal website.
A complex nested composition can take a long time to render, either for previews or for final output. If you have a nested composition that you do not expect to work on further, you can save time during each rendering operation by pre-rendering the nested composition into a movie and replacing the composition with the rendered movie. You can still modify the original nested composition, because it remains in the Project panel. If you make a significant change to the original nested composition, render it again.
Pre-rendering a nested composition is especially beneficial when you will use it multiple times in a project.
Apply your final output settings when you pre-render the nested composition.
See this video tutorial on the Video2Brain website about how to save time with pre-rendering and proxies in After Effects.
An alternative to replacing the composition with the movie is to use the rendered movie as a proxy for the nested composition.
A composition consists of layers stacked on top of one another in the Timeline panel. When the composition is rendered—either for previewing or for final output—the bottom layer is rendered first. Within each raster (non-vector) layer, elements are applied in the following order: masks, effects, transformations, and layer styles. For continuously rasterized vector layers, the default rendering order is masks, followed by transformations, and then effects.
Transformations are changes to those properties grouped under the Transform category in the Timeline panel, including Anchor Point, Position, Scale, Rotation, and Opacity. What you see in the Layer panel is the result of the rendering before transformations are performed.
For additional control over when transformations are performed, you can apply the Transform effect and reorder it with respect to other effects.
In a group of effects or masks, items are processed from top to bottom. For example, if you apply the Circle effect and then apply the Magnify effect, the circle is magnified. However, if you drag the Magnify effect above (before) the Circle effect in the Effect Controls or Timeline panel, the circle is drawn after the magnification and isn’t magnified.
After a layer has been rendered, rendering begins for the next layer. The rendered layer below may be used as input to the rendering of the layer above—for example, for determining the result of a blending mode.
If a composition contains other compositions nested within it, the nested composition is rendered before other layers in the containing composition.
Some effects ignore masks on the layer to which they’re applied. To have such an effect operate on a masked layer, pre-compose the layer with the mask applied, and then apply the effect to the pre-composed layer. (See About precomposing and nesting.)
If the Collapse Transformations switch is selected for a nested composition, then the transformations for the nested composition are not performed until after the masks and effects for the containing composition are rendered. This render order allows the transformations for the nested composition and the containing composition to be combined—or collapsed—and performed together. The same is true for vector layers that are not continuously rasterized.
Instead of a Collapse Transformations switch, vector layers have a Continuously Rasterize switch in the same location. Vector layers include shape layers, text layers, and layers with vector graphic files as the source footage. Text layers and shape layers are always continuously rasterized.
Collapsing transformations can, for example, preserve resolution when a layer is scaled down by half in a nested composition, and the nested composition is scaled up by a factor of two in the containing composition. In this case, rather than performing both transformations and losing image data in the process, one transformation can be performed—doing nothing, because the individual transformations cancel each other.
If transformations are not collapsed, a nested composition that contains 3D layers is rendered as a 2D image of the 3D arrangement, using the default composition camera. This rendering prevents the nested composition from intersecting with 3D layers, casting shadows on 3D layers, and receiving shadows from 3D layers in the containing composition. The nested composition is also not controlled by the cameras and lights of the containing composition.
If transformations are collapsed, the 3D properties of the layers in the nested composition are exposed to the containing composition. Thus, the nested composition can intersect with 3D layers, cast shadows on 3D layers, and receive shadows from 3D layers in the containing composition. The containing composition's camera and lights can also control the nested composition.
Essentially, collapsing transformations for a nested composition tells After Effects to not flatten and crop the layers in the precomposition. Because an adjustment layer operates on the composite of all of the layers beneath it within the same composition, an adjustment layer within a nested composition with collapsed transformations will force the flattening and cropping that collapsing transformations would normally prevent.
When a closed mask (with mask mode other than None), a layer style, or an effect is applied to a nested composition with collapsed transformations, the layers in the nested composition are first rendered on their own, then masks and effects are applied, and then the result is composited into the main composition. This rendering order means that the blending modes of the nested layers are not applied to any underlying layers in the main composition, and that 3D layers above and below the collapsed layer cannot intersect or cast shadows on each other.
Chris and Trish Meyer explain collapsing transformations and continuous rasterization in this article on the ProVideo Coalition website.