Archive for November, 2012

Tutorial – Light fog in After Effects – Part 2

Monday, November 12th, 2012

In part 1 of this tutorial, we went through rendering and setup of the composite for a scene with a light fog effect to be made in After Effects. Next we’ll take the 3D movement data from Maya and apply that to the CC Light Burst effect so that the light fog emanates from the right place.

For those of you who skipped the first part as you only want the tracking tutorial, the first thing you’ll need is a Maya scene. I’ll be working from the sample scene I provided in part 1 of this tutorial, but make sure your scene at least have the following:

• A camera with animation keys
• A locator snapped to the same position as the light source that emits the fog. (If you have multiple sources you want to track then have a locator for each one, but for the sake of this tutorial I’m only operating as if one is present.) If the light source moves, then be sure the locator moves with it (a point constraint works well for this).

Next, you’ll need to convert the camera and locator data into a format that After Effects can use:

• Rename your camera to ‘camera1’ and your null to ‘null1’
• Select your camera and locator, then go to Edit -> Keys -> Bake Simulation (use default options)
• With the camera and locator still selected, go to File -> Export Selection and export to an alternate version of this sequence. Be sure you set the format to ‘Maya ASCII’ (.ma).
• Open this .ma file to make sure everything appears right. Your scene should consist ONLY of the camera and locator. (If you use a camera with aim and such, the camera group and camera aim nodes are okay to have around; at this point they’re redundant, but they aren’t harming anything. Just make sure the camera itself is only receiving information from the animation keys after the simulation is baked.)

The next step is to bring this information into After Effects.

• Import the .ma file into After Effects. This should create a new composition with the name of the file you imported which contains a cameraShape1, a nullShape1, and any extraneous nodes (mine included a camera1_group node but I deleted it as it wasn’t doing anything).
• The camera and null1 will have animation keys for each and every frame. (Figure 7) Feel free to remove any keys that aren’t necessary. I’d leave the camera alone, but if your light source is completely stationary (ie: it’s the camera that moves, not the light or other tracked objects), there’s no sense in having After Effects process animation keys on the null1 node.
• Rename this composition to ‘tracking’

Fig. 7

Once you’re sure the composition works properly, it’s time to make it into something the After Effects tracker can use.

• Create a black solid that covers the entire composition. There should be no transparency present in the composition. Set it as the bottommost layer in this comp.
• Create a white solid and drop it into your scene. Hit your Toggle Switches / Modes button, make the layer 3D and set its anchor point to 0,0,0. Pick-whip the white solid layer so that it’s parented to follow your nullShape1 layer. Set its position to 0,0,0. (Figure 8 )
• By now the top-left corner of the white solid layer should be matched up with the top-left corner of nullShape1, however the white solid should look very large and, depending on your specific scene, be very blurry. This is because the nullShape1 is, by default, scaled way too large. Correct this by scaling it down to a very small number (my scene was set to around 0.1%). The end result should have the white solid look like a relatively small, crisp-edged square that will be easy to track. (Figure 9)

Fig. 8

Fig. 9

Now your composition should be set up such that the camera moves in 3D and the white solid appears to be a flat 2D plane facing “forward” (towards the camera, but at an angle depending on the camera’s position/rotation). Let’s use After Effects’ tracking tools to convert the position of the top-left corner of the solid (or more specifically, the position of the null1Shape node which matches the light source) into 2D information that can then be pumped into a 2D layer or effect.

• Drop your ‘tracking’ composition into ‘fogComp’. With the tracking layer selected, go to Animation -> Track Motion
• Drag the very center of your track point to the top-left corner of the white box. A square around the center point will show you a zoomed-in view to help ensure good placement.
• In the Tracker pane, click the forward button on Analyze to track the motion. Make sure you’re at the first frame of your composition (or where you would otherwise like the tracking to start). After Effects will move forward through the sequence and apply a keyframe to the tracker for each frame. (Figure 10)

Fig. 10

At this point you can hide the tracker layer. Now to link the Center of the CC Light Burst to this tracking data.

• Hit the drop-down menu on your adjustment layer, open the CC Light Burst effect, then hold the Alt key while hitting the stop watch next to the Center attribute
• Click the pick-whip on this expression menu and drag it to the Feature Center of your tracking layer’s Motion Tracker. (Figure 11)

Fig. 11

Now if you scrub through the timeline, you should notice that the Center attribute of your CC Light Burst effect is moving in place with the motion tracker. (Note that your computer may respond slowly; you can help improve performance by changing your Resolution to Half, Third, or even Quarter.) If you go back to your mainComp, this will map forward to the final composite. (Figure 12)

Again, this is a very specific application of this type of 3D -> 2D motion tracking, but there are tons of other uses for this. Want pop-up labels to move with the camera? Simulate sprites without dynamics? Fireflies in the background during a night scene? Go nuts!

I hope this was helpful. If you have any questions, please leave me a note in the comments section or shoot me an email at Thanks for reading!

Click here to return to the blog
Click here to go to the front page

Tutorial – Light fog in After Effects – Part 1

Thursday, November 1st, 2012

I’ve had a lot of fun tinkering around with various tricks in After Effects to see how I could integrate them into my 3D renders. One visual effect I was trying to work with recently was light fog: the idea was to have a stationary prop placed in front of a bright light, only visible by its silhouette, with light fog casing around its shape. I know how to do this in Maya, however I wanted to do it in post due as tweaking the effect in the 3D software to get the desired look can require a lot of guesswork and be slow to render. The basic look is easy enough to accomplish in post with the CC Light Burst effect, except that although the prop itself was stationary, the camera itself moves in the Maya sequence: the center point of the light burst would have to move in 3D space, and CC Light Burst is a 2D effect. I was eventually able to get this work by taking locator and camera data from Maya, tracking that locator data, and then transferring the 2D coordinates from the tracker to the CC Light Burst effect.

