Doc:2.6/Tutorials/Composite Nodes/Setups/Depth Of Field
Depth of Field
Depth of Field (DOF) settings are controlled from the properties editor via the camera panel. To begin, select your camera (right-click the camera in your scene), in the properties window, click the camera icon if not already selected. Scroll down to the "Depth of Field" panel.
The camera focus for the depth of field can be assigned through two different methods: using a focus object or by setting the focus distance manually.
- Assigning a Focus Object
- Click on the empty box labelled "Focus". A list of all the objects in your scene should be displayed. Select the object you would like the to have the camera focus (if you have a large number of objects in your scene, you may wish to begin typing the name of the object rather then select it from the list). Once you have assigned a focus for the camera, you are free to animate the focussed object. The camera will maintain focus on the object. If you do not want the camera to focus on a real object, you can add an empty to your scene to be used as an invisible control.
- Setting Focus Manually
- The focus of the camera can also be set manually using the focal distance slider. Like most properties in Blender, the value of the slider can be animated by inserting keyframes.
Creating A Defocused Effect
For more information about the Defocus node, see the section Filter→Defocus. Here we will show you how to add a Defocus node with a few basic settings. Briefly, the Defocus node can be used to show depth in an image by blurring or defocusing the areas behind or in-front of the camera focus. Before continuing, you will need to have set a focus for you camera, either manually or locked to an object, as described above.
Change to the Node Editor, either hold the mouse over the main 3-D window and press ⇧ ShiftF3 or change the screen layout to Compositing using the menu at the top of the screen. Once in the Node Editor, select the Compositing Nodes layout and click the "Use Nodes" check-box.
Add a defocus node, ⇧ ShiftA → Filter → Defocus, and connect it between the existing "Composite" and "Render Layers" nodes as shown bellow. Be sure to connect the Render Layers "Z" output to the lower input of the Defocus node.
Change the Defocus node settings to resemble the example above. (fStop: 6; Max Blur: 7; Threshold: 0; Use Z-Buffer). These values are a rough guide, you will probably need to change these values to achieve the effect you desire.