Blender is a wonderful 3D program, and let’s not forget that it’s free as the air. This might lead you to believe that because it’s free it’s not worth much. The truth is that it stacks up very well against the top 3D software in many areas such as in terms of modelling and rendering quality, and it can also do things that some can’t.
In this article we will show you the facility for camera tracking in Blender and suggest some ways you can use it for visual effects.
The Right Track
Where Blender makes its money is not on the software but on manuals and tutorials. It’s a good business model, but it does mean that the features and power of the software are lost on most users.
Camera tracking is a high-end application, or at least it used to be. The ability to load a piece of video footage and analyse it through tracking details in the image and then turn that tracked data into moves in a 3D virtual camera was a feature in many premium software packages. Now it’s gotten to the point where everyone with a video camera and a computer wants to do green screen and camera tracking to add visual effects to their videos. It’s not a rich man’s game anymore.
Doing it properly, however, is an art and a science and not for the faint-hearted. It’s not automatic by any means; you have to have good source material, and you have to know how to improve the data you get to make the effects more seamless.
Use Single Images
The first step is to turn your video into a sequence of images. This is not an essential step, but experience tells us tracks made from sequences of single images are more reliable than those made from videos. This might be because sometimes videos are compressed and full of compression artifacts, and converting to still images calms this down a bit.
If your source material isn’t already single images, you can create a folder of images using either QuickTime 7 or MPEG Streamclip.
Load Your Footage
Open Blender and use the top menu to go into the “Motion Tracking” view.
Open the footage using the “Open” button at the bottom of the screen.
It’s a good idea, especially if your footage contains a lot of rotation and other movements which are not merely side to side or up and down, to select the source camera from the drop-down menu on the right-hand side. This sets the focal length of the lens and size of the sensor, which is useful information that the program needs for its calculations.
If you forget to do that, step your track may be okay, but best to set it if you can.
Click the “Detect Features” button in the Track tab.
A series of markers will be added to your screen, indicating points of high contrast in the video which can be tracked.
There are a couple of settings where you can restrict the search area and size of search. These can be critical, and you can tweak this if you need to add a bit more precision to the track. Obviously the size of the search area can have a hit on processing time.
Once you are all set, check that all markers are selected and that the playhead is at the beginning of the video, and you can begin tracking. Click to track forward using the play button further down the track panel, and the program will begin to track the image details under the markers for the duration of the video.
You can set the duration of the video and the segment to be tracked down in the bottom in the from and to fields by the transport controls. The track may take a while to complete.
During the track, some markers will go offline. They switch off, losing their handles and rotation tool, and have the appearance of a plain square. Once you get to the end, you can delete any failed markers. Select them with right button (using “Shift” if you want to select more than one), and then delete with the “Delete” key, confirming delete with a mouse click.
Finally a Solution
Once you have markers tracked, you can produce a camera solution. Select all the markers you want to solve, and click the “Solve Camera Motion” button on the Solve tab. If there are fewer than eight markers, the camera solve won’t run.
Once the solution has completed, you will see an indication of the amount of errors at the bottom of the screen. A high percentage of errors means the track will be wobbly, and any assets that tie to the track will not be locked down to the background.
You can clean up the markers using the “Clean Up” menu (open it by clicking the triangle) and searching for the markers which reported the percentage error. Type in the amount of error, and then choose “select” from the drop-down if it’s not already selected. Make sure all the markers are unselected by using the A toggle key. Then press search, and the error prone markers will be selected and can be deleted as above.
Run the solution again. The smaller you can get the margin of error, the tighter your track.
Finally, click the “Set as Background” button and “Setup Tracking Scene” button which will take the data you’ve created and put it into a scene with the video as a background.
Go back to your default view, and you should see the camera with the tracked move already installed and null points representing the markers bolted into the grid representing your scene. You can now add objects to the scene and render them.
Often the track you get will be juddery and not “locked down,” this can be for several reasons. Mostly it has to do with your source video. Not just the quality of the video, but the sharpness, the speed and the length. Make sure you track only high quality footage to get a nice tight track. You can also select fuzzy video at the tracking stage to make your track more loose.
Make sure to eliminate all bad tracks and ones filled with a high percentage of errors.
Making well-lit and textured objects to composite into a real life scene is outside the scope of this tutorial, but we’ll cover it another time.
If you enjoyed this tutorial, let us know in the comments.