Graphics Reference
In-Depth Information
would belong to. This way the light source doesn't "bleed through" the wall, and only af-
fects the room it is in.
When rendering the scene geometry, we can use the same premise as above, except
that we set the reference value to an 8-bit unsigned integer created by bitwise OR'ing all of
the light groups to which it belongs. Then during the lighting pass, we also determine the
same 8-bit value using the light groups that a light belongs to. However, instead of using
that value as the reference, we set it as the stencil read mask. This mask is bitwise AND'ed
with the value in the stencil buffer, and the reference value is compared with the stencil
buffer value, using the specified test function. Thus, if we use a reference value of 0 and
D3D11_C0MPARISON_LESS as the test function, the stencil test will pass if the geometry at
that pixel and the light both belong to any of the same light groups.
Screen Space Tile Sorting
This technique is another exploitation of the spatial coherence of local light sources. The ba-
sic concept involves splitting the screen into tiles of a fixed size and determining which light
sources need to be rendered for each tile (Balestra & Engstad, 2008), (Lauritzen, 2010). Then
the lights are all rendered in one batch or a series of batches, where the pixel shader evaluates
and sums the lighting contribution for all lights in the batch. The diagram in Figure 11.10
illustrates the concept.
At first glance, it may seem that this technique is inferior to the other techniques men-
tioned earlier, since pixels can only be culled at the level of granularity used for the tiles. This
can be especially inefficient when a small light intersects with multiple tiles. However, this
technique has three key advantages. The first is that the g-buffer only needs to be sampled
once for each batch, which potentially reduces the bandwidth required for rendering each
light, as long as the batches contain multiple lights. This also means that the g-buffer's at-
tributes only have to be unpacked or reconstructed once per batch, which saves shader ALU
cycles. The second is that the lighting con-
tribution only has to be written to the ren-
der target (and possibly blended) once per
batch, which can further reduce the band-
width usage of the lighting pass. The third
is that it makes the lighting computations
suitable for evaluation on general-purpose
computation resources such as CPUs or
compute shaders (Lauritzen, 2010), since
no rasterization is required and the memory
access is extremely coherent.
If this technique is performed using
the standard GPU rendering pipeline, it
Figure 11.10. Tiled light binning.
Search WWH ::




Custom Search