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