Graphics Reference
In-Depth Information
Figure 11.9. Scissor rectangle calculation for a point light.
section will focus on optimizations that can reduce the number of pixels shaded, to minimize
the amount of bandwidth and/or shader ALU resources consumed by the lighting pass.
Scissor Test
The rasterizer stage of the pipeline can perform what is known as the scissor test. 9 This test
checks whether the screen space position of each rasterized pixel intersects with a "scis-
sor" rectangle and avoids shading any pixels that fail the test. This can be leveraged by a
deferred renderer as a coarse-grained mechanism for culling pixels that won't be affected
by a particular light. However, it should be noted that since this technique is based on the
screen-space coverage of a light source, it only works for local light sources (point lights
and spot lights), and not for global light sources (directional lights).
To effectively use the scissor test, we must calculate a screen-space bounding rectan-
gle for the light source. Before we can do this however, we must determine the area of the
screen that will be affected by a light source, which can be calculated based on the light's
parameters, the camera position and orientation, and the projection parameters. This pro-
cess is simplest for a point light source. Since a point light contributes equally in all direc-
tions, we can assume that the light's area of effect is perfectly spherical in both world space
and view space. Thus, we can trivially fit a bounding sphere in view space to the light's
area of effect. Once this bounding sphere is determined, an axis-aligned bounding box can
be fitted to encapsulate the sphere. The corners of the screen-space bounding rectangle can
then be determined by transforming the eight corners of the box by the projection matrix,
9 The use of the scissor test is described in the rasterizer section of Chapter 3.
Search WWH ::




Custom Search