Simple tracker example



by Al Street

© 2001  Al Street. All Rights Reserved.


Overview:
In this tutorial we will generate some simple footage, track it in After Effects,and bring the tracked motion back into LightWave.


Download the LW scene file here:

PC archive

Mac Archive


In Layout

Step 1: Load the example scene file (tracker_test.lws). There is a luminous sphere which travels from left to right with some random vertical motion.

Step 2: Render frames 1 - 60 of the scene to a jpeg sequence ('tracker_test_.jpg') at 320x240 pixels.

Step 3: In the Image Editor, load the jpeg sequence. Set the Image Type to 'Sequence'. Set Start Frame to 1.

Step 4: Under Scene > Compositing, choose 'tracker_test_ (sequence)' as the background image.

Step 5: Press 'd' for Display Options. Choose 'Background Image' for 'Camera View Background'. You should be able to see the background image in the camera viewport.

In After Effects

Step 1: Import the jpeg sequence into your compositing program. For this example, we used After Effects.

Step 2: Drag the footage from the project window to the 'Create a New Composition' icon (at the bottom of the project window).

Step 3: Create a solid layer of any dimensions and position it below the footage layer in the timeline window. This layer will receive the keys created by the tracker.

Step 4: Select the footage layer and go to the motion tracker. Select 'Track' from the Type popup menu and check 'Position'. Move the Feature and Search regions into position and make sure the crosshairs are centered on the ball. Click 'Analyze' to track the sphere and 'Apply' the results when finished.

Step 5: In the timeline, select the solid layer and press 'p' to expose the 'position' track. Click on 'Position'. This selects all the keyframes from the track operation. Copy the keyframes to the clipboard (CONTROL - C in Windows). Don't worry if the values in these figures are different from the ones you get. The figures are from a larger (720x486) image sequence.

Step 6: Open Notepad and paste the keyframes in (CONTROL - V in Windows). Save the Notepad file as "tracker_test.aek".While still in Notepad, examine the keyframe file. Note that the frames are numbered 0 thru 59, even though I have 'Start Frame' set as 1 in both the Composition Settings and the Project Settings (Start Numbering Frames at: 1). Because of this apparent bug, we will have to make a small adjustment back in Layout after we load the tracked motion.


Back In Layout

Step 1: Make sure that "AutoKey" (at bottom center of Layout interface) is turned ON.  Select the object 'tracker_Null' and then run transMotion3D. Select the file you just made from Notepad (be aware that Notepad may add the extension '.txt' to the filename). Choose 'After Effects' as the Input Format.

Choose 'LightWave' as the Output Format and check 'Load Motion File to selected item". Check 'Use File Keyframe Data'. This will cause keys to be created at the same frames as those in the Notepad file from AE. Check 'Flip Y Position Data'. This will invert the Y Position (and Pitch rotation, although we won't see that because it's zero). We need this because positive Y is 'Down' in AE and 'Up' in LW. Set 'Frames Per Second' to 30.0 to match the footage we rendered earlier. Leave Scale Factor at 100.0% and Pixel Aspect Ratio at 1.0 Check AutoCam and select "tracker_test_(sequence) as the Reference Image. Click 'Ok'. Enter a name at the prompt for a new camera, or just hit enter to use the default name.

Step 2: In the camera view, you should see the background footage. Select the 'tracker_Null' again and open the Graph Editor. Shift-Select the X, Y, and Z position tracks and then select all the keys (Shift - doubleclick in the margin area near the scale on the left side of the graph.) Now hold down the Control key and move all the keys one frame to the right. This puts them at frames 1 thru 60 instead of 0 thru 59 as before. Close the Graph Editor. Go to frame 1 of the animation. The tracker_Null should be approximately centered on the ball of the background footage. Play the animation in Layout or scrub thru the keys and note that the null follows the ball. If it doesn't appear to be precisely centered on the ball, that's because the tracking operation wasn't perfect. Around frame 25 another ball should just begin to appear in the display in the upper left. That's the original object that is still in Layout. Clear that object (20m_dia_sphere) from the scene, as it was only there to help generate the original footage.

What did the plugin do? It applied the tracker keyframes to the null, then created a default camera. It calculated the proper position of the camera based on the size of the footage and the Horizontal Field of View of the camera, then moved the camera into position. The tracker object is aligned properly with the background footage, and the scene is ready for the addition of 3D models or effects designed to match the tracked feature of the background footage.