Game Development Reference
Figure 2.1. (a) A pinhole rendering resulting in a crisp image. (b) Simulating shallow
DoF with the proposed method partly reveals occluded scene content. Note how the
tongue of the dragon almost vanishes. This effect can be explained by partial occlusion.
the blurriness, the so-called circle of confusion (CoC) for an out-of-focus fragment
at depth z can be calculated as
d coc ( z, f, N, z focus )=
f 2 ( z
z focus )
zN ( z focus −
where f is the focal length of the lens, N is the f -stop number, and z focus is
the distance to the focus plane [Potmesil and Chakravarty 81]. Note that Equa-
tion (2.1) is based on a thin lens model, which is sucient for simulating DoF.
To simulate DoF, each fragment in the rasterized image is blurred according to
its CoC in a post-process.
However, if the blurriness of an out-of-focus object increases, fragments are
strongly smeared and become transparent, thus revealing background informa-
tion, as shown in Figure 2.1 (b). Current rasterization renderings do not store
occluded fragments, therefore it is not possible to accurately simulate this trans-
parency. To do so, occluded information has to be either stored or interpo-
lated. Most DoF methods that correctly simulate partial occlusion (such as [Lee
et al. 10, Schedl and Wimmer 12]) store the scene content in depth layers. One
way of assigning fragments into layers can be based on depth, which has the
advantage that it is possible to uniformly blur each depth layer. Prominent ar-
tifacts in layered DoF methods are discretization artifacts: Layers are blurred
and therefore object borders are smeared out. When this smeared-out layer is
blended with the other layers, the smeared border region appears as a ringing
artifact at object borders due to the reduced opacity [Barsky et al. 03].