Precomposing and Nesting
Precomposing is sometimes regarded as a kludge, an ill-conceived solution to render order problems. I don't agree. To me, it is an effective way to solve problems and optimize projects in After Effects, provided you plan things out a little.
Just to get our terms straight, precomposing 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 precompose by selecting the layers of a composition that can and should be grouped together and choosing Precompose 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 grayed out when multiple layers are selected, for reasons that are explained in the fine print of the dialog box (Figure 4.3). If you're wondering what constitutes an attribute that would be precomposed, 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. Select two layers for precomposing and the Leave All Attributes option is not available. It's hard to read the fine print in this figure, but look closely in the dialog and you'll see that it clearly tells you what will happen depending on which option you choose (when precomposing a single layer, that is).
Why Do It?
Depending on who you ask, precomposing 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 precompose 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 precompose.
- As a fix for render order problems Sometimes it is simply not possible to make one render action occur prior to another without precomposing. For example, if you want to mask a layer after applying effects to it, you must apply the effects to a precomposition 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 dozens of disparate elements (Figure 4.4).
Figure 4.4. Try never to 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, precomposing that part gives you the option of pre-rendering it.
If you're already comfortable with the idea of precomposing, 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.
Notes
Some other compositing applications, and in particular, Discreet's Inferno, seem to have cornered mind share in terms of perceived speed and power. Inferno is powerful, running on customized hardware, but people sometimes fail to notice that it is not truly real time; even Inferno has to render. Inferno artists will conceal this fact by rendering in the background or requiring that elements come in pre-renderedoften (and ironically) from After Effects.
Options and Gotchas
Precomposing a single layer using the Leave All Attributes option is relatively straightforward. Most of the time, however, you will find yourself precomposing multiple layers via the Move All Attributes option, a route that can be 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.
- There is no provision for the need to precompose some attributes, but not all.
- It is difficult to undo precompositions several edits further on.
- Behavior of precomposed Blending modes and 3D transforms changes depending on whether Collapse Transformations is on or off.
- Confusion about recursion: In what cases 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: Precomposing 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 precomposition layer includes empty frames at the top or tail of the shot.
Figure 4.5. Precompose layers offset in time with the Move All Attributes option, and you may not notice that the offset is transferred to the precomposition, while the Master comp shows a layer that appears to begin at 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, as it now is by default.
- In the precomp, 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.
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.
Tip
Included on the book's disc is preCompToLayerDur.jsx. According to its full description at www.motionscript.com, "this script will precompose one or more selected layers with the Move All Attributes option and the resulting new comp's In point will be the earliest In point of the selected layers, and the comp's Out point will be the latest Out point of the selected layers." Load it via File > Scripts > Run Script File.
The Missing Option
There are, of course, situations in which the two options in the Precompose 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 precomposing 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.
Close-Up: Undoing a Precomposition
If you set a precomp 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 precomposing was a bad idea. In that case, the only option is to cut the layers from the precomp 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.
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.
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.6). Turning this option on causes these properties to behave as if the precomposed layers were still in the Master comp; turning it off prevents them from interacting with the Master comp.
Figure 4.6. This switch (highlighted) has two roles (and two names). With a nested composition layer, it is a Collapse Transformations toggle. Enable it, and Blending modes and 3D positions from the nested comp are passed through as if they were not precomposed at all. (Its other role, Continuously Rasterize, applies only to vector layers such as Adobe Illustrator files.)
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.
Close-Up: Grow Bounds
Sometimes enabling Collapse Transformations/Continuously Rasterize is not desirablefor example, if you set up 3D layers in a subcomp and don't want them affected by a camera in the Master comp. This can lead to a gotcha where effects that expand the pixel area occupied by that layer (such as blurs and distortions) are cut off at the edges of the nested composition (Figure 4.7a). By adding the Grow Bounds effect prior to the effect that needs more pixel area, you avoid this problem (Figure 4.7b).
Figures 4.7a and b. The half-oval layer has been precomposed, and a Radial Blur is cut off at the edges of the layer (a). Precomposing would restore the other half of the oval, but Grow Bounds (b) just enlarges the boundaries of the layer so the blur is not truncated.
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.
Close-Up: Collapsing New Blendings
One limitation of turning on Collapse Transformations is that you're thereafter prevented from adding 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 precompose 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 fairly certainly just leave it at the default setting, Advanced 3D (Figure 4.8).
Figure 4.8. Rare is the occasion when you would not use the default Advanced 3D rendering plug-in. The "plug-in" idea was devised offering third parties the ability to write their own 3D renderers for After Effects, but at this writing (and in several years) no developer outside of Adobe has offered one.
And then there are the two Preserve check boxes. Preserve Frame Rate maintains the frame rate of the current composition no matter the frame rate settings wherever you might send itinto another composition with a different frame rate, or into the Render Queue with different frame rate settings. So if you've keyframed a simple cycle animation that looks right at 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, but will maintain 4 fps.
Notes
New in 7.0 is a third rendering plug-in option: OpenGL Hardware. This option is grayed out until you check Enable OpenGL in Preferences > Previews. As with all things OpenGL, this option is a matter of taste; it is likely to offer a more stylized video game look that may not render similarly on two different machines.
Ditto the Preserve Resolution When Nested option: Typically, if an element is scaled down in a precomp and the composition is scaled up in the Master comp, you will want After Effects to treat these two opposing scales as one operation, "concatenating" the transform operations (in computer parlance) so that no data loss occurs via quantization. If you want the data in the subcomp to appear as if it were scaled up from a lower-resolution element, however, toggle on Preserve Resolution When Nested and live it up with the big pixel look.
Adjustment and Guide Layers
|