Game Development Reference
FIG 7.31 A shallow depth of field.
7.4.1 Depth of Field
Depth of field is the term used to describe how an optical lens focuses on
the surrounding environment. It describes the distance between the closest
and the farthest objects in view that appear in sharp focus. A shallow depth
of field has items only nearest the middle of the view in focus as shown in
Figure 7.31 .
As the human eye is a lens it also projects an image with a depth of field.
Unlike in a straightforward virtual terrain where all objects are in focus,
for humans, our real world tends to become fuzzy in the distance and
sometimes close up. Adding a depth of field effect to the game view camera
gives the scene a higher feel of realism, quality, and 3D effect. The depth
of field effect in Unity is shown in Figure 7.30 .
Blur is an effect that makes the entire image look out of focus. It can be used
effectively to simulate the look of being underwater.
Setting a pixel's color to the average color of its neighbors creates a blur
effect. Within a certain radius all pixel colors are sampled, added together,