WEBVTT 00:00:00.076 --> 00:00:01.746 >> I'm going to show you how to put a 3D object 00:00:01.746 --> 00:00:05.056 into your video using the camera tracking features in Blender. 00:00:05.056 --> 00:00:08.316 And if you want to follow along with me in this tutorial, click the link below 00:00:08.316 --> 00:00:10.466 to download this exact video clip. 00:00:10.466 --> 00:00:13.886 So open up Blender and go into the motion tracking tab by clicking here. 00:00:13.886 --> 00:00:15.336 Then here. 00:00:15.336 --> 00:00:18.326 You can either drag your footage in here, 00:00:18.326 --> 00:00:20.596 but I'm going to click open and select our video clip. 00:00:20.676 --> 00:00:24.156 The first thing I'm going to do is click on set scene frames so that in 00:00:24.156 --> 00:00:26.786 and out points matches the length of the video clip. 00:00:26.786 --> 00:00:29.566 Then click on prefetch to load the clip into memory. 00:00:29.606 --> 00:00:32.156 Then under tracking settings, I'm going to set the motion model 00:00:32.156 --> 00:00:34.986 to affine and the match to previous frame. 00:00:35.096 --> 00:00:37.656 Affine takes into account the perspective changes in the shot. 00:00:37.656 --> 00:00:41.846 And previous frame basically just tracks the pattern from the current frame to the next one. 00:00:42.016 --> 00:00:43.866 Then I'm going to tick normalize. 00:00:43.896 --> 00:00:46.146 This makes sure that if there's any changes in light 00:00:46.146 --> 00:00:48.816 in the video clip, the track is not affected by it. 00:00:49.006 --> 00:00:53.276 Now that's done, I'm going to go to the first frame by pressing shift arrow, 00:00:53.476 --> 00:00:55.736 and then click on detect features. 00:00:55.736 --> 00:00:58.196 Now these boxes on the scene are tracking markers. 00:00:58.256 --> 00:01:00.866 They track points of contrast within the clip. 00:01:00.936 --> 00:01:05.306 Now I want more tracking markers, so I'm going to click on this little tab on the bottom left. 00:01:05.346 --> 00:01:08.106 I'm going to change the threshold to 0.1. 00:01:08.106 --> 00:01:10.826 I'm going to change the distance to, say, 50. 00:01:10.906 --> 00:01:13.766 And I'm going to set the margin from the edge of the frame, 00:01:13.766 --> 00:01:16.916 or the borders of the frame, to about 50 pixels. 00:01:17.056 --> 00:01:21.006 Now if you go into our tracking setting over here, we need to set the value 00:01:21.006 --> 00:01:24.096 of this margin lower than the value of the other margin. 00:01:24.096 --> 00:01:25.846 So I'm going to set this to about 40. 00:01:25.846 --> 00:01:29.936 Now, with all the markers selected, I want to press control T to track forwards. 00:01:31.136 --> 00:01:31.956 Yeah, brilliant. 00:01:32.026 --> 00:01:35.176 Once you've finished tracking forwards, making sure all the markers are highlighted. 00:01:35.176 --> 00:01:37.436 And if you want to highlight all the markers, just hover your mouse over here 00:01:37.436 --> 00:01:40.396 and press A. Now I'm going to press H to hide them all. 00:01:40.396 --> 00:01:44.376 And while still being on the last frame, I'm going to once again click on detect features 00:01:44.456 --> 00:01:46.286 to bring up all the tracking points. 00:01:46.286 --> 00:01:48.716 And I'm fully happy with these tracking markers so I'm going to track backwards 00:01:48.716 --> 00:01:52.976 by pressing shift control T, or control shift T. Nice. 00:01:53.646 --> 00:01:55.516 Next, I want to reveal all the trackers, 00:01:55.516 --> 00:01:58.266 so I'm going to press alt H to bring up all the trackers. 00:01:58.426 --> 00:02:00.606 Now we have a couple of trackers that are problematic. 00:02:00.606 --> 00:02:03.286 For instance, maybe these ones here that follow the cars. 00:02:03.286 --> 00:02:05.616 So what I'm going to do, you can either delete them manually 00:02:05.616 --> 00:02:07.656 by selecting them and pressing X to delete. 00:02:07.656 --> 00:02:11.516 Or you can also click on solve right here. 00:02:12.056 --> 00:02:17.816 Then select cleanup to get rid of any glitchy tracks or tracks that have high error value. 00:02:17.816 --> 00:02:19.696 I'm going to click on filter tracks. 00:02:19.696 --> 00:02:22.166 And, as you can see, it's selected all the markers that are glitchy. 00:02:22.166 --> 00:02:26.926 So all I have to do is hold my mouse over the footage, press X and delete. 00:02:26.926 --> 00:02:30.006 I'm going to go halfway throughout the clip and select filter tracks. 00:02:30.006 --> 00:02:30.766 And there's none. 00:02:30.946 --> 00:02:34.356 And just to make sure, I'm going to go to the last frame and select filter tracks. 00:02:34.486 --> 00:02:36.016 And there's none showing up, so that's good. 00:02:36.226 --> 00:02:42.226 Okay, so next, while still on the solve tab, I'm going to select focal length and optical center. 00:02:42.486 --> 00:02:47.036 Then for keyframe A and B, so you want to pick a frame range where the camera is moving a lot 00:02:47.036 --> 00:02:49.216 so Blender can actually track the shot. 00:02:49.216 --> 00:02:52.716 So I'm going to pick a frame range between 100 to, say, frame 180. 00:02:52.816 --> 00:02:56.526 I've just seen some tracks that are wild, so I'm going to delete them now. 00:02:56.726 --> 00:02:58.316 Like so. Get rid of this. 00:03:01.166 --> 00:03:02.966 Get rid of that one. 00:03:02.966 --> 00:03:03.696 Yeah, that's cool. 00:03:03.696 --> 00:03:04.176 That's fine. 00:03:04.176 --> 00:03:06.966 Now I'm going to click on solve camera motion. 00:03:07.306 --> 00:03:12.346 And we have a solve error of 0.35 which is fantastic. 00:03:12.456 --> 00:03:14.246 Any solve error below a pixel is good. 00:03:14.246 --> 00:03:16.716 And anything below 0.5 is great. 00:03:16.716 --> 00:03:20.616 Any solve error above one pixel is not a good track, I wouldn't use it. 00:03:20.686 --> 00:03:23.796 Now in the scene setup, on the left, click on set as background. 00:03:23.796 --> 00:03:25.996 And, as you can see, it puts the video in the background of the camera. 00:03:26.156 --> 00:03:28.966 Then I'm going to select setup tracking scene. 00:03:31.376 --> 00:03:34.986 Next, I'm going to hold shift and select these three tracks, 00:03:35.306 --> 00:03:37.926 and click on floor to set the floor plane. 00:03:37.926 --> 00:03:41.686 Now I'm going to set the origin of my scene by clicking this track and selecting set origin. 00:03:41.686 --> 00:03:46.526 Just to make sure that's the middle of my scene, I'm going to delete this cube 00:03:46.736 --> 00:03:48.926 and I'm going to go into the layout view. 00:03:48.926 --> 00:03:50.916 So I'm going to click this tab. 00:03:51.946 --> 00:03:56.286 Then I'm going to press zero on my numpad to look through the camera. 00:03:56.286 --> 00:04:01.526 And I'm going to click this little scroll down button here and I'm going to select 3D cursor. 00:04:01.526 --> 00:04:04.966 Once I've selected 3D cursor, I'm going to make sure my camera is highlighted. 00:04:05.016 --> 00:04:10.406 And I'm going to place R for rotation and I'm just going to line up the camera's perspective 00:04:10.536 --> 00:04:15.436 so that the Y direction is going along the road and the X is going 00:04:15.436 --> 00:04:17.956 across the road, just like that, in this field. 00:04:17.956 --> 00:04:18.956 Just so it lines up like that. 00:04:18.956 --> 00:04:19.456 That's perfect. 00:04:19.456 --> 00:04:23.296 I'm going to select the scroll down button again and select bounding box center. 00:04:23.296 --> 00:04:25.796 Next, I'm going to change the scale. 00:04:25.796 --> 00:04:30.616 And I'm going to move the plane about here. 00:04:30.616 --> 00:04:31.536 Yeah, that's nice. 00:04:31.536 --> 00:04:32.086 That's perfect. 00:04:32.086 --> 00:04:32.886 I'm happy with that. 00:04:33.046 --> 00:04:36.856 Now I'm going to press space bar just to make sure that the plane is sticking to the ground. 00:04:36.856 --> 00:04:37.556 Yeah, that looks good. 00:04:37.746 --> 00:04:39.746 Now we can easily put a 3D object into the scene. 00:04:39.746 --> 00:04:42.516 I'm going to press shift A, mesh, and select the monkey. 00:04:42.516 --> 00:04:44.876 I'm going to place the monkey so that it's kind of facing the camera. 00:04:44.876 --> 00:04:47.106 Also so that it's just sitting above the plane. 00:04:47.276 --> 00:04:47.926 Yeah, that's good. 00:04:48.186 --> 00:04:50.896 I'm going to decrease the scale a bit. 00:04:51.686 --> 00:04:52.436 Yeah, perfect. 00:04:52.436 --> 00:04:55.996 Now I'm going to go into render view by either pressing Z then clicking render. 00:04:55.996 --> 00:04:58.376 Now, as you can see, we can't really see the video footage. 00:04:58.506 --> 00:05:01.786 But to show the video clip, click on the render properties tab, 00:05:01.896 --> 00:05:03.776 go to film, then select transparent. 00:05:03.776 --> 00:05:06.316 And we can now view the clip through the camera. 00:05:06.316 --> 00:05:07.856 Now, as you can see, we don't have any shadows cast. 00:05:07.856 --> 00:05:09.796 That's because we need to bring the ground plane 00:05:09.796 --> 00:05:12.096 from the ground collection into the foreground collection. 00:05:12.166 --> 00:05:13.476 So I'm going to do that. 00:05:13.776 --> 00:05:17.616 I'm going to change the light to a sunlight by clicking on this light. 00:05:17.956 --> 00:05:20.866 And clicking on the light properties and selecting sun. 00:05:20.866 --> 00:05:23.746 I'm going to decrease the power to about three or five. 00:05:23.946 --> 00:05:28.456 And I'm going to change the angle to match where the sun is coming from in our clip. 00:05:31.046 --> 00:05:35.226 And I'm going to change the angle so that the shadows aren't so harsh. 00:05:35.226 --> 00:05:36.176 Nice. Perfect. 00:05:36.436 --> 00:05:39.916 Now there's a lot of other things you can do to increase the realism of this object fitting 00:05:39.916 --> 00:05:44.336 in this clip, like adding realistic reflections, lighting with a HDRI, adding blur and glare. 00:05:44.336 --> 00:05:46.016 But I'll cover that in another tutorial. 00:05:46.066 --> 00:05:49.046 There's also several other ways you can track a more difficult shot, 00:05:49.046 --> 00:05:51.016 and I'll also cover that in another tutorial. 00:05:51.016 --> 00:05:53.776 But, for now, I hope you learned something new and any questions let me know. 00:05:53.826 --> 00:05:54.806 And I'll see you in the next one. 00:05:55.056 --> 00:05:55.446 Take care. 00:05:55.446 --> 00:05:55.776 Cheers. 00:05:56.516 --> 00:06:14.230 [ Music ]