Game Development Reference
In-Depth Information
L 0
L 1
L 2
L 3
L 4
L 5
L 6
L 7
L 8
Figure 2.5. The depth layers produced after matting the input buffers.
Note that the CoCs ( d k ) for depth layers located behind the focus plane ( k>
k focus ) will be negative and that Equation (2.5) is only applicable as long as
f 2
d K 1 >
f ) .
( z focus
The anchor point furthest away from the camera, z K 1 , is limited by this con-
straint. Special care has to be taken when matting the foremost layer ( L 0 )and
the back layer ( L K 1 ), shown in Figure 2.5, where all fragments with a depth
smaller than the foremost anchor point ( z 0 ) are matted into L 0 and fragments
with depths beyond the back anchor point ( z K 1 ) are matted into L K 1 .
To simulate DoF, a sucient number of depth layers spanning the whole depth
range of the scene have to be generated.
Simply using the near and far clipping planes would produce empty depth
layers, at the front and the back, if the rendered scene's depth range is smaller.
looking at bounding-box depth or by calculating a minimum-maximum mipmap
on the framebuffer.
Blurring and Composition
Each depth layer L k has a CoC d k that determines the width of the blur filter.
We use Gaussian filters, because they are separable, can be recursively applied,
and produce smooth results. The mapping from CoC to the standard deviation
σ of a Gaussian kernel H is chosen empirically as
d pix =4 σ .
Note that d pix is the d coc in screen coordinates and has to be transformed into
the world coordinate system.
One could convolve each layer separately, but this would require large and
thus expensive filter widths farther away from the focus plane. Instead, we use
a recursive filtering approach, where we start with the farthest layers and filter
after each composition step. Thus, the further away from the focus plane a layer
is, the more often it gets blurred.
Search Nedrilad ::

Custom Search