|Adobe After Effects Tutorial
||Roland R. Kahlenberg,
©2010 by Roland R. Kahlenberg and CreativeCow.net. All rights are reserved.
Recently, CreativeCOW's Roland R. Kahlenberg reviewed Pete O'Connell's latest training DVD, Motion Tracking and Stabilization in Adobe After Effects and while Pete covered a lot of ground, Roland thought he'd add a short tutorial on Reverse Stabilization.
Reverse Stabilization was something I was interested in a few years ago and Philip Vanduren from the COW's AE Expressions forum provided a useful solution. Andrew Kramer uses Reverse Stabilization in a number of his well-known tutorials starting with the Andrew Kramer - Demon Face Warp Tutorial. While Andrew created something really wonderful I thought that the explanation of the process left many users in the dark as to how or why the procedure works. The secret to understanding the entire process is to have a secure grounding on AE's Render Order, the systematic way in which AE renders Masks, Transforms and Effects.
The source footage for this tutorial is nukesAndMill, JPG sequence found on the training DVD within the Project>nukes folder. Take note that the source footage is not provided in the Zip file provided with this tutorial, but you may view the footage in its original, stabilized and reversed stabilization states.
After importing the footage, within the Project Panel, drag the footge icon onto the create new composition icon at the bottom of the Project Panel. This will create a new comp that inherits the dimensions, framerate and duration of the footage. Unfortunately, the comp also inherits the layer's name. Let's rename this comp, Stabi.
To initiate the tracking process, double-click the layer in the Timeline Panel to open its Layer Panel. Next, select Tracker Controls from the Window Menu.
In the Tracker Controls Panel, click on the Track Motion button. Then click on the Rotation checkbox to add it to the properties that will be tracked. With just the default position property we will have a 1-point track but this isn't sufficient for the job as there is some inherent rotation in the footage that we would also like to stabilize.
Now head on to the Layer Panel and set the tracker boxes and Attach Points to the areas where you would like to track. It is ideal to pick two points that are distant from each other as this ensures that the rotation characteristic is better calculated. For a 1-point track, you would place the tracking boxes and the Attach Point at the object to be stabilized.
The image above shows the placements for the two tracker boxes and their respective Attach Points.
Click on the Analyze footage button. Then select Stabilize from the Track Type drop-down menu and click on the Apply button. When prompted with the option to apply the X and Y properties, select the default, X and Y.
Now the tracker data is pasted into the layer's Anchor Point, Position, and Rotation parameters. Note that Position has a keyframe at the first frame and its value is identical to the first frame's value at frame 1. Thereafter, the Anchor Point is animated to track the Attach Point for first track point that you applied in the Layer Panel. You can view the properties for Track Point 1 in the Timeline by twirling down the Motion Trackers parameter. Of importance here is the Attach Point property which contains the values that are applied onto the layer's Anchor Point property when you cliked on the Apply button within the Tracker Controls Panel.
You can test the accuracy of the stabilization by leaving your cursor over a distinct point on the footage in the Composition Panel and playing back a RAM Preview. If your stabilization was solved accurately, you will notice no drift in the distinct object and your cursor will stay steady on the object.
Now change the comp settings such that the comp size is 1400x1050. We will be nesting this composition into a new composition shortly and we need a larger composition setting here to ensure that our reversed stabilised footage doesn't get cutoff along the edges. Now create a new composition and name it ReverseStabi. Ensure that the dimensions are identical to the sequence's inherent dimensions and framerate.
Now nest the Stabi composition into the ReverseStabi composition. We will then proceed to reverse the stabilization.
Setup your work area as per the image below. Essentially, we want to be able to view the Timelines for both the main composition (ReverseStabi) and the nested composition (Stabi) to allow us to pickwhip Expressions from the main composition to the nested composition.
Now create an Expression for the main comp's Anchor Point property and pickwhip to the nested composition's Position property. Then create an Expression for the same layer's Position property and pickwhip to the nested composition's Anchor Point. Finally, create an Expression for the main comp's Rotation property and pickwhip it to the nested composition's Rotation property. Then edit in *-1 to the end of the Expression for Rotation. Multiplying by -1 negates any rotation that was tracked in the nested composition. For example, if the stabilized rotation had a value of 50 degrees, then multiplying by -1 changes that value to -50 thus negating the stabilized information and re-introducing the original movement within the footage.
Perform a RAM Preview and you'll notice that you're essentially viewing the original. So, all that work and we've ended up where we started. Brilliant! Hang in there now, next comes the fun stuff.
Apply a distortion effect on the nested comp in the ReverseStabi composition.. I've used DigiEffect's Freeform plugin which supports 3D displacement and warping but you should be able to mimic the effect with AE's Mesh Warp plugin. For this effect, we're going to warp one of the street lights. We picked the one which is the least obstructed in the footage. Adjust the effect's parameters until you align the warp effect onto the street light. For Freeform and Mesh Warp, this entails adjusting value for the number of rows and columns.
After distorting the image, initiate a RAM Preview and notice that the warp effect stays locked onto the street light. How is it that the warp automagically follows the streetlight? Why did we waste our time stabilizing and then restabilizing the sequence? Why can't I grow my own medicine?
AE's default Render Order renders, sequentially, masks, effects and then transforms in strict accordance regardless of the sequence in which they are applied by the user. In the Stabi composition, things are pretty straightforward. In the ReverseStabi composition, masks are not rendered since none are applied. Take note that even though we applied the Expressions for Anchor Point, Position and Rotation (all transform properties), AE will render the effect (distortion) prior to rendering the Transform properties.
Hence, the warp effect was actually rendered onto the stabilized footage even though we had performed the stabilization prior to applying the distortion effect. In other words, AE first rendered the distortion effect before rendering the Transform properties, in accordance to the default Render Order. Note that the Render Order can be changed from its default sequence of Masks, Effects then Transforms.
If we were to click on the nested composition's Collapse Transform checkbox, we will be changing the default Render Order such that the render sequence will be Transformations, Masks and then Effects. In this scenario, the warp effect is no longer locked to the street light. Instead of explaining the mechanics of what's going on, I'd rather if you thought out the process yourself.
I've also included a text file containing Mocha 2-point tracked data and used it in a similar manner in the included AEP. I've also used Mocha Import, an indispensable tool, to help manage and utilize your tracked data from Mocha or Mocha for AE into AE.
Now that we're done with the Reverse Stabilization tutorial, you are strongly encouraged to purchase Pete's excellent training DVD. You will truly benefit by upgrading your tracking skills by working on real-world projects and picking up invalueable tips and techniques. For now, I'm going to take another look at Pete's last tutorial - Cheers!
Thanks a bunch for your time - with many blessings!
Roland R. Kahlenberg