>> I'm going to show you how to put a 3D object
into your video using the camera tracking features in Blender.
And if you want to follow along with me in this tutorial, click the link below
to download this exact video clip.
So open up Blender and go into the motion tracking tab by clicking here.
Then here.
You can either drag your footage in here,
but I'm going to click open and select our video clip.
The first thing I'm going to do is click on set scene frames so that in
and out points matches the length of the video clip.
Then click on prefetch to load the clip into memory.
Then under tracking settings, I'm going to set the motion model
to affine and the match to previous frame.
Affine takes into account the perspective changes in the shot.
And previous frame basically just tracks the pattern from the current frame to the next one.
Then I'm going to tick normalize.
This makes sure that if there's any changes in light
in the video clip, the track is not affected by it.
Now that's done, I'm going to go to the first frame by pressing shift arrow,
and then click on detect features.
Now these boxes on the scene are tracking markers.
They track points of contrast within the clip.
Now I want more tracking markers, so I'm going to click on this little tab on the bottom left.
I'm going to change the threshold to 0.1.
I'm going to change the distance to, say, 50.
And I'm going to set the margin from the edge of the frame,
or the borders of the frame, to about 50 pixels.
Now if you go into our tracking setting over here, we need to set the value
of this margin lower than the value of the other margin.
So I'm going to set this to about 40.
Now, with all the markers selected, I want to press control T to track forwards.
Yeah, brilliant.
Once you've finished tracking forwards, making sure all the markers are highlighted.
And if you want to highlight all the markers, just hover your mouse over here
and press A. Now I'm going to press H to hide them all.
And while still being on the last frame, I'm going to once again click on detect features
to bring up all the tracking points.
And I'm fully happy with these tracking markers so I'm going to track backwards
by pressing shift control T, or control shift T. Nice.
Next, I want to reveal all the trackers,
so I'm going to press alt H to bring up all the trackers.
Now we have a couple of trackers that are problematic.
For instance, maybe these ones here that follow the cars.
So what I'm going to do, you can either delete them manually
by selecting them and pressing X to delete.
Or you can also click on solve right here.
Then select cleanup to get rid of any glitchy tracks or tracks that have high error value.
I'm going to click on filter tracks.
And, as you can see, it's selected all the markers that are glitchy.
So all I have to do is hold my mouse over the footage, press X and delete.
I'm going to go halfway throughout the clip and select filter tracks.
And there's none.
And just to make sure, I'm going to go to the last frame and select filter tracks.
And there's none showing up, so that's good.
Okay, so next, while still on the solve tab, I'm going to select focal length and optical center.
Then for keyframe A and B, so you want to pick a frame range where the camera is moving a lot
so Blender can actually track the shot.
So I'm going to pick a frame range between 100 to, say, frame 180.
I've just seen some tracks that are wild, so I'm going to delete them now.
Like so. Get rid of this.
Get rid of that one.
Yeah, that's cool.
That's fine.
Now I'm going to click on solve camera motion.
And we have a solve error of 0.35 which is fantastic.
Any solve error below a pixel is good.
And anything below 0.5 is great.
Any solve error above one pixel is not a good track, I wouldn't use it.
Now in the scene setup, on the left, click on set as background.
And, as you can see, it puts the video in the background of the camera.
Then I'm going to select setup tracking scene.
Next, I'm going to hold shift and select these three tracks,
and click on floor to set the floor plane.
Now I'm going to set the origin of my scene by clicking this track and selecting set origin.
Just to make sure that's the middle of my scene, I'm going to delete this cube
and I'm going to go into the layout view.
So I'm going to click this tab.
Then I'm going to press zero on my numpad to look through the camera.
And I'm going to click this little scroll down button here and I'm going to select 3D cursor.
Once I've selected 3D cursor, I'm going to make sure my camera is highlighted.
And I'm going to place R for rotation and I'm just going to line up the camera's perspective
so that the Y direction is going along the road and the X is going
across the road, just like that, in this field.
Just so it lines up like that.
That's perfect.
I'm going to select the scroll down button again and select bounding box center.
Next, I'm going to change the scale.
And I'm going to move the plane about here.
Yeah, that's nice.
That's perfect.
I'm happy with that.
Now I'm going to press space bar just to make sure that the plane is sticking to the ground.
Yeah, that looks good.
Now we can easily put a 3D object into the scene.
I'm going to press shift A, mesh, and select the monkey.
I'm going to place the monkey so that it's kind of facing the camera.
Also so that it's just sitting above the plane.
Yeah, that's good.
I'm going to decrease the scale a bit.
Yeah, perfect.
Now I'm going to go into render view by either pressing Z then clicking render.
Now, as you can see, we can't really see the video footage.
But to show the video clip, click on the render properties tab,
go to film, then select transparent.
And we can now view the clip through the camera.
Now, as you can see, we don't have any shadows cast.
That's because we need to bring the ground plane
from the ground collection into the foreground collection.
So I'm going to do that.
I'm going to change the light to a sunlight by clicking on this light.
And clicking on the light properties and selecting sun.
I'm going to decrease the power to about three or five.
And I'm going to change the angle to match where the sun is coming from in our clip.
And I'm going to change the angle so that the shadows aren't so harsh.
Nice. Perfect.
Now there's a lot of other things you can do to increase the realism of this object fitting
in this clip, like adding realistic reflections, lighting with a HDRI, adding blur and glare.
But I'll cover that in another tutorial.
There's also several other ways you can track a more difficult shot,
and I'll also cover that in another tutorial.
But, for now, I hope you learned something new and any questions let me know.
And I'll see you in the next one.
Take care.
Cheers.
[ Music ]