Game Development Reference
In-Depth Information
allowing for a more modular engine design. On the downside the heuristics on
which these methods are based are not accurate and may fail or cause artifacts.
There are also a number of analytical techniques emerging. These techniques do
not try to recover information from buffers but instead take advantage of a priori
knowledge of the scene. Examples of this include distance-to-edge antialiasing
(DEAA) [Malan 10] and geometry buffer antialiasing (GBAA) [Persson 12]. By
using available information about the underlying geometry, these methods can
provide much more accurate results. The downside is that they require more
engine support and consequently are not as modular and may require a greater
amount of maintenance effort in an engine.
This article will introduce a semianalytical method that requires very little in
terms of data from the game engine to do its job.
3.2
Algorithm
3.2.1 Overview
This technique uses the regular depth buffer and a buffer containing the second
layer of depth. The former should already be available; however, the latter is not
something an engine normally has and thus is something the engine will have to
provide. Fortunately it is relatively straightforward to generate, and should the
engine already be using a pre-Z pass, only a trivial change is required.
The underlying idea of this technique is to use the slope of depth to compute
where the original edge is located. If we draw a line through the depth samples
and find the intersection point, this is where the original edge was. This assumes
that there is an adjacent triangle on the other side of an edge, which normally
ought to be the case (with some exceptions). To understand how this works,
we must first understand the basic properties of depth. If you already have a
thorough understanding of depth, you may skip the next section.
3.2.2
Understanding depth
A depth buffer can contain a surprising amount of useful information. For in-
stance, in deferred shading it is common to extract the world position for a pixel
from a depth buffer value and its screen-space position alone. The depth buffer
also has some interesting properties that are crucial for this technique. The key
insight we need to bring before heading into the details of this technique is that
a depth buffer is in fact linear.
It is commonly stated that Z is nonlinear. This claim is usually done in
the context of Z-buffering and refers to the distribution of depth values in the
depth buffer in regards to view distance. There is indeed a nonlinear distribution
of depth values in depth buffers, at least with a perspective projection. In a
traditional depth buffer ranging from 0 at the near plane to 1 at the far plane,
 
Search Nedrilad ::




Custom Search