Join Chris Meyer for an in-depth discussion in this video What could go wrong?, part of After Effects Apprentice: 08 Nesting and Precomposing.
- [Instructor] If you have the exercise files, go ahead and open Precompose_2-Leave. There's only one composition, the Red Apple comp. We'll open that. And we'll preview. This comp uses some of the same elements as the previous chapter, but the titles are animating and the apple is just a plain gray color. So we had the great idea of why don't we take the gray apple, this wireframe apple, and use it as a track matte, that way we can fill it with a colorful movie.
Now I could show you how to do it in an efficient way, but I thought it would be helpful if I first walk you through how not to do it because actually how not to do it is how most people would approach the problem. But first, let's understand a little more about how the apple is actually animating. I'll select the apple layer and I'll click the solo button just so we can focus on just this one layer. First off, notice the layer does not start until one second in. That'll become important later on. At one second, it starts fading up and it also scales up to 100%.
The 3D animation itself is rotating, but it's also doing a little bit of a wiggle and that's thanks to an effect, if I select the layer and press F3, an effect called Wigglerama. If you're wondering where I found this, it's actually an animation preset you'll find underneath behaviors. Also notice that there's a drop shadow and that renders after Wigglerama. So after the apple scales up, it has some random animation, thanks to Wigglerama, and that makes it look a little bit more interesting.
The drop shadow, by the way, is being applied and it looks black. Let's look at the alpha channel. It's adding a black transparent shadow, so that's adding gray values to the layer's alpha channel. So that will be important in just a second. Now that we understand what the apple is doing, let's look at the movie we'll be using to fill its alpha channel with. In the project panel, under sources, I have a nice movie called Light Illusions and it's got some areas that are red and pink, particularly on the left-hand side, that I think would look good filling the apple.
So let's add this movie to the composition. And this is where I start going wrong. I'm adding the fill movie to a composition where the matte is already animating. My first problem is that the movie is sitting on top of the matte. If you remember from the track mattes lesson, the fill always needs to be below the matte. And you might think well, it's starting at time zero and my matte starts at one second, so it must be important to move it in time. Not really.
It just lines up a different part of the movie to the apple. There's my apple, so let's just see which part of the movie. I might even scale it down. There we go, something like that. I'll click on toggle switches and modes and that will bring the track matte pop-ups forward. And I have a choice, really, on whether or not I want to use the alpha matte, which uses the alpha channel, or whether I want to use it as a Luma Matte, and that will take the gray values of the apple as a matte.
Because it's using the gray values, some of the apple is getting a little transparent, so I think I will use it as an alpha matte. Now we have a couple of issues. My first problem is that the apple is scaling up and as it scales up, the fill movie is not scaling with it. And as it wiggles around, it's also wiggling independently of the fill movie. I can partly solve this by opening the parent column and parenting the fill movie to the animated matte layer.
Now, any transformations applied to the apple will also be applied to the fill. So the fill movie will follow the scale animation at the beginning. But remember that the Wigglerama behavior continues to randomly animate the apple and because Wigglerama is an effect and effects are not transferred from parent to child, the fill movie doesn't wiggle around as well. And since I can't think of an easy solution, I'm going to have to compromise here and hope that the problem isn't too noticeable.
However, I think my client is going to notice that the drop shadow is no longer black, it's pink. It's getting its color from the fill movie. If you remember, when we looked at the alpha channel, while the apple was 100% solid, it's creating a drop shadow that's semi-transparent and this transparency, these gray levels, are being used to make the fill movie semi-transparent. Again, I'm digging my hole even deeper because now I have to find another solution.
Now, one solution for this problem is instead of applying the drop shadow to the matte, you apply a layer style to the fill. Now, you can't apply a drop shadow because it would apply it as an effect and the effect would render before the track matte. What's kind of clever about layer styles, and I'll select my fill movie, go down to Layer Styles and select Drop Shadow, is that layer styles are rendering at the end of the render order and they render after the track matte has already been composited.
Of course, this is not a great workaround because the layer style looks a little bit different than the drop shadow effect applied to the two title layers, so I have to spend some time matching the look. Okay, but let's say I get that working. I like the way the fill is working. I can live with the fact that the fill movie is not bouncing around. I can match the shadow. But let's say I have another great idea and that's to apply a distortion effect, something that really has to be applied after the track matte has been composited.
Let me give you an example. If I select the apple and apply effect, distort, Turbulent Displace, and I displace the apple, notice it's having no effect on the fill movie. Again, effects are never applied from parent to child. So let's copy that and delete it and let's apply it to the fill. And now you can see that the fill movie is being distorted, but not the apple. To distort both layers after the track matte is composited, I'll have to pre-compose, and then I'll have one layer that I can apply a distortion effect to.
So I select both layers, pre-compose, and because I have two layers selected, I don't have a choice which option to use, I have to move all the attributes. Attributes are all of your keyframes, all of your effects, layer styles, the position of the layer in the composition, and where it appears in time in the timeline. These are all attributes that are going to be moved into the pre-comp. So let's give this a name, Apple + Matte.
We'll open the new composition. Click OK. And now we have our apple and track matte appearing together in the pre-comp. All of the keyframes are there. Our apple matte has scale and opacity keyframes as well as some effects. And our fill movie has the layer style. I've just rearranged the hierarchy so these two layers appear in one pre-comp and the output of the pre-comp is the source of layer one in my main comp. Notice that the pre-comp is the same size as the main comp.
Also notice it has the same duration in the timeline. If you remembered, nothing is happening in the pre-comp for the first second. And then the layer starts scaling and fading up. When I go to the main comp, however, I have a layer bar that looks like something might be happening for the first second. I call these frames empty calories. You might want to trim out the first second just to remind you that nothing is happening with this section. But another issue I don't like is the fact that the opacity keyframes and the scale keyframes are appearing down in the pre-comp.
I don't like to bury my keyframes. I'll also delete the layer style because I can apply a drop shadow effect in the top comp. I'll click on the word opacity to select both opacity keyframes, move in time to the second keyframe, then shift+click Scale to select the scale keyframes. Now when I cut the keyframes, the layer will be at 100% scale and 100% opacity. So I can paste my scale and opacity keyframes and now I have them at the top level where they're easier to manage.
And let's get our drop shadow. We have a drop shadow here that we'd like to match for the apple, and we'll paste, and now we're kind of back in a position where we'd like to be to continue working. So now that I have both the apple and the matte as a single layer, I can apply a distortion effect like Turbulent Displace and I can distort both layers at the same time. So that was a lot of steps and remember all I really wanted to do and all I've really accomplished in all of this is that I added a track matte to make the apple a little more interesting and I applied Turbulent Displace to the group.
The rest of the time I spent digging a hole and then trying to solve problems with the rendering order. In the next movie, I'm going to show you a much better approach to accomplishing the same task and it'll be a very good example of the differences between leave all attributes and move all attributes.
The After Effects Apprentice series was created by Trish and Chris Meyer. These tutorials are designed for After Effects CS4 through CC, and can be used on their own or as a companion to the Meyer's book, After Effects Apprentice.
- Grouping layers by nesting and precomposing
- Identifying and solving render order issues
- Navigating composition hierarchies
- Editing a precomp while viewing the result in another composition
- Preserving the frame rate of a nested composition
Skill Level Intermediate
Q: This course was updated on 11/29/2012. What changed?
A: We added a new chapter, "Render Order Exceptions." It contains four new movies: Continuous rasterization, The Transform effect, Collapse transformations, and Compound effects. We also added a movie that shows our premium subscribers how to use the exercise files, including the new exercise files designed for After Effects CS6.