Tutorial: Postapocalyptic City Part 2

Compositing in After Effects is in many ways very similar to working in Photoshop. If you are familiar with layers, masks, blending modes and/or filters, compositing in After Effects should be a breeze.

Go to Part 1

5. Importing footage

Open After Effects. Press Ctrl+I for Windows or Cmd+I on the Mac to import the render passes. Navigate to correct folder and select all files by pressing Ctrl+A/Cmd+A. Make sure to check the box called Multiple Sequences. Then press Open.

picture-48

After Effects is now going to ask you whether the Targa files are premultiplied or not. As we checked the premultiplied box when outputting files from max, they are indeed. We didn’t set any background color in 3ds max and so it should be black which is the default. As a result, we’ll choose Premultiplied – Matted With Color and make sure that color is set to back which is the default in After Effects.

picture-49

As you are importing four image sequences, you’ll be asked the same question four times. Answer Premultiplied – Matted With Color every time.

6. Layers and blending modes

Now that the footage has been added, you need to drag it down to the time line. Start with your main pass, in my case city{0000-0100} and scrub to a place in the time line where you are able to see both the city and the sky.

picture-51

To add a bit more light and a hint of global illumination, we’ll add the occlusion pass next. This pass goes above the main pass.

picture-52

To see the main pass through the occlusion pass, we need to change the blending mode for the occlusion pass from Normal to Soft Light.

picture-54

You might need to press the middle button in the lower left corner to get to the blending mode options.

picture-551

To make the scene less gray and boring-looking, we’ll give the scene a yellow tint as if sunlight was illuminating the city. Right-click below the two render passes you added, choose New and then Solid.

picture-56

Then, under Solid Settings, give the solid a light, yellow color.

picture-57

Change the blending mode for the solid to Multiply.

picture-58

As you can see, this gives us a slight problem as the sky just turned yellow too. This is because unlike the rendered passes, the solid does not come with a built-in alpha. To add one and get rid of the yellowness, first drag the matte render pass into the time line. Drag it to the bottom of the stack.

picture-59

This seemingly cleared up the matter at once as the sky instantly went back to black. However, this only happened because the underlying matte is black in the area representing the sky and that anything (including light yellow) multiplied by black becomes black. To make the sky area of the solid truly transparent, you need to right-click the solid, choose Effect, Channel and then Set Matte.

picture-60

In the Take Matte From Layer drop down, select the matte which will be the fourth option. As the matte doesn’t come with an alpha channel, you have to change the Use For Matte option from Alpha Channel to either Red Channel, Green Channel or Blue Channel. As the matte is grayscale, the red, green and blue channel contains the exact same data and it doesn’t matter which one you choose.

picture-61

The solid is now transparent. As we’ll be needing to apply the matte to other layers later, select the matte in the Effect Controls window and press Ctrl+C/Cmd+C to copy it. Next up is the z depth pass. This can be used for two purposes, but here we’ll use it to decrease contrast further back to put some “air” between the foreground and the background. Drag the z depth pass to the top of the time line.

picture-62

As we wish to decrease the contrast more the further away you get, we want the lightest areas in the background. To achieve this, we’ll invert the layer by right-clicking it, choosing Effect, Channel and Invert.

picture-63

Then set the blending mode to Add.

picture-64

We have now successfully put some “air” between the foreground and the background, but in reality, this “air” isn’t white on a sunny day, but the color of the sky. We’ll apply a color correction to the z depth pass by right-clicking it again and choosing Effect, Color Correction and Hue/Saturation.

picture-65

Check the box called Colorize and then turn the Colorize Hue knob to somewhere round -160.

picture-66

Also, the sky has turned white, due to the fact that the z depth pass does not contain an alpha channel. With the z depth pass selected in the time line, highlight the Effect Controls panel above and press Ctrl+V/Cmd+V to paste in the matte from earlier. The Take Matte From Layer drop down resets for some reason, so we have to select our matte layer again.

picture-110

7. Sky replacement

Now that we have a basic composite for the buildings, we’ll proceed with replacing the sky. First step is to find a suitable image. Personally, I went over to CG Textures and downloaded one of their Skies 360 images. Import the image by pressing Ctrl+I/Cmd+I and pointing to it on your hard drive.

picture-27

Next, drag the new sky layer into the composite, directly underneath your main layer.

picture-35

Right away, the sky looks too large and rather boring so we’ll try making it a bit more interesting. First, reduce its size by expanding the layer (press the little triangle) and scale it down to around 40% under Transform.

