Getting realistic renders in open source cross platform 3D software Blender is about more than textures and lighting. It’s about how you use a camera, albeit a virtual one. Using the virtual camera lens in Blender, you can simulate Depth of Focus (DOF) which adds amazing realism to your 3D graphics.
In this article we will show you how to use DOF in your own Blender shots to add realism or simulate small objects.
Employing the DOF settings in Blender are simplicity itself, but making it really dance requires a lot more effort and concentration. In the real world the effect is a consequence of different apertures (the adjustable iris in the lens) and its effect on the depth of the area of focus. Small apertures make the depth of focus very deep, meaning everything is in focus. Wide apertures mean shallow depth of focus, meaning things close and far away are out of focus, but the point of focus is sharp.
Incidentally, this is how “tilt shift” effects make landscapes look like miniatures, by imitating the effects of wide aperture lenses close to a small object.
Set the Scene
To fully explore this effect, you need to have a scene with a number of similar objects arranged in a grid. This way you can focus on one and let the others drift out of focus for the full effect.
In our example we made a bullet-shaped object out of a cube (using loop cut techniques from this article about modelling) and copied it thirty times over a plane.
We gave the bullet shapes a glass texture and a green colour.
We gave the plane a diffuse texture and a colour of dark brown.
We lit the scene with a plane above and behind the camera for nice soft lighting. We made the plane white and made it an “Emission” surface rather than diffuse.
Frame the shot to keep the item in focus in the centre and leave some of the other objects to drift out of focus in the top and bottom of the frame.
Keep your Focus
To set the focus for the scene, we need to choose an object which will be the point of focus for the shot. The easiest way to do this is select an object you wish to be the point of focus.
In the camera properties, you can set which kind of sensor or camera you are simulating, and it’s a good habit to set this if you are trying to pair your CG shots with actual practical shots made with a specific camera.
In the “Depth of Focus” panel at the bottom of the Camera properties tab, you can see we have set the object to the “Cube” in the centre of the frame.
Note: This just happens to be the original object; all the others were duplicated with the “Object -> Duplicate Objects” menu selection. All the copies are called Cube.001, Cube.002, etc.
Just click on the Focus drop-down in the DOF panel and select the object from the list.
Select the aperture or f-stop you wish to use (using either Blender number or f-stop which you select from the drop-down under aperture), and in addition you can select the amount of blades in the iris. Why would you do that? To affect the bokeh (fuzzy blobs of light) which form on highlights which are out of focus. The number of blades affect the shape.
Now render the result. Set a camera frame size of HD 1080p, and don’t forget to set the Sampling size from the drop-down as Final.
You can also set the point of focus and the distance manually by typing a distance in the field in the DOF panel.
Depth of Focus is a much bigger subject out of the scope of a short article like this. We will go into the ramifications of aperture in photography when we talk about digital cinematography in a forthcoming article. Do you have any questions about DOF and Blender? Please leave them in the comments below.
Image Credit: Wikimedia