1 00:00:00,076 --> 00:00:01,746 >> I'm going to show you how to put a 3D object 2 00:00:01,746 --> 00:00:05,056 into your video using the camera tracking features in Blender. 3 00:00:05,056 --> 00:00:08,316 And if you want to follow along with me in this tutorial, click the link below 4 00:00:08,316 --> 00:00:10,466 to download this exact video clip. 5 00:00:10,466 --> 00:00:13,886 So open up Blender and go into the motion tracking tab by clicking here. 6 00:00:13,886 --> 00:00:15,336 Then here. 7 00:00:15,336 --> 00:00:18,326 You can either drag your footage in here, 8 00:00:18,326 --> 00:00:20,596 but I'm going to click open and select our video clip. 9 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 10 00:00:24,156 --> 00:00:26,786 and out points matches the length of the video clip. 11 00:00:26,786 --> 00:00:29,566 Then click on prefetch to load the clip into memory. 12 00:00:29,606 --> 00:00:32,156 Then under tracking settings, I'm going to set the motion model 13 00:00:32,156 --> 00:00:34,986 to affine and the match to previous frame. 14 00:00:35,096 --> 00:00:37,656 Affine takes into account the perspective changes in the shot. 15 00:00:37,656 --> 00:00:41,846 And previous frame basically just tracks the pattern from the current frame to the next one. 16 00:00:42,016 --> 00:00:43,866 Then I'm going to tick normalize. 17 00:00:43,896 --> 00:00:46,146 This makes sure that if there's any changes in light 18 00:00:46,146 --> 00:00:48,816 in the video clip, the track is not affected by it. 19 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, 20 00:00:53,476 --> 00:00:55,736 and then click on detect features. 21 00:00:55,736 --> 00:00:58,196 Now these boxes on the scene are tracking markers. 22 00:00:58,256 --> 00:01:00,866 They track points of contrast within the clip. 23 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. 24 00:01:05,346 --> 00:01:08,106 I'm going to change the threshold to 0.1. 25 00:01:08,106 --> 00:01:10,826 I'm going to change the distance to, say, 50. 26 00:01:10,906 --> 00:01:13,766 And I'm going to set the margin from the edge of the frame, 27 00:01:13,766 --> 00:01:16,916 or the borders of the frame, to about 50 pixels. 28 00:01:17,056 --> 00:01:21,006 Now if you go into our tracking setting over here, we need to set the value 29 00:01:21,006 --> 00:01:24,096 of this margin lower than the value of the other margin. 30 00:01:24,096 --> 00:01:25,846 So I'm going to set this to about 40. 31 00:01:25,846 --> 00:01:29,936 Now, with all the markers selected, I want to press control T to track forwards. 32 00:01:31,136 --> 00:01:31,956 Yeah, brilliant. 33 00:01:32,026 --> 00:01:35,176 Once you've finished tracking forwards, making sure all the markers are highlighted. 34 00:01:35,176 --> 00:01:37,436 And if you want to highlight all the markers, just hover your mouse over here 35 00:01:37,436 --> 00:01:40,396 and press A. Now I'm going to press H to hide them all. 36 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 37 00:01:44,456 --> 00:01:46,286 to bring up all the tracking points. 38 00:01:46,286 --> 00:01:48,716 And I'm fully happy with these tracking markers so I'm going to track backwards 39 00:01:48,716 --> 00:01:52,976 by pressing shift control T, or control shift T. Nice. 40 00:01:53,646 --> 00:01:55,516 Next, I want to reveal all the trackers, 41 00:01:55,516 --> 00:01:58,266 so I'm going to press alt H to bring up all the trackers. 42 00:01:58,426 --> 00:02:00,606 Now we have a couple of trackers that are problematic. 43 00:02:00,606 --> 00:02:03,286 For instance, maybe these ones here that follow the cars. 44 00:02:03,286 --> 00:02:05,616 So what I'm going to do, you can either delete them manually 45 00:02:05,616 --> 00:02:07,656 by selecting them and pressing X to delete. 46 00:02:07,656 --> 00:02:11,516 Or you can also click on solve right here. 47 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. 48 00:02:17,816 --> 00:02:19,696 I'm going to click on filter tracks. 49 00:02:19,696 --> 00:02:22,166 And, as you can see, it's selected all the markers that are glitchy. 50 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. 51 00:02:26,926 --> 00:02:30,006 I'm going to go halfway throughout the clip and select filter tracks. 52 00:02:30,006 --> 00:02:30,766 And there's none. 53 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. 54 00:02:34,486 --> 00:02:36,016 And there's none showing up, so that's good. 55 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. 56 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 57 00:02:47,036 --> 00:02:49,216 so Blender can actually track the shot. 58 00:02:49,216 --> 00:02:52,716 So I'm going to pick a frame range between 100 to, say, frame 180. 59 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. 60 00:02:56,726 --> 00:02:58,316 Like so. Get rid of this. 61 00:03:01,166 --> 00:03:02,966 Get rid of that one. 62 00:03:02,966 --> 00:03:03,696 Yeah, that's cool. 63 00:03:03,696 --> 00:03:04,176 That's fine. 64 00:03:04,176 --> 00:03:06,966 Now I'm going to click on solve camera motion. 65 00:03:07,306 --> 00:03:12,346 And we have a solve error of 0.35 which is fantastic. 66 00:03:12,456 --> 00:03:14,246 Any solve error below a pixel is good. 67 00:03:14,246 --> 00:03:16,716 And anything below 0.5 is great. 68 00:03:16,716 --> 00:03:20,616 Any solve error above one pixel is not a good track, I wouldn't use it. 69 00:03:20,686 --> 00:03:23,796 Now in the scene setup, on the left, click on set as background. 70 00:03:23,796 --> 00:03:25,996 And, as you can see, it puts the video in the background of the camera. 71 00:03:26,156 --> 00:03:28,966 Then I'm going to select setup tracking scene. 72 00:03:31,376 --> 00:03:34,986 Next, I'm going to hold shift and select these three tracks, 73 00:03:35,306 --> 00:03:37,926 and click on floor to set the floor plane. 74 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. 75 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 76 00:03:46,736 --> 00:03:48,926 and I'm going to go into the layout view. 77 00:03:48,926 --> 00:03:50,916 So I'm going to click this tab. 78 00:03:51,946 --> 00:03:56,286 Then I'm going to press zero on my numpad to look through the camera. 79 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. 80 00:04:01,526 --> 00:04:04,966 Once I've selected 3D cursor, I'm going to make sure my camera is highlighted. 81 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 82 00:04:10,536 --> 00:04:15,436 so that the Y direction is going along the road and the X is going 83 00:04:15,436 --> 00:04:17,956 across the road, just like that, in this field. 84 00:04:17,956 --> 00:04:18,956 Just so it lines up like that. 85 00:04:18,956 --> 00:04:19,456 That's perfect. 86 00:04:19,456 --> 00:04:23,296 I'm going to select the scroll down button again and select bounding box center. 87 00:04:23,296 --> 00:04:25,796 Next, I'm going to change the scale. 88 00:04:25,796 --> 00:04:30,616 And I'm going to move the plane about here. 89 00:04:30,616 --> 00:04:31,536 Yeah, that's nice. 90 00:04:31,536 --> 00:04:32,086 That's perfect. 91 00:04:32,086 --> 00:04:32,886 I'm happy with that. 92 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. 93 00:04:36,856 --> 00:04:37,556 Yeah, that looks good. 94 00:04:37,746 --> 00:04:39,746 Now we can easily put a 3D object into the scene. 95 00:04:39,746 --> 00:04:42,516 I'm going to press shift A, mesh, and select the monkey. 96 00:04:42,516 --> 00:04:44,876 I'm going to place the monkey so that it's kind of facing the camera. 97 00:04:44,876 --> 00:04:47,106 Also so that it's just sitting above the plane. 98 00:04:47,276 --> 00:04:47,926 Yeah, that's good. 99 00:04:48,186 --> 00:04:50,896 I'm going to decrease the scale a bit. 100 00:04:51,686 --> 00:04:52,436 Yeah, perfect. 101 00:04:52,436 --> 00:04:55,996 Now I'm going to go into render view by either pressing Z then clicking render. 102 00:04:55,996 --> 00:04:58,376 Now, as you can see, we can't really see the video footage. 103 00:04:58,506 --> 00:05:01,786 But to show the video clip, click on the render properties tab, 104 00:05:01,896 --> 00:05:03,776 go to film, then select transparent. 105 00:05:03,776 --> 00:05:06,316 And we can now view the clip through the camera. 106 00:05:06,316 --> 00:05:07,856 Now, as you can see, we don't have any shadows cast. 107 00:05:07,856 --> 00:05:09,796 That's because we need to bring the ground plane 108 00:05:09,796 --> 00:05:12,096 from the ground collection into the foreground collection. 109 00:05:12,166 --> 00:05:13,476 So I'm going to do that. 110 00:05:13,776 --> 00:05:17,616 I'm going to change the light to a sunlight by clicking on this light. 111 00:05:17,956 --> 00:05:20,866 And clicking on the light properties and selecting sun. 112 00:05:20,866 --> 00:05:23,746 I'm going to decrease the power to about three or five. 113 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. 114 00:05:31,046 --> 00:05:35,226 And I'm going to change the angle so that the shadows aren't so harsh. 115 00:05:35,226 --> 00:05:36,176 Nice. Perfect. 116 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 117 00:05:39,916 --> 00:05:44,336 in this clip, like adding realistic reflections, lighting with a HDRI, adding blur and glare. 118 00:05:44,336 --> 00:05:46,016 But I'll cover that in another tutorial. 119 00:05:46,066 --> 00:05:49,046 There's also several other ways you can track a more difficult shot, 120 00:05:49,046 --> 00:05:51,016 and I'll also cover that in another tutorial. 121 00:05:51,016 --> 00:05:53,776 But, for now, I hope you learned something new and any questions let me know. 122 00:05:53,826 --> 00:05:54,806 And I'll see you in the next one. 123 00:05:55,056 --> 00:05:55,446 Take care. 124 00:05:55,446 --> 00:05:55,776 Cheers. 125 00:05:56,516 --> 00:06:14,230 [ Music ]