Graphics Reference
In-Depth Information
How it works…
In this recipe, we have implemented a method for culling light volumes based on their
depth in order to only render where the light is likely to have an impact upon the final
rendering result. The following diagram shows four objects: A, B, C, and D, lit by three
point lights: 1, 2, and 3:
A diagram showing how light volumes are rendered. The outlined halves of light 1 and 2 represent the faces that are
rendered, while the outlined portions of A, C, and D represent which pixels will be affected after the depth tests.
The area of each light's volume that will be rendered is determined as follows:
F The first light is within the frustum near and far clip planes; therefore, we choose
to cull the front faces and set the depth test so that the light volume fragments will
only render if they have a depth greater than the contents of the depth buffer at that
point, that is, render when there is something in front of the back faces of the light
volume. The highlighted portion of object A shows the area of the G-Buffer that will
have lighting applied for the first light.
F The second light on the other hand partially lies beyond the far clip plane; therefore,
we choose to cull the back faces and set the depth test so that the light volume
fragments will only render if they have a depth lesser than the contents of the depth
buffer at that point, that is, render when there is something behind the front faces of
the light volume. The highlighted portions of objects C and D show the areas of the
G-Buffer that will have lighting applied for this light.
F The third light fully encloses the frustum; therefore, we use a fullscreen quad to
process the entire buffer, applying lighting to all four objects. There is no depth
test in this instance.
 
Search WWH ::




Custom Search