O'Reilly logo

GPU PRO 3 by Wolfgang Engel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

4
I
Geometric Antialiasing Methods
Emil Persson
4.1 Introduction and Previous Work
Recently a number of techniques have been introduced for performing antialiasing
as a postprocessing step, such as morphological antialiasing (MLAA) [Reshetov09,
Jimenez et al. 11], fast approximate antialiasing (FXAA) [Lottes 11], and subpixel
reconstruction antialiasing (SRAA) [McGuire and Luebke 11]. These techniques
operate on the color buffer and/or depth buffer and in the case of SRAA on super-
resolution buffers. Another approach is to use the actual geometry information to
accomplish the task [Malan 10]. This method relies on shifting vertices to cover
gaps caused by rasterization rules and approximates the edge distances using
gradients.
In this chapter, we discuss geometric postprocess antialiasing (GPAA) [Pers-
son 11a], which is an alternative approach that operates on an aliased image and
applies the antialiasing post-step using geometry information provided directly
by the rendering engine. This results in a very accurate smoothing that has none
of the temporal aliasing problems seen in MLAA or the super-resolution buffers
needed for SRAA or the traditional MSAA. Additionally, we will discuss geom-
etry buffer antialiasing (GBAA) [Persson 11b], which is based on a similar idea,
but is implemented by storing geometry information to an additional buffer. This
technique is expected to scale better with dense geometry and provides additional
benefits, such as the ability to antialias alpha-tested edges.
4.2 Algorithm
Two geometric antialiasing methods will be discussed here. The first method
operates entirely in a postprocess step and is called geometric postprocessing
antialiasing (GPAA). This method draws lines over the edges in the scene and
applies the proper smoothing. The second method is more similar to traditional
MSAA in that it lays down the required information during main scene render-
ing and does the smoothing in a final resolve pass. This has scalability advan-
71
72 I Geometry Manipulation
tages over GPAA with dense geometry and provides additional opportunities for
smoothing alpha-tested edges, geometric intersection edges, etc. On the down
side, it requires another screen-sized buffer to hold the geometric information.
Hence, it is called geometry buffer antialiasing (GBAA).
4.2.1 Geometric Postprocessing Antialiasing
Overview. Provided there is an aliased image and geometric information available
in the game engine, it is possible to antialias the geometric edges in the scene.
The algorithm can be summarized as follows:
1. Render the scene.
2. Copy the backbuffer to a texture.
3. Overdraw aliased geometric edges in a second geometry pass and blend with
a neighbor pixel to produce a smoothed edge.
Steps 1 and 2 are straightforward and require no further explanation. Step 3
is where the GPAA technique is applied. For each edge in the source geometry
a line is drawn to the scene overdrawing that edge in the framebuffer. Depth
testing is enabled to make sure only visible edges are considered for antialiasing.
A small depth-bias will be needed to make sure lines are drawn on top of the
regular triangle-rasterized geometry. For best results, it is better to bias the
scene geometry backwards instead of pushing the GPAA lines forward since you
can apply slope depth-bias for triangles. However, if the edges are constructed
from a geometry shader, it is possible to compute the slope for the primitive
there, as well as for the adjacent primitives across the edge.
The antialiasing process is illustrated in Figure 4.1. Here, a geometric edge is
shown between two primitives. It may be adjacent triangles sharing an edge or a
foreground triangle somewhere over the middle of a background surface.
Figure 4.1. GPAA sample direction and coverage computation.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required