Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
One more way to add realism to your scene is to add depth of field. Now this simulates the blurring you get when you have some objects in and out of focus within a scene, so it's basically a camera-focus effect. Now we do this by setting up what are called composite nodes in Blender, so we're going to get a little taste of those as well. Now I have a simple scene here with three coffee cups and a camera and one light in the scene. Now if I hit F12 to render, you will see that, well, the coffee cup looked just fine, but they're all in focus, which is really what this will be without any depth of field.
So let's go ahead and add in some depth of field to get some selective focus. We do this in a couple of steps. First, we have to set up the camera. Then we have to set up composite that actually creates the depth of field. So I'm going to go ahead and right- click on my camera, go over to my Camera Properties panel, and down here we have an entry called Depth of Field. But before I do that, I'm going to turn on Display > Limits. Now this displays a number of things.
The one thing you want to take a look at is this little cross right here at the camera. This is really my depth of field distance. So if you scroll up to Depth of Field here, you can move this number up and down, and notice how that cross moves along that line. And this tells the camera where it's going to focus. Now if we want, we can actually pick any object in the scene and have that set as the focus. So if I were to select Cup_02, it would set that so that I have that in focus.
But regardless of how you set this, this is really going to be your focal point. Now if we do a render right now, we're not going to get anything, because we really haven't set up Depth of Field to take advantage of this number. We do that by setting up what are called compositing nodes. And so what I have to do is go into my Node Editor. So I'm going to select this 3D View, and I'm going to go into the Node Editor. Now I'm going to click on the far-right button here which has these pictures, and that's my composite nodes.
And what it does is it adds a node- based compositing program that allows us to do all sorts of effects. So I'm going to click on Use Nodes, and when I do that, you see we actually only have two nodes. We have our Render layer and then our Output here. Now if I hit F12 to render, you'll see the image will show up in that render layer. Now this is a node-based compositor and so we can add in any sort of nodes we want. So if I wanted to, I could add in a filter.
I could add in an effect, Distortion, any sort of effect. So for example, if I just wanted to do brightness and contrast, I could do Color > Brightness/Contrast and we can actually create a network to allow us to add brightness and contrast. So what I have is my render, and before I actually go to final output, I'm going to plug my render into the image input of this Brightness/Contrast, take the image output of that and plug it into the image input of my output, and now I can have brightness or contrast in my scene. So you could see I can make this a lot more contrasty if I want.
And you could do all sorts of effects with this composite node. But right now we're here to actually create depth of field, so I'm going to go ahead and select this composite node and delete it, and then we're going to add in a different node. We're going to add in a filter called Defocus. And what that does is that gives me my depth of field. So again, I'm going to take my render layer, click on Image, and find the image input on my Defocus, and then select the image output on my Defocus and plug it into my output.
Now because this is a depth-based effect, I also need to connect my Z-Buffer. So here on my Render layer I have a Z output. So I'm going to left-click on that and plug it in to Z here, and this should give me a Defocus here. So now all I have to do is click on Use Z-Buffer and I can start to get my effect. Now I have a number of controls here. One is fStop, and then Maximum Blur and then Threshold.
Let's start with fStop. Now if you're familiar with cameras, you'll know that high fStops mean infinite depth of field. So an fStop of my default here of 128 means I'm not going to get any defocusing. The lower the fStop, the more depth of field you get. So I'm going to bring this down to a very small number. Let's bring this note to, say, f-2. And as soon as we do, you can see that I'm getting my defocus effect. So we also have a Maximum Blur, so we can actually turn that up or down.
But the other one is actually kind of nice. It's called Threshold, and this determines how wide my focal area is. So a bigger number puts more stuff in focus. So if my Threshold is bigger, you'll see that it kind of stretches out. And then we also have how many samples are we using to actually create this effect? So if we want to, we can type in a bigger number to get less graininess, and that will create a better effect.
Now another option here is the Bokeh Type. Now if you're familiar with camera lenses, you'll know that this is representative of how the aperture of the camera works. So by default, it's circular, but we can change it to any shape we want, so basically triangular, square, hexagonal, and so on. A lot of times Hexagonal works a little bit better, and it can give you another type of effect. Now if I want to change the focus in the scene, I can certainly change my depth of field here.
I can either select a different object, so let's say Cup_01 and go ahead and render, and that will put that object into focus. Or if I want, I can basically select that, hit Backspace, and then my Depth number comes back up here, and then I can dial it in if I want. So as you can see, adding depth of field is a little more complex than other effects in Blender, but you can get some really great results.
All you have to do is set your depth of field in your camera and then just add a Defocus filter in between your Render layer and your Output in the Node Editor.
Get unlimited access to all courses for just $25/month.Become a member
107 Video lessons · 32869 Viewers
94 Video lessons · 22773 Viewers
78 Video lessons · 9028 Viewers
147 Video lessons · 2995 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.