Game Development Reference
InDepth Information
Near
Near
Far
Far
Trans
parent

par en t
Trans
parent
Z
Z

Trans
parent
Trans
parent
(a)
(b)
Figure 4.3.
Zbounds used for (a) opaque and (b) transparent geometries.
For transparent geometry, we would like to find the transparent objects' min
imum Zvalue and the minimum of the transparent objects' and opaque objects'
respective maximum Zvalues. However, this is somewhat cumbersome, requir
ing several passes over the transparent geometry; therefore, we simply use the
maximum Zvalue from the opaque geometry to cap the tiles in the far direction.
This discards lights that are hidden by opaque geometry. In the near direction,
we extend the tiles to the camera's near plane, as shown in Figure 4.3(b).
Using separate bounds turned out to be slightly faster than using the same tile
bounds for both opaque and transparent geometry; in
Figure 4.1(b)
, when using
separate bounds, rendering takes 15
.
1 ms (upper) and 21
.
9 ms (lower), compared
to 16
.
1msand23
.
5 ms when using the extended bounds for both opaque and
transparent geometries.
We would like to note that this is, again, scene dependent. Regardless of
whether we use the approximate variant or the exact one, we can still use the
depth buffer from the opaque geometry during the final render in order to enable
earlyZ and similar optimizations. If we do not use the minimum or maximum
reduction to learn a tile's actual bounds, no modifications are required to support
transparency.
Light assignment.
If separate sets of tiles are used, light assignment must be done
twice. In our case, a special optimization is possible: we can first assign lights in
two dimensions and then discard lights that lie behind opaque geometry (use the
maximum Zbound from the tiles only). This yields the light lists for transparent
geometry. For opaque geometry, we additionally discard lights based on the
minimum Zbound information (
Listing 4.2
).
Search Nedrilad ::
Custom Search