Game Development Reference
exceptions, of course. Terrain is typically not closed geometry per se, i.e., there is
no underside of it, so a second-depth pre-Z pass would not cull the skybox behind
it if it was drawn immediately after the pre-Z pass. This is, of course, fixable in
practice by drawing the terrain before the skybox in the main scene rendering. In
that case a second-depth pre-Z pass would provide all the self-occlusion culling
the terrain needs while not wasting any precious raster operations on filling large
areas of the screen with essentially nothing but skybox behind it.
There are other conceivable approaches for generating a second depth buffer
with the potential advantage of not requiring a pre-Z pass or second geometry
pass at all. For instance, one method could be to use a geometry shader to send
triangles to two different slices in a render target array depending on the fac-
ingness. One slice would contain the front-faces and the other the back-faces.
Another approach could be to use a DX11-style linked list of fragments [Thi-
bieroz 11]. If this is used for order-independent transparency, we could already
have the second layer there ready for use. A full-screen pass could extract the
first and second depths from the fragment list and write to a separate buffer.
Neither of these methods has been applied to SDAA, so it is unclear if there are
any potential issues or how they would compare performance-wise in real-world
Image quality. Second-depth antialiasing, like other analytical methods such as
GBAA [Persson 12], has the advantage that the coverage value is derived analyti-
cally rather than reverse-engineered through a set of heuristics—and consequently
is very accurately reproduced. This results in a very high-quality antialiasing re-
gardless of edge orientation. However, it should be noted that SDAA is sensitive
to depth-buffer precision. For hidden surface removal a 16-bit depth buffer is
more than plenty for the simple scene in the accompanying code sample; how-
ever, it is insu cient to be useful for computing intersection points for SDAA.
For this reason the demo is using the D32F format. However, it should be noted
that a 24-bit depth buffer also works.
Before applying SDAA we have the regular stair-stepped edge. After applying
SDAA the edge is very smooth. Unlike MSAA and many other antialiasing
techniques, the number of intermediate gradients is only limited by the precision
of the underlying color format.
Performance. The full cost of this technique largely depends on the scene and
the state of the engine prior to adding SDAA support. If there was previously
no pre-Z pass, or only a partial one, the need for generating the second depth