• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL

Chapter 4. Optimizing the Pipeline > Pre-Composing and Nesting

Pre-Composing and Nesting

Pre-composing is sometimes regarded as a kludgy, ill-conceived solution to render order problems. I couldn't disagree more. To me, it is one of the most effective ways to solve problems and optimize projects in After Effects, provided you plan things out a little.

Just to get our terms straight, pre-composing is the action of selecting a set of layers in a composition and assigning them to a new subcomp. Closely related to this is composition nesting, the action of placing one already created composition inside of another.

Typically, you pre-compose by selecting the layers of a composition that can and should be grouped together and choosing Pre-compose from the Layer menu. (You can also use the keyboard shortcut Ctrl+Shift+C/Cmd+Shift+C.) You are given two options: to leave attributes where they are or to move them into the new composition. One of the options is often grayed out for reasons that are clearly explained in the fine print of the dialog box (Figure 4.3). If you're wondering what constitutes an attribute that would be pre-composed, it's pretty much anything that you've edited on the layer: an effect, a mask, paint strokes, or even layer In and Out points.

Figure 4.3. If you ever need a reminder of what will happen when you choose either of the two basic pre-compose options, the dialog spells it out for you in detail. In this case, the first option is grayed out because two layers have been selected for the pre-composition. Two layers cannot share basic settings such as Transforms, so those settings must go to the new comp.

Why Do It?

Depending on who you ask, pre-composing is either the solution to most problems in After Effects or one of the most annoying things that you have to do in the program.

So why not just work in one big happy composition? The advantages of doing so would seem to be many. All of the properties and keyframes that you would want remain right there in front of you, you never have to go digging into some subcomp to fix a Levels setting, and there's no difficulty keeping track of composition order.

To wax poetic about it for a moment, there are almost as many reasons to pre-compose as the day is long. Here are a few of the most common:

  • To keep two layers in sync: If you ever find yourself making the same adjustments to two different layers in the same comp, that may be a signal that those layers now comprise an element and you need to pre-compose.

  • As a fix for render order problems: Sometimes it is simply not possible to make one render action occur prior to another without pre-composing. For example, if you want to mask a layer after applying effects to it, you must apply the effects to a pre-composition and then mask that.

  • To keep the Master comp tidy: This one should be self-explanatory. A Master composition with six well-organized elements is far more useful than one with 47 disparate elements (Figure 4.4).

    Figure 4.4. Never let this happen to one of your compositions.

  • To reuse an element: If you've used a set of layers to create an element that you think might be used again or that your client might want to change globally in several locations, it makes a huge amount of sense to nest these layers as a composition. That way, to reuse the element, you need only drop it into a new timeline.

  • Because an element or a set of layers is essentially done: This, in case you didn't know it, is your big picture goal. If you can finish some part of your shot, particularly if it's a render-intensive portion, pre-composing that part gives you the option of pre-rendering it.

If you're already comfortable with the idea of pre-composing, the last point is probably the most important for you to keep in mind. As you'll see later in this chapter, there are huge advantages to changing your mentality from that of an artist who wants to keep all options open, to that of an artist who understands the benefits of finishing an element, if only for the time being.

For years, Discreet's Flame and Inferno seem to have cornered mind share in terms of perceived speed and power. This is not entirely undeserved, but what many people fail to notice is that these applications are not truly real time; they still require time to render. Inferno artists often conceal this requirement by rendering in the background or requiring that elements come in already rendered—often having been created, somewhat ironically, in After Effects.

Options and Gotchas

Pre-composing a single layer using the Leave All Attributes option is relatively straightforward. Most of the time, however, you will pre-compose multiple layers using the Move All Attributes option, a route that is more fraught with peril if you don't pay attention. Typical gotchas associated with this process include:

  • Changes in layer duration and offset as they appear in the timeline.

  • The need to pre-compose some attributes, but not all.

  • The inability to easily undo pre-compositions later on.

  • Difficulty coordinating blending modes and 3D settings.

  • Confusion about recursion: When do motion blur, frame blending, and collapsed transformation switches affect nested comps?

Take a closer look at each of these situations, as well as some useful strategies for working with them.

Layer Duration Confusion

Figure 4.5 demonstrates the layer duration problem: Pre-composing a set of layers that are not the same duration as the source composition puts them in a new composition whose duration matches that of the source composition, but not that of the layers. The result is that the pre-composition layer includes empty frames at the top or tail of the shot.

Figure 4.5. What's up with all the empty space before and after the layers? Pre-composing using the second option creates a new comp with the exact time settings as the source, even if all of the layers begin much later in time than frame 0.

You can trim the layer to match the original edits, but there's a better option. This works best if you have Synchronize Time of All Related Items checked in General Preferences (Figure 4.6):

In the pre-comp, move the time needle to the first frame that contains any data.

Select all the layers, and with the Shift key held down move them so that that first frame lines up as the first frame of the composition.

With the time needle still where the layers originally began, return to the main comp.

Press the [ key to realign the first frame of the composition at the correct point.

Figure 4.6. This preference is the key to realigning layers in a pre-composition easily.

If you like, you can trim the tail as well by going into the subcomp, putting the time needle on the last frame that contains any data, then returning to the Master comp and pressing Alt+] (Option+]) to trim the layer.

The Missing Option

There are, of course, situations in which the two options in the Pre-compose dialog don't cover everything you need. What if you want to move some but not all attributes into a new composition? Unfortunately, there is no automated solution for such a situation and all its variables.

