Graphics Reference
In-Depth Information
While the technique has been dubbed Wire Antialiasing, it applies to any object
that can be decomposed to a set of cylindrical shapes. This includes wires, pipes,
poles, railings, light posts, antenna towers, many types of fences, and even grass
if represented as actual geometry rather than as alpha textures. Tree trunks and
branches may also be cylindrical enough to work. These are all common elements
in games and frequent sources of aliasing.
6.2 Algorithm
6.2.1 Overview
The problem with very thin geometry, such as wires, is that it tends to degenerate
into a set of flickering and disconnected pixels when it gets sub-pixel sized. Why
is that? In technical terms, what happens is that the visibility function gets
undersampled. In plain English, the wire simply misses the pixels. A pixel only
gets shaded if the geometry covers the pixel center. If the wire is thinner than
a pixel, chances are that at some points it will simply slide in between two pixel
centers and end up not shading any of them. In this case there will be a gap.
The thinner the wire gets, the worse the problem gets. However, if the geometry
is wider than a pixel, we are guaranteed to have a continuous line with no gaps.
The problem thus occurs when geometry goes sub-pixel sized. The idea of this
technique, then, is to simply keep the wire one pixel wide or larger. To emulate
a sub-pixel coverage, we simply fade away the wire by outputting the coverage
to alpha and applying blending.
What about MSAA? Unfortunately, MSAA does not solve the problem. It
alleviates it somewhat, but the improvement is rather marginal. With 4 × mul-
tisampling, the visibility function is now sampled at twice the rate horizontally
and vertically. In other words, the wire can now be about half a pixel wide
(depending on sample locations) without risking missing all samples somewhere.
This is not much of an improvement, and all we have accomplished is to push the
problem into the distance. We can now have the wire twice as far away before
the problem occurs, or have a half as thin wire, but that is all. Actually, when we
enable MSAA, we normally want to eliminate “jaggies.” If we have a half-pixel
wide wire, MSAA may keep it continuous in this case; however, it will be jagged,
because it only hits a single sample per pixel. There is not enough resolution to
estimate the coverage, but it simply boils down to more or less a binary on/off
per pixel.
While MSAA does not by itself solve the thin geometry problem, it is still
valuable for this technique. While we are guaranteeing gap-free wires, we are not
producing smooth antialiased results as such. In fact, the wires will be jagged by
default. So we use MSAA for what it excels at, namely removing those jaggies.
So despite increased visibility function sampling rate with MSAA enabled, we
still limit wires to a one pixel width and keep the additional resolution for MSAA
Search WWH ::




Custom Search