Sub topic 13
Depth of Field with a Focus Object and F-Stop
Depth of field (DoF) is the range of distances that appears sharp in a rendered image. Objects near or far from the focus distance become blurred. This chapter assumes that you can navigate Blender, select objects, and use the Properties editor.
What Controls Depth of Field
Depth of field is controlled by the camera data, not by the camera object’s transform. The main settings are:
- Focus Object: The object that defines the sharp focus distance.
- F-stop: A camera aperture value. A lower f-stop creates stronger blur. A higher f-stop keeps more of the scene sharp.
- Focal Length: Longer lenses usually produce a narrower depth of field when the framing and subject size stay similar.
- Camera Distance: Moving the camera closer to the subject usually makes the depth of field shallower.
A focus object can be an empty object placed at the subject’s important detail. It does not need to be visible in the render.
Setting Up a Focus Object
Create an empty at the point that should remain sharp:
- Select the subject, or select a nearby surface point.
- Press
Shift+A. - Choose Empty > Plain Axes.
- Rename the empty
FocusTarget. - Move it to the subject’s important detail.
- Select the camera.
- Open Camera Properties.
- Expand Depth of Field.
- Choose
FocusTargetin the Focus Object field. - Set F-stop to a starting value such as
2.8.
The focus object controls distance, but it does not control the direction in which the camera points. Aim the camera separately with its rotation, a Track To constraint, or viewport alignment.
Choosing an F-Stop
The f-stop describes the aperture opening relative to the lens focal length. The number is not a direct percentage. A smaller number means a wider opening and more blur.
| F-stop | Typical result |
|---|---|
| 1.4–2.8 | Strong background and foreground blur |
| 4–8 | Moderate blur with more of the subject sharp |
| 11–22 | Deep focus, with much more of the scene sharp |
Use a low f-stop for a portrait or product detail. Use a higher f-stop when several parts of a scene must remain readable. The visible effect also depends on camera distance, focal length, and the distances between objects.
import bpy
camera = bpy.data.objects["ShotCamera"]
focus_target = bpy.data.objects["FocusTarget"]
camera.data.dof.use_dof = True
camera.data.dof.focus_object = focus_target
camera.data.dof.aperture_fstop = 2.8If the focus target is missing or the wrong object is assigned, the camera may focus at an unexpected distance. If the entire image looks sharp, check that depth of field is enabled and that the render or viewport mode supports the effect.
Previewing and Adjusting the Effect
Look through the camera with Numpad0. In rendered view, change the f-stop while watching the subject:
- Set the focus object precisely.
- Start with an f-stop of
5.6. - Lower it to
2.8for more blur. - Raise it to
8or11for a deeper sharp region. - Render a test image at the final camera resolution.
A focus object placed in front of the subject makes the subject blurry. Place it on the surface or feature that should receive attention.
Exercise
A camera is focused on a character’s body, but the eyes are blurry. What should you change first?
Show answer
Move the focus object to the eyes. Adjust the f-stop only after the focus distance is correct.