Camera Tracking with Blender for Beginners! (VFX Tutorial)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
welcome back to blender daily in today's beginner tutorial i'm gonna demonstrate step by step how to create a camera track with blender in order to add 3d elements to your videos let's get started okay so this right here is the footage that we are going to use in this tutorial and you can download this clip with the link in the video description if you want to follow along with me during the tutorial so let's jump right into it and open up a new blend file and in order to start motion tracking we first need to open up a new workspace so we click on this plus up here and under v effects open up a motion tracking workspace we're not going to use those top two windows so we can just close them up and let's import our footage so just take the clip and drag and drop it into this window to import it and first of all let's adjust the frame rate of our scene to match with our clip so i recorded this footage at 30 fps so let's just go to the output properties and on the frame rate also change this to 30 fps in order to match up then next we also need to adjust the length of our timeline so currently this is set to 250 frames however our footage is longer so just click on the set scene frames button up here and now blender adjusted it to 327 frames and when i scroll through the timeline you can also see that this is a bit lucky and pretty slow so in order to improve this we can just click on this prefetch button which will load the whole clip into memory and will also speed up the motion tracking process later on so on this purple bar you can see that it already loaded the whole clip into memory so we are ready to start tracking so basically what we want to do is to add a few tracking markers to feature points in our scene so just basically points with a lot of contrast so for example we could track this round dot here this part right here maybe this point over here just points that have a lot of contrast and blender will be able to follow along frame by frame and if we have at least eight of those trackers in our shot blender will be able to calculate the movement of the camera in 3d space and we will then be able to apply this movement to the camera in the 3d viewport and this will allow us to place 3d objects in the scene and make it look as if they were actually placed in this footage now this might sound a bit complicated however i don't think it really is so if you didn't understand it so far just follow along with me and i'm sure you will understand it in the end so i try to go slowly and er and explain everything step by step so you should be able to follow along even if you haven't done motion tracking before so first of all let's adjust the motion model from location to location rotation and scale then to place a tracker in the scene search for a high contrast point so in this case i want to track this round dot right here then to place the tracker hold down control and left click make sure that you are on the first frame when doing this and as with everything in blender you can use the shortcut g to move it around s to scale so let's just scale this up a bit and r to rotate and what i also like to do is press l on the keyboard in order to lock this tracker to the view so when i now press g to move around you can see that the tracker will always stay in center and instead the background is moving this is really useful so the tracker will never get out of the frame so once you have this tracker set up again make sure you are on the first frame and you can use this button right here or the shortcut ctrl t to start tracking forwards now you can see this worked for around 130 frames so blender followed this point frame by frame and then at around frame 130 it somehow got lost but this isn't really an issue just go back to the last frame where it worked and usually it helps to just press alt s to bring up the search area and if we change the size of it a bit so make it bigger or smaller press this button again to continue to track forward and blender is usually able to pick up the tracker again and continue to track as it did right here so we got an additional let's say around 100 frames but then it got lost again so we can go back to the last frame where it worked rescale the search area and just continue to track and this time it worked until the last frame of our sequence so now this tracker is going through the whole shot and as i mentioned earlier we need at least eight of those trackers in order to be able to make a camera solve so we need to place even more trackers this time i'm going to start on the last frame so just go to the last frame then search for another feature point so for example we could use this one right here it has a lot of contrast so control and left click maybe scale it up a bit scale the search area and since we're starting on the last frame we have to track backwards so for this either use this button right here or the shortcut ctrl shift t which will allow us to track backwards again it got lost so go back to the last frame where it worked rescale the search area and again ctrl shift t to continue to track backwards and now it is tracking throughout the whole shot again go back to the last frame and let's place place another marker for example on this leaf right here control left click to place the marker scale it up a bit with the shortcut s also adjust the search area and then track backwards got lost right here maybe scale it up a bit scale down the search area and now it tracked until the end go back to the last frame let's search for another feature point so for example this yellow leaf right here control left click to place the tracker scale it up and track backwards got lost right here so maybe scale it up a bit scale the search area control shift t and now this worked as well we still need four more trackers so let's also try this leaf over here control left click scale it up scale up the search area ctrl shift t to track backwards again got lost so in this case um it even went off the tracker so not only got lost but it also went in the wrong direction so just go back to the last frame where it worked correctly and use this button to delete all the frames before it so that it will remove the wrong the wrong point then rescale the search area and just continue to track backwards and now i think it stayed on yeah now it is working back to the last frame place another tracker so maybe we can place one down here control left click scale it up ctrl shift t got lost right here okay so that's the last frame where it worked properly delete everything before it rescale it ctrl shift t and now this one is working as well let's see how many trackers do we have one two three four five six we need two more maybe we can track yeah let's try this point right here so control left click scale it up scale up the search area control shift t made it almost until the end so rescale the search area and finish this track okay so we need one more and let's also try this one over here and whenever you have a tracker where the perspective is shifting a lot like it is in this case it is better to change the motion model to a fine since this can handle such a such perspective changes a lot better so after you've changed this to a fine control left click again to place it in here scale it up so that it covers the whole thing don't move it bring it back scale up the search area and just drag backwards and this didn't get lost at all okay so now we have eight trackers and we are ready to create a camera solve so in order to create a camera solve just switch to the solve panel over here and before we can click on solve camera motion we need to give blender a bit more information about our camera so to do so press n to open up the side panel and under track go to camera and here we have this sensor with value so in this case i recorded it with an iphone 8 which has a sensor width of 4.6 millimeters if you don't know this value for your camera usually a quick google search will give you the right information then under lens you can also enter the focal length of your camera if you know it in this case i don't know it so in the solve panel i'm just going to check refine focal length and blender will try to estimate this value which usually per works pretty well so that's it for the camera settings next we also need to set the keyframe a and b and for this we basically have to select two keyframes between which there is a lot of parallax so this means that the camera has to move a lot between those two frames and usually i like to use the first and the last frame of my sequence for this which in this case is 1 and 327 sometimes the mice this might not work and you will get this error message that you need at least eight tracks between those two frames so if you get this error message just bring keyframe b closer to keyframe a until you are able to solve the camera motion but in this case we have eight trackers from the beginning to the end so we should be able to use frame 327 and frame one once this is set up just click on solve camera motion and blender will try to estimate the movement of our camera in 3d space and you can actually see the average error of the calculations up here which in this case is 0.61 pixels which is good enough for our case usually i'm happy with everything below one pixel which we have in this case so now in order to bring the this extracted camera movement to our camera in the 3d viewport you just need to click on setup tracking scene so when we click this button blender does a few things so first of all it brings in a few objects and when we play the timeline you can see that the camera is now actually moving and additionally it also creates two collections a foreground collection and a background collection it creates two view layers one for the foreground and the background and in the compositor it creates this note setup that we are going to use later on but for now let's press numpad 0 to get into the camera view and you can see that we also have our footage as the background in the camera and if i play this timeline you can see that those objects don't stick to the ground of our footage at all they are just floating around but this doesn't mean that our camera track didn't work it just means that the objects aren't correctly aligned with our camera and to demonstrate this let me just go to the overlay settings and enable the motion tracking and now you can see all those points and they are basically just 3d representations of the points that we had in here so now you can see that those points aren't aligning with our objects at all which is the reason why we called why those objects were just floating around so i think those points are way too small so let's just press s to scale it up maybe even more however now the camera looks too big so in the viewport display settings of the camera just bring down the size of the camera to improve this and the points are still not aligning with our objects but we can quickly fix this in the motion tracking workspace by shift-clicking and selecting three points that are on the ground so in this case i'm gonna select those three and in the orientation menu just click on floor so blender will align those three trackers with the ground so now you can see that they are right here and when we go into the camera view and play the timeline the objects are actually sticking to the ground so this is working however i don't really like this orientation so i'm just gonna change the pivot point to the 3d cursor and with the camera selected press r and set to align those red x-axis and green y-axis with our ground so i think this is a bit better let's change the pivot point back to median point and now those objects are aligning with our camera okay great so in this case i don't want to use this default cube so let's press press x to delete it and instead i'm going to bring in shift a mesh monkey head since i think this is a bit more interesting then press r set rotate it towards the camera and let's also make it a bit more smooth so i'm gonna add a subdivision surface modifier and right click to enable smooth shading maybe scale it up a bit and from the side view i'm just going to rotate it press g set to place it on this ground plane so let's take a look at it from the camera view and i'm just going to use a monkey for demonstration purposes you could really use any object that you want so if you have any other cool 3d models you can use them in here and place them in the scene and they should align with the ground perfectly so again i'm just using this monkey for demonstration but you could really use any object that you want now let's maybe place this monkey a bit more over here so i'm shift clicking to select the monkey and the ground plane then g to move them around and shift set to move them only on the ground plane so they are moving only on the x and y axis and not on the set axis so now i think i'm happy with the placement of the monkey yeah we don't need the tracking markers anymore so i'm just gonna disable them and let's take a look at this from the rendered view so now make sure that you are using the cycles render engine and not ev since a lot of the things that i'm going to demonstrate won't work with ev so just make sure you're using cycles and as soon as we switch to the render preview you can see that our background image is gone so to bring it back just go to the film options and enable transparency so now we have our background back and you can also see that we can only see the monkey but not this ground plane this is because in the object properties under visibility this ground plane is set to shadow catcher so the plane itself won't be visible but only the shadows that are casted onto the plane and we cannot even see the shadows currently because we are in the foreground view layer in order to see the shadows that are casted onto the plane we need to go to the background where we have only the shadows you can see it right here it is a bit subtle but they are there so in the background view layer we have only the shadows and not the objects and in the foreground view layer we have only our monkey but no shadows and this will be combined later on in the compositor so we get both the shadows the monkey and our background image and if this is somehow not working for you just make sure that this monkey object is placed in the foreground collection because as soon as i bring it to the background collection you can see that this is isn't working anymore so place it in the foreground and currently you can also see that we don't have any real lighting in the scene only this light which doesn't look very realistic so let's delete it and instead we are going to use an hdri for the lighting of our scene an hdri is basically a 360 degree panorama image that we can wrap around our objects and will give us realistic lighting and reflections on our objects so to get such an hdri just go to polyhaven.com we have right here go to browse hdris they have some really high quality environment textures that we can use for free so just make sure that you get an hdri that has a similar lighting condition to to the footage that you recorded so in this case we need an overcast sky so just go over here to the sky category and choose overcast then in here i think this canon hdri looks pretty similar change the resolution to 1k since we're only going to use it for the lighting then click on download to save it to your folder i already downloaded it so let's just jump back into blender and in order to import this hdri go to the world properties next to color click on this yellow button and choose environment texture then click on open go to the folder where you saved it select the hdr choose open image and now you can see that we have light in our scene and if you want to see what the hdr looks like just quickly disable transparency in the film options and now you can see that we have this hdr wrapped around our objects but we don't want to actually see the hdr so let's turn transparency back on and i think this lighting looks pretty good and in the background collection you can see that it also works for the shadows so let's go back to the foreground and give this monkey a bit of a more interesting material so in the material properties click on plus to add a new material and i'm just going to change the color to let's say this orange maybe make it metallic or not yeah i think i'm gonna make it metallic this looks a bit more interesting and again you could use any shader that you want so you don't have to use the same as i did this works with any material so now i think we are ready to render but there's one more thing that i want to set up so make sure you are in the foreground collection go to the view layer properties and enable denoising data so we are able to denoise our monkey so we don't have to use a lot of samples and can save a lot of render time so once you have everything ready switch to the rendering tab and let's just bring down the number of samples to let's say 20 also enable adaptive sampling to speed it up a bit and just press f12 on a random frame to test it out and first you can see that it renders the monkey and then also the shadow layer and after that it combines everything it already looks pretty good however there are a few things that i want to adjust in the compositor so let's switch to the compositing workspace and i don't like to use the backdrop so i'm just going to disable it also close this timeline down here and over here make this window bigger and change it to an image editor then right here select the viewer node so we are able to preview or composite in this window then the first change that i want to make is to add a denoising node to get rid of this noise in the monkey so just press shift a and under filter bring in a denoise node connect the noisy image denoising normal and denoising albedo and then bring this image into the image wait a second for it to update and i yet the compositor is pretty slow and i think this is because we rendered this in a 4k resolution so usually i like to bring this down to 50 for the compositing since the compositor will be a lot faster if you bring down the resolution let's just change this to 50 and render again okay so now the rendering was a lot faster and also the compositing should be faster then next let's fix the shadows so first of all i want to remove this first alpha over node since i don't like how this default setup is in blender and instead we're going to bring in a color mix node connect this up again and instead of mix we are going to use multiply and we're also not going to use the image output but instead the alpha output and if you were just use it like this this won't work because we also need to bring in a converter color ramp node bring this in here and choose flip color ramp to invert this result so now it is working and i prefer to use a color ramp note over invert node because now we can just bring in this black stop to make the shadows a bit darker and as you can see we also have a lot of noise in this uh in the shadows so let's just duplicate this denoise note with the shortcut shift d and bring it in here to make the shadows a bit smoother okay so this already looks a lot better but i think i want to make them even darker so under color i'm just gonna bring in a new rgb curves note bring down this curve and make it even darker so now we get a bit more shadows and i think this looks better okay so there's one last thing that i want to do which is going to be shift a and another rgb curves node the very end make sure that you connect this to both the viewer node and the composite node and just give it a slight s-curve to mix all those layers together a bit better and let's take a look at our final result and i think this looks pretty good i'm happy with this so we are ready to render the animation but first of all let me quickly show you the final note setup if you want to take a look at it again and then let's go to the rendering tab again and in order to export a video file we need to change the file format from png to ffmpeg video under encoding just select the mp4 preset and switch the output quality from medium to perceptually lossless then also don't forget to select an output folder so go to wherever you want to save it give it a file name in this case i'm just going to call it monkey click accept and to start rendering just go up here and choose render animation and this might take some time to render all the 327 frames but if you want to speed this up even more you can down bring down the resolution a bit more or also bring down the numbers of samples which is going to speed up the rendering process are you thinking about upgrading your pc to increase rendering speed and improve your 3d work well let me tell you that there is also another solution to this issue rendero offers extremely high performance cloud computers that you can use for your blender projects connecting to them is really intuitive and from my experience everything is very stable and works great if you want to learn more about cloud computing you can watch my car vfx tutorial that i recorded entirely on a virtual machine or just visit randero.com that's it for this video i hope you could learn something new and thank you very much for watching i am nick from blender daily see you in the next one
Info
Channel: Nik Kottmann
Views: 235,651
Rating: undefined out of 5
Keywords: motion tracking, camera tracking, blender motion tracking, blender camera tracking, blender vfx tutorial, blender camera tracking tutorial, blender visual effects, Camera Tracking with Blender for Beginners! (VFX Tutorial), visual effects tutorial, motion tracking tutorial, camera solve tutorial, add 3d object to video, blender add 3d object to video, blender vfx, visual effects with blender, blender vfx beginner tutorial, beginner tutorial, blender beginner tutorial, beginner
Id: O67P0uzbQBk
Channel Id: undefined
Length: 29min 2sec (1742 seconds)
Published: Tue Sep 28 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.