Anti-Aliasing
Welcome back!
In the first part of this article a variety of topics were discussed that provided an introduction to 3D graphics. Here in part two, we will give a basic overview of some other graphics concepts that will help further in understanding the technology. Hopefully the two parts of this article will provide the needed foundation for looking into the complex, yet entertaining world of 3D graphics. If you haven't read the first part of our
3D Basics article, it would probably help to do so now!
Without further ado, let's dive into our next 3D Basics tutorial!
Anti-Aliasing
Anti-aliasing, as noted in the name, works to remove "aliasing artifacts" from the final image of a display. Aliasing artifacts are generally regarded as the "stairstep" or "jaggy" edges you see on curved/diagonal lines on your monitor, and come from a lack of sufficient sampling data. The "jaggies" on these edges result from an insufficient number of pixels available, with each pixel being a sample of the 3D world.
Modern anti-aliasing works by blending the colors of these edges with colors closer to the background hues around them. The reason this works is beyond the scope of this article, but the result falls into that subtle-yet-noticeable category, and has the more noticeable effects of appearing as a higher resolution, and the removal of moiré patterns (also a sampling artifact).
The most common type of anti-aliasing is known as super-sampling. It works by rendering the scene at a higher resolution (often 4x the original resolution), taking the color value of each sub-pixel in groups of 4 and averages them down into a single value. In essence, super-sampling removes aliasing artifacts from triangle edges and textures simply by taking more samples, similar to reducing the size of a picture in Photoshop.
Other ways to smooth
There are also more advanced anti-aliasing methods, such as multi-sampling. With super-sampling, the problem is that the scene is rendered at 4x the base resolution, resulting in a 75% fill-rate hit - the graphics processor is doing significantly more work and using more resources than what you see in the output, a somewhat inefficient situation.
With multi-sampling, while the scene is still rendered at 4x (or some other defined multiple) the resolution, all of the sub-pixels (the pixels that are averaged down into the final pixel) use the exact same color value. This means that a new color doesn't need to be processed (shaded and sampled) for each pixel, thus there will not be an impact on the fill rate.
The only problem with this implementation is the fact that it only works on triangle edges. The reason this works is that you only render the sub-pixels that fall inside the triangle. So when you down-sample, while using 4 sub-pixels, at a triangle edge, some of the sub-pixels will come from a different pixel thus resulting in a different color assigned to the edge pixels.
Triangle edge anti-aliasing is yet another form of AA, though it has not yet been implemented in consumer level hardware. This implementation works by processing each triangle to specifically locate the edges. From there, a variety of approaches can be used. One implementation would be to super-sample only the triangle edges. In such a case, when an edge is located, multiple samples are taken for each of the edge pixels only, with these samples blended together. The final result would be the removal of any edge-aliasing artifacts without the need to process redundant data.