DIGITAL COMPOSITING: 3D Camera tracking with After Effects
After effects cs6 has a 3D Camera Tracker effect. Before CS6, Matchmover was the best program to use.Match Mover still has some advantages over After effects, such as defining your axes orientation and establishing scale, but for simple scenes, After effects is useful as it doesn’t require additional 3rd party software.
1: Either click the ‘Track Camera’ button in the tracker window, or drag the ‘3D Camera Tracker’ effect onto your footage and in the effects controls tab click ‘analyze’. This will take some time.
Shot type can be changed depending on whether your original shot has fixed or variable zoom. This will help AE calculate more accurate results.
In Advanced, there is a value called Average error. This will show how accurate your analyzed footage was. A value of less than 1 is usually good.
2: Once analyzed, dozens of coloured markers will appar on your footage, tracking individual points throughout the footage. Fast, blurry camera motion will not allow for accurate tracking.
3: Click the ‘Create Camera’ button in the effects controls. This will create a new camera in your timeline, which will move to reflect the tracking data. This is known as ‘Match Moving’.
NB: When you just use footage from a stationary tripod, the Camera track effect cannot produce a 3d scene as there is no shift in viewing perspective. A handheld or moving shot on the other hand will allow AE to produce 3D data. When you hover over your scene you will either get a red circle, indicating no 3d data is saved, or you will get a poly shape produced from the nearest 3 3d points.
4: If you haven’t already made a camera, Pick any poly and right click it and choose ‘Create camera and Text’ or whatever. This will create a camera, as well as a 3d text layer, both of which will be added to the timeline.
5: Create Null objects in your footage, particularly in areas close to, or on the same plane to where you will add your 3d objects in Max. These are necessary as reference points – if your footage imports in the wrong orientation, these can help align it correctly.
GETTING IT INTO 3DS MAX
1: Download a FREE SCRIPT CALLED AE3D EXPORT used to export camera track data from AE into 3d software. File > Script > Run Script file and then run the script. Choose which software you want to export to, and select options such as scale factor if necessary.
*You may get an error message telling you that you need to allow scripts to save files to networks. This can be activated from Edit > Preferences > General
2: Select the layers in the timeline you want to export, including the camera and any null objects, then click ‘export’ in the AE3D popup window. This will create a .ms file – save it where to want it to go.
3: In 3DS Max, Match the render resolution to that of your original footage. To import your camera data, just drag and drop your .ms tracking file onto one of your 3ds max viewports. This will create the camera and any null objects you chose to import. scrubbing through will automatically move this camera, and the timeline has been adjusted to the length of your clip too.
4: If your camera comes in and is facing the wrong way, simply group your camera and nulls together, and rotate the group. Do not rotate individual pieces, as they all have positional data for each keyframe that we need to preserve.
5: Set our original footage as the source, highlight the Camera viewport as the active viewport, then go to View> Viewport Background > Viewport background, and select the source file. Check ‘Animate Background’ to ensure it updates as we scrub frame by frame.
NB: Without Quicktime installed, 3DS Max will not allow you to set a movie file as a viewport background. Instead, use AE or Premiere to convert it to a png sequence first.
6: Now import your 3d model into your scene – you can just drag and drop your max file into the scene. Click merge. Position it, animate etc. Now when you render, the 3d objects will be on your footage, albeit in very basic form – you will need to add lights, shadows, HDRi etc to atcually make it look good in the scene.
1: In your 3d max scene, create geometry to match the surfaces upon which your objects will cast shadows. Make sure that cast shadows is enabled on your light source.
2: Create a new Max material of type Matte/Shadow and apply it to this geometry. It will now only render out the shadows, not the geometry itself. You can also go to Render elements in your render Setup to render out a separate shadow pass, if you ned to adjust this later in the composite.