Post Processing Effects: Depth of Field
Tutorial
·
Beginner
·
+0XP
·
10 mins
·
Unity Technologies
Depth of Field is a common post-processing effect that simulates the focus properties of a camera lens. In real-world applications, camera lenses can sharply focus only on a specific object or distance. Objects nearer or farther from the camera will be out of focus or blurred. The blurring helps give a visual cue to the viewer about the object’s distance.
Languages available:
1. Post-Processing Effects: Depth of Field
This tutorial has been verified using Unity 2019 LTS and Post-Processing 2.3.0 https://learn.unity.com/tutorial/post-processing-effects-depth-of-field-2019-3
Depth of Field is a common post-processing effect that simulates the focus properties of a camera lens. In real-world applications, camera lenses can sharply focus only on a specific object or distance. Objects nearer or farther from the camera will be out of focus or blurred. The blurring helps give a visual cue to the viewer about the object’s distance. Depth of Field helps simulate these aspects of real-world cameras and can help draw the viewer’s eye to a specific object in the scene; it also has the side effect of creating bokeh, the Japanese term for pleasing visual artifacts that appear around bright areas of an image when it falls out of focus.

Figure 01: Scene without Depth of Field

Figure 02: Scene with Depth of Field
2. Adding Depth of Field to Your Scene
To add Depth of Field to your Scene, open the Post-processing Volume Profile in your Project window.
1. If Depth of Field is not already in your list, add it by clicking
Add Effect > Unity> Depth of Field.
2. Once it’s in the list, make sure it’s enabled and expand the category to reveal the settings. (Figure 03)

Figure 03: Depth of Field properties
3. Depth of Field Properties
- Focus Distance: This changes the distance of the point of focus.
- Aperture: This is the ratio of the aperture. The smaller the value, the shallower the depth of field.
- Focal Length: This determines the distance between the lens and the camera. The larger the value, the shallower the depth of field.
- Max Blur Size: This determines the size of the bokeh filter, which determines the maximum radius of the bokeh. Higher values will affect performance on lower-end platforms. The options are Small, Medium, Large, and Very Large.
4. Conclusion
If you want to simulate how the human eye sees things, or emulate a camera lens, Depth of Field is a great tool. You can also find creative uses for Depth of Field, like in action sequences or complicated scenes where you want to draw the viewer's eye to a certain object or focal point. Much like any post-processing effect, it can have an impact on performance, so use it with care.