picture-410

In the viewer, drag the sky layer upwards to match the horizon in the cityscape.

picture-53

Select the sky layer and press Ctrl+D/Cmd+D to duplicate it. Rename the layer to something like Sky Flipped. To do this you select the layer on the time line and hit Return on the keyboard to rename it. As you might have figured out by now, we’ll be flipping this layer. We’re doing this to conceal the fact that we’re using the same sky map twice. Expand the layer again, uncheck the little link symbol next to Scale and set the first value to -40% instead of 40%. Then check the link symbol again and in the viewer move the sky so the cloud formations doesn’t overlap with the same ones in the layer underneath.

picture-71

Now for the fun part: Still using the Sky Flipped layer, play around with different blending modes until you get a dramatic effect. I ended up with Linear Light. Don’t think about matching the color to the rest of the image yet, we’ll look at that next. You now have two sky layers you can animate at different speeds, making it look like some clouds are moving faster than others across the screen. Don’t animate anything just yet though.

picture-81

To make the sky and the 3d clash less, we’ll create what’s called an Adjustment Layer. An Adjustment Layer doesn’t contain graphics, but will let you apply effects to it that also applies to all layers below it. To create one, right-click any empty space in the time line and choose New and Adjustment Layer.

picture-91

In this case, we only want the Adjustment Layer to affect the sky, so we will drag it to right above our two sky layers. If you like, you can rename the layer to something like Sky Adjustments. Now that we have the Sky Adjustments layer in place, right-click it, choose Effect, Color Correction and Hue/Saturation.

picture-101

Now, dial Master Hue back to round -10 and Master Saturation to about -50 and the sky and city should begin to match each other.

picture-111

8. Tracking

The sky replacement is now almost finished, but one major thing is missing. While the rendered footage is constantly moving, the sky maps are stationary, making the composite painfully obvious as soon as you hit the play button. In other words, we’ll have to animate the sky, making it look like it follows the city horizon. Doing this by hand can be very time consuming and painful, though luckily there is a better way called tracking. When tracking a shot, you’re basically making After Effects watch a few selected areas of the image, frame by frame, and recording their movements. You can then apply the same movement to other objects in the scene. Areas used for tracking are preferably points of high contrast that don’t deform too much during the clip, making it easy for After Effects to recognize through a long sequence of frames. In this respect, the shot we’ve just created is rather difficult to track. Nearly every part of the rendered sequence deforms over time. In addition the sky needs to move with the horizon, confining the area of tracking to that fine line which is almost constantly deforming. In other words, tracking this shot, although possible, will probably be difficult and time consuming.

Luckily, we’re talking about a 3D render here, and so we have the means to fix this pretty easily. Go back to 3ds max, create two pyramid shapes and place them close to the horizon, looking through the camera. Make sure to space them a little apart. Now, hide all other geometry in your scene, give the pyramids a white, self-illuminated texture and render the sequence against a black background. Instant tracking markers!

picture-122

This makes tracking a breeze. Import the pyramid pass and drag it to the bottom of the time line.

picture-131

We also need something to apply the motion to. For this we’ll be using what’s called a Null Object. Basically an invisible object that can store information about position, rotation and scale. Rather like a Dummy in 3ds max. To add one, right click an empty spot on the time line, choose New and Null Object.

picture-141

With the Null in place, right-click the pyramid layer and choose Track Motion. A panel named Tracker Controls will appear on the lower right of your screen.

picture-161

For this scene we need to track both Position, Rotation and Scale so make sure all three boxes are checked. As it’s hard tracking rotation and scale with only one Track Point, an additional point will appear once you check them.

picture-171

Click the button called Edit Target and make sure it is set to our Null Object. This will make sure the motion data will be transferred to the Null Object when racking is finished.

picture-181

Now we need to decide whether we are going to track forwards or backwards. In our case, the tracking points (pyramids) are actually out of frame at the beginning of the clip, so we’ll track backwards. That means scrubbing the time slider to the last frame.

picture-191

Having chosen a frame, we need to align the Track Points with the pyramids. Click and drag one to the lowest corner of each pyramid. We’re choosing the lowest points as they are the last parts of the pyramids to exit the frame before they disappear completely, which gives us another couple of frames of tracking.

picture-201

Now press the Analyze Backwards button and watch After Effects tracking the scene. As you can see, the pyramids disappear after a while, making the Track Points stop, but after that point we don’t see the horizon anymore and as the point here is to track the sky, that’s perfectly acceptable.

