Blender Tutorial

DOF(Depth of Field)

DOF means focused area which shows object in sharp. If the focused area is long range from your camera location or a location which the focus begins, you can say DOF is deep (I don't know how to say in foreign country). If it is short range, you can say DOF is low. Blender can make this DOF effect. This page is explanation how to do it in Blender.

DOF sample

Step 1. Making a sample scene.

You create a scene. Below is one sample.

scene

Step 2. Activate Nodes Editor.

(1) Select hNode Editorh in window menu.

Window Menu

(2) Turn on the button "Composite Node, (a)" in the header. Then, turn on the button "Use Nodes, (b)". After that, Nodes appears in the 3D view.
Header image

Node

Step 3. Adding Map Value Node.

Select "Space Key" -> "Add" -> "Vector" -> "Map Value" to add Map Value Node. And separate "Render Layers" node from "Composite" node. And plug the "Map Value" node into the "Z socket" of the "Render Layers" node. See following image for reference.

Plug into Map Value

Step 4. Adding Color Ramp Node.

Select "Space Key" -> "Add" -> "Convertors" -> "ColorRamp" to add "ColorRamp" node. And plug it into the "Map Value" as shown asa below.

Plug ColorRamp

Step 5. Adjusting DOF.

(1) Connect "Colo‚’ Ramp" node to the "Composite" node.

Composite

(2) Now, it must be blank image in the "Composite" node (as shown as above). Change Offs = -4 in the "Map Value" node, and change Size = 0.2. Then the image will be changed as shown as below. The black part means focused area, white part means blur area.
(If your image didn't change like the image, adjust the two values a little. This is very sensitive setting, so it has better to input specific value directly, not using value-slider.)

setting 1

(3) After that, we would like to add more blur in deep area. Drag a slider at the right side (white) of the gradation area in the "Color Ramp" node and move it like below.

setting 2

Step 6. Adding Blur Node.

Now we add blur based on the Black-White output. Select "Space Key" -> "Add" -> "Filters" ¨ "Blur" in the Node window. And connect as shown as below.

Blur

Step 7. Adjusting Blur.

Select "Gauss" in the Blur Node. And change X = 5 and Y = 5. Larger value makes the blur stronger.

Blur

Step 8. Rendering.

Turn on hDo Compositehbutton on the Anim panel of the Render Buttons. And then push "F12" to star rendering. You will see a image like below.

DOF Result

Now we finished. You could make it? You may notice that every time you change a setting value, the blender is recalculating. Therefore, if the scene is complex, the duration you have to wait is getting longer and longer. If you turn off the "Use Nodes" button, the recalculation doesn't work. But you can't see the result timely. So, I introduce good way to save the time in the next tutorial (Efficient way for DOF).

Return to Blender tutorial menu.