Null Averaging

iaian7 » tutorials » aftereffects   John Einselen, 14.06.07 (updated 12.08.10)    

x = (thisComp.layer("Null 1").transform.position[0]+thisComp.layer("Null 2").transform.position[0]+thisComp.layer("Null 3").transform.position[0]+thisComp.layer("Null 4").transform.position[0]+thisComp.layer("Null 5").transform.position[0]+thisComp.layer("Null 6").transform.position[0])/6; y = (thisComp.layer("Null 1").transform.position[1]+thisComp.layer("Null 2").transform.position[1]+thisComp.layer("Null 3").transform.position[1]+thisComp.layer("Null 4").transform.position[1]+thisComp.layer("Null 5").transform.position[1]+thisComp.layer("Null 6").transform.position[1])/6; [x, y]

Tracking in After Effects can often result in data too jittery to be of any use. If you’re able to get multiple tracks, however, it’s possible to average them into a single, smoother, track. Even if the single tracks are decent, averaging will help increase the accuracy of the data.

These expressions work with 6 tracking nulls, but it’s easy to modify for any number of tracks. Keep in mind that camera distortion, small amounts of rotation, or other factors can screw up an array of tracks unless they’re spaced evenly on either side of the scene. You want to average your sample point locations and get good overall coverage of the scene.

Each tracker must also exist throughout the entire shot, or it’s stationary position will be averaged into the result, and your final track will move less than it should. If tracked details move out of the scene while After Effects is analysing the motion (such as a pan that traverses more than the total width of the frame), you’ll need to manually supervise each tracking null. When the tracker looses a spot, go back a few frames and hold down the option (alt) key to drag the tracking area to a new trackable image detail and resume. It’s a great way to get long tracks to work, and especially so for scenes where there aren’t any consistent tracking marks.