The best way to handle this is probably to choose the Move All Attributes option, check the Open New Composition box, and then cut any attributes that belong in the Master composition, pasting them there. Or, if you're pre-composing one layer only, you can do it the other way around: Leave the attributes in the Master comp, and then cut and paste the ones you want into the subcomp.

Unlike earlier versions, After Effects 6.5 and beyond allow you to use the Cut command with effects. Cut and Paste now work the same with effects as with everything else.

Data Pass Through

Finally, how do you know if 3D position data or blending modes of a layer in the subcomp will be preserved and appear correctly in the Master comp? Or, if you turn on motion blur or frame blending on the subcomp layer in the Master comp, how do you know those elements you animated in the subcomp, or even in a subcomp of a subcomp, are going to take on those settings? To manage these situations properly, you should be aware of a couple of settings.

Undoing a Pre-Composition

If you set a pre-comp and then change your mind immediately, you can, of course, undo the action. A problem emerges, however, when you progress further with your project and decide that pre-composing was a bad idea. In that case, the only option is to cut the layers from the pre-comp and carefully paste them back into the Master comp, taking care that layer order is preserved and that such basic properties as Transforms remain correct.

For motion blur and frame blending, the key is the Switches Affect Nested Comps check box in General Preferences. With this checked (as it is by default), turning on these features in the Master comp turns them on in any affected subcomps as well. Unless you specify otherwise in the Render Settings, this is also how this situation is handled when rendering.

Passing through 3D position data and blending modes, on the other hand, is a question of enabling the Collapse Transformations toggle for any comp layer (Figure 4.7). Turning this option on causes these properties to behave as if the pre-composed layers were still in the Master comp; turning it off prevents them from interacting with the Master comp.

Figure 4.7. As the tool tip alludes, this switch beside the cursor has two roles (and two names). In a nested composit5ion, it is a Collapse Transformations toggle. Enable it, and blending modes and 3D positions from the nested comp are passed through. (Its other role, Continuously Rasterize, applies to such vector layers as Adobe Illustrator files only.)

The Cool Way Time Is Nested

After Effects is less rigid than many digital video applications when it comes to working with time. You are not forced to have all of the compositions in a given project use the same frame rate, and changing the frame rate of an existing composition is handled rather gracefully, with all of the keyframes retaining their positions relative to overall time.

Users of older versions of After Effects may recall that applying a mask or an effect to the layer that also had Collapse Transformations enabled was impossible. This limitation no longer exists.

That doesn't mean you can be sloppy, of course, it just means you have options. Artists familiar with other applications often forget to pay attention to frame rate settings when

  • Importing an image sequence

  • Creating a new composition from scratch

  • Embedding a composition with a given frame rate into another with a different frame rate

In the third instance, by default, After Effects does its best to stretch or compress the frame rate of the embedded composition to match that of the Master composition. Sometimes, however, that's not what you want, which is when you need to examine options on the Advanced tab of the Composition Settings dialog.

Collapsing New Blenders

One limitation of turning on Collapse Transformations is that you're thereafter prevented from setting a blending mode on the collapsed layer. The blending mode menu shows only a – symbol.

The workaround is to apply an effect to the layer that does nothing or that is even turned off. This forces After Effects to render the collapsed layer (making it what the Adobe developers call a parenthesized comp), a side benefit of which is that blending modes become available.

The downside is that 3D layers are no longer passed through. But this workaround is helpful when you wish to pre-compose for the purpose of scaling.

The Advanced Tab

The Composition Settings dialog's Advanced tab contains a hodgepodge of extras that can come in handy. For example, Anchor Grid specifies how a composition is cropped if you adjust its pixel dimensions downward on the Basic tab. Shutter Angle and Shutter Phase affect motion blur (see Chapter 9, “Virtual Cinematography”). As for the rendering plug-in, you will almost certainly always leave it at the default setting of Advanced 3D (Figure 4.8).

Figure 4.8. Rare is the occasion when you would not use the default Advanced 3D rendering plug-in, and at this writing no developer outside of Adobe has offered one. The Options button allows you to control the resolution of the shadow map; keep it in mind if your shadows need refinement.

And then there are the two Preserve check boxes. Preserve Frame Rate maintains the frame rate of the current composition no matter what the frame rate settings of anywhere you place it—into any other composition or into the Render Queue with given frame rate settings. So if you've keyframed a simple cycle animation that runs at just 4 frames per second, and then place that composition into a 24 fps comp, After Effects will not try to stretch that composition across the higher frame rate. It maintains the effect of 4 fps. The situation doesn't come up a lot, but when it does, knowing Preserve Frame Rate is useful.

Ditto the Preserve Resolution When Nested option: Typically, if an element is scaled down in a pre-comp and the composition is scaled up in the Master comp, you will want After Effects to treat these two opposing scales as one operation so that no data loss occurs. However, if you want the data in the subcomp to appear as if it were scaled up from a lower-resolution element, toggle on Preserve Resolution When Nested.


There are only a couple of things to watch out for with adjustment layers. Primarily, you must keep in mind that their timing and Transform properties still apply.

In other words, make sure that your adjustment layer starts at the first frame of the comp and extends to the last frame of the comp (or the start and end frames of the portion for which you need it), otherwise its effects will pop on and off unexpectedly. And if you set any transforms to the adjustment layer, make sure you mean for them to be there, as the boundaries of these layers are still respected in the rendering process.

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint