Graphics Reference
In-Depth Information
can be combined with some of the other optimizations mentioned earlier in this section.
For instance, depth testing can still be used by rendering a quad and setting the view-space
Z of each vertex to the maximum or minimum depth of all lights in the batch. In addition,
the scissor test can also still be used to cull pixels for smaller lights.
11.5 Anti-Aliasing
Deferred rendering has many advantages, which result from the way it reorganizes the
rendering pipeline. However at the same time, this reorganization makes it incompatible
with certain techniques and enhancements that have previously worked with traditional
forward rendering. One of the biggest examples is multisample anti-aliasing, or MSAA 1 1
MSAA works by altering the rasterization process so that triangle coverage is computed
at a subpixel level, so that the output of each pixel can be written to none, some, or all of
the subsamples in the render target. The resulting subsamples are then blended to produce
the final output. For this to work, we must be rasterizing the scene geometry while render-
ing the final pixels. Also, for those pixels where geometry intersects, the subsamples must
contain the proper color values that would result from fully lighting and shading those tri-
angles. With classic deferred rendering, we satisfy neither of those conditions, while with
light prepass rendering, we only satisfy one. In this chapter we will discuss alternatives and
workarounds for providing anti-aliasing in a deferred Tenderer.
11.5.1 Supersampled Anti-Aliasing
Supersampled anti-aliasing, commonly abbreviated SSAA, is the simplest alternative type
of anti-aliasing to implement, and was mentioned briefly in Chapter 3. With SSAA, we
simply render the scene at a sample rate (resolution) that is higher than the output, and
then filter (downsample) the resulting image before presenting it to the display. Some GPU
hardware features SSAA modes that can be toggled in the driver settings, but it can be eas-
ily implemented in software as well. In a deferred Tenderer, we simply make the g-buffer
and light buffer be render targets larger than the back buffer, and then downsample the
result of the lighting pass (or the second geometry pass, in the case of light prepass). Or
alternatively, the g-buffer can simply be rendered at a higher resolution. Then, during the light-
ing pass multiple, g-buffer texels can be sampled and evaluated, so that the result can be filtered.
Naturally, the main problem with SSAA is performance. Increasing the resolution by
a factor of 2 or 4 puts additional pressure on nearly every part of the GPU pipeline, and also
greatly increases the amount of GPU memory (and corresponding bandwidth) consumed
1 1
For more details on MSAA, see Chapter 3, "The Rendering Pipeline.
Search WWH ::




Custom Search