How to use add a 3D object to a video using motion tracking | Blender 3.1

In this Blender tutorial I will show you how to add a 3D object to a video using Blender.

Importing the video

I have provided link to the video

I’ve also provided a link to the HDRI

Open the motion tracking workspace

To import the video, simply drag-and-drop it into the movie clip editor area

Under the output properties tab, make sure your frame rate is set to the same rate as the video – in my case, that would be 24 FPS

Click on the set scene frames button to make sure the timeline is the same length as the video

If you find that your video is playing slowly, you can click on the prefetch button – this will cache the video first and then play it

Camera Tracking

Now we can begin adding tracking markers to the video – there must be at least eight for Blender to properly track

It is best to choose areas of high contrast for a better tracking result

Change the motion model to location, rotation, and scale – this defines what motions the tracking feature will use

Make sure you are on the first frame

To place a tracker, use CTRL + Left-click

Pressing the L-key will lock the tracker to the view while still allowing you to move the video

Using CTRL + T you can now track forward

If the tracking does not end on the last frame, go to the last frame where it tracked and using  ALT + S to bring up the search area, increase the size by holding down the left-mouse-button and dragging on the triangle in the corner

Then use CTRL + T to begin the tracking

If you know your sensor width, you can put that value in under the track tab, in the camera panel

If you know your focal length, you can put that value in under the lens panel – otherwise, you can check the refine: focal length under the solve tab

For the keyframe A and keyframe B, select either the entire video sequence or where the video has the greatest parallax – for me, I will just use the frame totals

Once you have everything set up – click on “solve camera motion”

In the upper-right you will see the solve error – this should be kept to less than 1.0

Since my solve rate is above 1.0, I will add more trackers

Bringing in 3D Objects

In order to now bring the tracking to the camera in the 3D scene, click on “setup tracking scene”

In the camera perspective view, you can now see a plane and a cube that has been added to the scene

If you scrub through the timeline and look at the camera view, you will see the camera moving

You will also notice two collections in the outliner – foreground and background

*NOTE: If the cube is not in the foreground collection, you will need to move it to that collection

As of right now, our plane and cube do not stick to the ground of the video

Back in the 3D viewport, if you turn on motion tracking under the overlays, you will notice that the tracking points are not aligned to the 3D objects

To fix this issue, select three motion tracking points that are on the ground

In the orientation panel, click on “floor”

In the 3D viewport, notice that the trackers are now more in line with the 3D objects – in wireframe mode, you can see those selected trackers are on the ground

I don’t want to use the cube as my 3D object so I will add a UV sphere and shade it smooth – placing it on top of the plane

*NOTE: If you notice your camera is upside down, you can select everything and rotate them 180-degrees

Make any adjustments to the objects as necessary

Rendering Setup

Make sure you are using the Cycles render engine

Under the film panel, activate the transparent option

If you go into rendered mode, notice that you cannot see the plane – this is because it is only being used as a shadow catcher (I have a quick tip video explaining this)

If you select the background layer, you will be able to see the shadows

For the lighting, delete any lights since we will be using an HDRI

Open the shader editor and go into the world shader

Delete the background node

Drag-and-drop the HDRI image into the shader editor and connect it to the world output

Back under the object material, Select the sphere and add a simple rough material

Rendering

Under the layer properties tab, turn on the denoising data option in the passes panel [icon-images]

Lower the samples under the render properties tab

Render an image to make sure everything is working properly [WAIT FOR VIDEO TOO]

The object will render – then the shadow – then the video

Under the output properties tab, in the output panel, select your file format and encoding option and the file where you want everything to save to

Finally, render your animation

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.