picture-211

picture-221

Having finished the tracking, press the Apply button to transfer the position, rotation and scale information to our Null Object. Dimensions should be both X and Y.

picture-231

picture-241

Try playing the animation to check whether the Null is now fixed to the horizon.

picture-251

The final piece of the tracking puzzle is to scrub to the frame where you aligned the sky horizon with the city horizon and parent the the sky layers to the Null once there. Parenting in After Effects is similar to linking in 3ds max, meaning the parented layers will follow their parent. To parent both sky layers to the Null, select them and drag the little spiral icon on one of the layers to the Null Object.

picture-261

Play the animation again and make sure the sky stays within the frame at all times. If it doesn’t – move the sky layers around in the viewer until they do. Congratulations! You have successfully tracked a shot in After Effects! You can now go ahead and animate the sky layers if you want.

9. Blur, grain and pre-comps

We’re definitely getting somewhere now and to round off the shot we’ll add some depth of field, blur and a bit of grain. All three effects helps us hide the fact that the buildings are a bit low-poly to be in the foreground and that the sky and city doesn’t blend perfectly yet.

9.1 Depth of field

As depth of field is an effect we want applied to the whole image, we’ll first create a new Adjustment Layer and make it the top layer. I’ll name it Depth of field. We’ll also drag in a new z depth layer and make it the bottom layer. Having done that, right-click the newly created Adjustment Layer, choose Effect, Blur & Sharpen and Lens Blur.

picture-271

The image instantly blurs all over. In the Depth Map Layer select the bottom z depth layer. Also check Repeat Edge Pixels to get rid of the dark border surrounding the frame.

picture-281

Use Blur Focal Distance to focus and Iris Radius to control how much blur you apply. In this example I set Blur Focal Distance to 215 and Iris Radius to 25.

picture-29

This leaves us with one problem though, as the sky gets blurred way too much. To fix this, we have to tweak the z depth layer we just added a little bit. Select the bottom z depth layer and in the menu bar go to Layer and Pre-Compose.

picture-301

This creates a new composition within our main one, meaning we will be able to output the new composition as a new, modified z depth layer. Name the new composition Z, move all attributes to the new composition and open it.

picture-311

As you can see in the new composition, the sky area of the z depth is represented as pitch black, making the Lens Blur effect read the sky as really, really far away and that it therefore should be really, really blurred. We’ll change the color to something brighter, making Lens Blur go more easy on the sky.

picture-321

Create a solid by right-clicking in the timeline and choosing New and Solid. Make the color light gray this time. in this tutorial, I’m going for #8A8A8A. The solid goes below the z depth layer.

picture-331

Drag in a new matte from the Project tab and make it the bottom layer.

picture-341

Right-click on the z depth layer, choose Effect, Channel and Set Matte. Set Take Matte From Layer to the matte and set User For Matte to Red Channel, Green Channel or Blue Channel. Now we have a z depth map with a lighter background.

picture-361

Back in the main composition, you’ll notice the sky is significantly less blurred.

picture-112

9.2 Blur

I would recommend adding a small amount of blur to the composition as 3d renders often gets too crisp. To do this, simply add another Adjustment Layer, call it Blur and add the effect called Fast Blur. Set the Blurriness to somewhere between 0,5 and 2 and make sure to Repeat Edge Pixels.

picture-113

9.3 Grain

Finally, if you wish to give the shot a more filmic look, you might consider adding some grain as well. Create yet another Adjustment Layer, call it Grain and add the effect called Add Grain. There are a lot of settings to play with here, but I ended up with the Preset called Eastman EXR 50D (5245) and decreasing the Intensity to 0.9. I also set the Viewing Mode to FinalĀ  Output.

picture-210

I guess this is all for now. I know there are still a ton of things I could have gone in more detail about or explained better, but I had to stop somewhere :-) If you’re stuck, want something explained better or just want to tell me how plain wrong I am, feel free to leave a comment and I’ll answer you as soon as I can.

Go to Part 1

Twitter Digg Delicious Stumbleupon Technorati Facebook Email

2 Responses to “Tutorial: Postapocalyptic City Part 2”

  1. Simply wonderful !!
    Thanks again !!

Trackbacks/Pingbacks

  1. Tutorial: Postapocalyptic City Part 1 at thimic.net - 23. Apr, 2009

    [...] about « Previz draft 2 and some other stuff Tutorial: Postapocalyptic City Part 2 » [...]