Confused yet? I’ll start from the beginning.

This tutorial is split into two parts: the first part will focus on rendering and compositing your Maya scene for the light fog effect described above, and the second part will walk through how to take the 3D placement data from your Maya scene and track it using After Effects.

First, you need a Maya scene. I’ve provided a very basic scene with a cube, a bright mental ray area light, a polygonal ground plane, and a camera with animation keys. (Figure 1). I’ve also set up the proper render layers for this tutorial, though to understand the workflow I’d recommend deleting the render layers and following along. This workflow should work with any scene, but be sure you have the following as they’ll be needed for tracking in After Effects:

• A camera with animation keys
• A locator point-constrained to the light source (the point constrain is only necessary if the light source itself moves.Otherwise, snap the locator so it’s placed in the exact same position as the light). If you have multiple light sources or objects you want to track, you’ll need a locator for each one.

Fig. 1

With the scene ready, it’s time to set this up for rendering. For the light fog effect, you’ll need these three render layers:

• A beauty pass
• An RGB matte pass with the cube and ground plane assigned to different colors
• An RGB shadow pass that will serve as a matte for the light fog effect. This will be used to luma mask the CC Light Burst effect so that it doesn’t show in front of the cube within its shadow.

The beauty pass is simple enough. For this scene, the default masterLayer will suffice.

For the RGB matte, select the poly cube and the ground plane and assign them to a new render layer called ‘rgb_matte’. Assign a pure red surface shader to the cube and a pure green surface shader to the ground plane. (Figure 2) We’ll use this to key the box out in After Effects.

Fig. 2

The RGB shadow pass layer is a little tricky. I’ve had difficulty using Maya’s and mental ray’s shadow pass systems, however Jeremy Birn has a very excellent tutorial on the setup and merits of making an RGB shadow pass. The best workflow I’ve found is to duplicate the light source (rename it to some variant of ‘shadow light’ to avoid confusion), hide the primary light, turn off any decay that may be present (this is why we duplicate the light; you can’t use layer overrides for decay rate), apply Jeremy Birn’s workflow for making a shadow pass, and set the value of its shadow color to a very high level (I used 100). (Figure 3) The result should have very strong contrast between black and whatever primary color you choose, though the look can be tweaked in After Effects with color correction effects when we key the background out.

Fig. 3

With everything ready, batch render the sequence and bring those renders into After Effects. Make sure the alpha settings are set properly: the RGB shadow pass will need to have its alpha ignored to be properly luma keyed later. Drop the beauty pass into its own composition and name this composition “mainComp”.

We’ll be building a separate composition specifically for the fog effect. To start this, drop in the beauty pass. (We’ll only be using it as a visual guide and this will be hidden at the very end.) Rename this comp to ‘fogComp’. Next, drop in a white solid, then drop in the rgb_matte render. We’ll need to apply a Set Matte effect to the rgb_matte layer and set its ‘Use For Matte’ to red channel. Next, select the white solid and set its track matte to alpha. At this point, your composition should look like the beauty pass with an additional white box covering the cube. (Figure 4) If everything looks lined up properly, you can hide the beauty pass layer in fogComp.

Fig. 4

Next, we need to build the light fog effect. First, create a new adjustment layer and also drag on the RGB shadow sequence, placing it above the adjustment layer. Apply a Set Channels effect to the RGB shadow layer and set all color sources to whatever color channel you set as the shadow color in Maya (in my case, green). Then, select the adjustment layer, set its track matte to Luma Inverted, and apply a CC Light Burst effect. Tweak the Intensity and Ray Length as desired. The result should have the white cube visible with light fog extending around its edges, except for where its shadow on the ground plane would be obstructing it. (Figure 5)

Fig. 5

Everything looks good so far, however the light fog should be going around the box; the box itself shouldn’t be lit. To fix this, drag on a black solid and the RGB matte. Re-apply the Set Matte effect to the RGB matte layer like we did a few minutes ago to isolate the red cube, then apply this as an alpha track matte to the black solid we just placed. There should now be a black ‘cutout’ where the box was, however there may be a thin white line going around the bottom edge of the box. To fix this, go down to the rgb matte layer that’s affecting the white solid layer and apply a Minimax effect, setting its operation to Minimum, its radius to 1, and the channel to Alpha. This should remove the thin white line. (Figure 6)

Fig. 6

From here you can tweak the look of the light fog. For starters, you can add a Levels effect to the RGB shadow layer to adjust the spread of the light fog onto the ground plane, or you can apply some Gaussian blur effects to the RGB matte layers to soften the edge of the fog.

Now to apply this light fog effect our mainComp. Go to mainComp and drop the fogComp on top of it, sending its blend mode to Screen. If you scrub through your timeline you should now have the silhouette of the cube with light fog being cast from its edges, however there’s no directionality to the light fog: it’s always being emitted from the very center of the composition. For stills or sequences with minimal camera movement you can move the Center attribute of the CC Light Burst effect and be done with it, but for complex sequences or animations where the camera moves a lot this may not be practical.

In the next part of the tutorial, we’ll go over how to take the animation data already in Maya and apply that to a 2D effect in After Effects. If you have any questions about this part of the workflow, shoot me an email at or leave a note in the comments section. Thanks for reading!

Click here to return to the blog
Click here to go to the front page