From the course: Blender: Tips, Tricks and Techniques

Camera tracking like a pro

- [Instructor] Camera tracking in Blender is actually incredibly easy. It just takes a little bit of patience. And this week's Blender's Tips, Tricks and Techniques, we're going to show you how to take some footage shot on an iPhone and add a monkey to it. Let's get started. Now, the first thing you want to do is make sure you have motion tracking on as your layout. Add in your video, and again, you can shoot this on a smartphone, right here. And then make sure that whatever video you do end up shooting has a lot of high-contrast corners. In this case, like this brick pattern. You only need eight points to track throughout the whole video footage, or Blender won't work. Okay, so let's get started. Now, one of the first things I like to do is to raise my search size, and I'm going to describe that here in a second. Let me open my track, and let's just zoom in and find a really high-contrast area and control click. Now, if I lower my search size, you can see what that does. It makes a smaller box that goes around my tracking point. That's not good, because if the footage is moving really quickly, it'll move outside of the search size and we'll lose the track. So let's delete it, and use a higher search size, like, say, 100. Now go ahead and add a couple of tracks, and be mindful of tracking corners with lots of high contrasts. Why don't you take a few minutes and add as many as you can. Okay, cool. Now we've added a whole bunch of tracking markers, but we're not ready to start solving this jut yet. The next thing you need to do is to go down to your camera and set what kind of camera you shot this on. Now, since I used an iPhone, I'm going to pick iPhone 5. That's going to change the sensor size, but if you don't find your own camera in here, you can just type in your own sensor size. Okay, now let's scroll down a little bit on the tracking side and make sure I click on Normalize. That's going to account for any slight shifts in illumination, lighting, maybe exposure changes on the phone, you never know. Turning on Normalize will solve many of those problems. The next thing you want to do is to make sure that you have your little search marker display up. You could also turn on some other things if you really want to see everything, but I'm just going to leave it on those. And finally, go to the first frame and hit this Play button to start tracking. Now, if you're watching this track happen, you'll note all of these little red dots. They indicate where the tracking point came from. You also might've saw a few dots fly across the screen. Don't worry, we can quickly clean those up. Also, did you notice how your footage played back a little choppy? Well, one thing you could try to do is click on Clip and go to Pre-Fetch Frames. If for some reason it doesn't fill up the entire bar with this nice little purple, that means it's running out of RAM. So go up to File, User Preferences, go to your System tab, and raise up your memory cache limit. I put mine up to eight gigs, because my machine has 16. Okay, click on Save User Settings, and let's get back to it. Now, as I said earlier, some of the tracks are actually pretty good. Some of these are awful, like this one right here. Look what's going on. I'm just going to quickly delete it. See if you can eyeball any other weird tracks that are happening and just get rid of it really quick. Here's one right here that instantly just pops out of nowhere, so let's just get rid of that too. Now let's go to the Solve tab and click Solve Camera Motion. Blender's going to give you a score. In my case, it's 10.852. The higher the number, the worse the track. It's all rather relative, though, and don't worry, there's ways to clean it up. But I encourage you to try to get it below 10. Now, to clean up your tracks, you're going to want to open up this little cleanup area, and I'm going to say that anything that lasts about 10 frames that's over, say, 20, we'll start with a high number, should be deleted. So with these two settings on, click on Clean Tracks. And Blender selected three tracks that are not so good, so let's delete them. And then solve for camera motion again. Because everything is relative, deleting the higher numbers will actually make all of the others much better. Now, it's still a little high, right off the bat I can see that this track has a score of almost 14, so let's just delete it really quick. And let's scroll down. Do we see any other higher numbers? There's another 14, let's get rid of that one. 24 is way too high, let's kill that. And everything else looks actually pretty good. So let's click Solve Camera Motion one more time. Whoa, my score is 3.5, that's really, really good. So let's go with that. Okay, now we need a solve for the floor. So I like to start at the end here, we're going to scroll down a little bit and find a couple of tracks that survived the entire film footage here. So I need three points that make a 90 degree angle on the ground. So I'm going to select this guy, this one right here, and this one over here. So let's see, are they pretty good? Yeah, they look pretty good. And you can see how they make a nice little 90 degree triangle. So with these three points selected, I'm going to click on Floor, I'm going to select this middle one and say Set Origin. This top one will be Set Y Axis, and this one over here will be Set X Axis. Okay, now with all of this set up, click on Set Up Tracking Scene. Now once in a while you'll get a weird error here and there. Blender is still a little wonky when it comes to tracking scenes. Now let's go back to my default view, delete this cube, and see what I get. Not bad. It is a little jittery, but a little bit of cleanup in the motion tracking could actually help us out. But for the most part, it works pretty good. You can see here there are some tracks that are pretty far out there, though, so we'll definitely have to consider cleaning it up. The next thing you want to do is add a plane, so let's do that really fast. And make this plane a shadow catcher. So let's go down to Blender Render, switch it to cycles. Go to Cycle Settings way at the bottom of the properties, and click on Shadow Catcher. Now let's go into my camera view, hit N, scroll down, go to my background images, and switch this to front. Now let's just play and see what we get. Okay, cool. As you can see, it looks like my empties are tracking to my footage pretty well, and minus a few oddballs that decide to fly around, it's working pretty well. So why don't we add a monkey? Let's go ahead and hit Shift A, go to Mesh, Monkey, scale Suzanne in a little bit, raise him up, go back to my camera view, and let's put it right about here and then go to Rendered Mode and make sure that this is on back with my render settings of transparent turned on. And for good measure, let's go to Suzanne, and give him a nice material. And I can even kick up this lamp a little bit and make it a little stronger. There we go. Now if I scrub through my timeline, my monkey will stick to the floor and act as if I've actually had it there the whole time. Pretty cool. Camera tracking in Blender is actually really easy. The hard part is refining it and making sure it doesn't slip and getting that score as close to zero as you can. Why don't you go ahead and play a little bit more with the motion tracking settings and see how close you can get this monkey sticking to the ground. Good luck.

Contents