Some time has passed since we last delved into the state of anti-aliasing. In this article, we investigate the feature thoroughly from the basics to vendor-specific implementations and learn some shocking surprises about driver settings along the way.
You now have an idea of what aliasing is and how anti-aliasing improves it. But how does this technology work? Let’s discuss the two generic anti-aliasing methods that 3D hardware uses: supersampling and multisampling.
Without anti-aliasing, your computer renders only what it finds at the very center of the pixel and applies that single color to the entire pixel.
Supersampling is the earliest anti-aliasing method used on consumer graphics hardware. The concept is quite simple: instead of applying the color detected at the center of the pixel, multiple color samples within that pixel are averaged out.
Let’s say you have a 1280x720 monitor. If you play a game and enable 4x supersampling anti-aliasing, your graphics card renders the frame internally at 2560x1440 and down-samples (averages out) the image to your 1280x720 output resolution. As a result, edges look smoother. Actually, everything looks better: edges, textures, and transparencies. That’s the beauty of supersampling.
Supersampling is still the highest-quality anti-aliasing method available to this day. But if it’s so great, why would we bother with anything else? Unfortunately, it’s also the most expensive technique in terms of processing and memory bandwidth because the graphics card is doing all of the work required to render each frame at a higher resolution. Supersampling can cripple frame rates, so a more efficient method is usually required. Enter multisampling.
Multisampling (MSAA) was created as a faster alternative to supersampling. The basic premise is to find a tradeoff between quality and workload in order to do the minimum amount of extra processing, while reducing aliased edges as much as possible. MSAA does this with two main techniques.
The first technique is edge anti-aliasing, which means that only the edges of objects are affected. The computer renders as much of the scene as possible without any anti-aliasing, but processes extra samples of the pixels on the edge of the object that would benefit the most. Before any anti-aliasing is executed, a Z-test is performed—a difference in depth within a single pixel indicates that it contains the edge of an object and therefore requires MSAA.
The second technique MSAA uses is a reduced-sampling workload. Some calculations are only performed once per pixel, such as for pixel shaders, texture lookups, and color sampling. Only the depth and stencil values are fully sampled. The PC uses this information to determine an optimal blend of color between the object and the background.
Here's an example of how a 4x MSAA sampling pattern works. On the left you can see four pixels, three of which contain the edge of a triangle and have been flagged by a difference in Z-value so that MSAA will be performed. The red dots represent the position at which MSAA samples are collected. Because we're looking at 4x MSAA, four samples are collected in each pixel:
The above example shows 4x MSAA with four samples per pixel. The more samples you take, the more accurate the resulting color blend will be. For example, 8x MSAA achieves a better result than 4x MSAA, and 4x MSAA achieves a better result than 2x MSAA.
Because this is a high-level guide, we’re oversimplifying a few things here on purpose. For example, in cases where there is more than one object overlapping within the same pixel, MSAA can sample multiple colors in that pixel. DirectX 9 centroid sampling can be used to make sure the color sample is taken within the object and not the background.
MSAA has been the de facto anti-aliasing method since it was adopted, and it delivers a great balance of image quality and speed compared to supersampling. Despite this, it can still be quite taxing on mid-range and low-end graphics hardware. In addition, an edge anti-aliasing technique like MSAA doesn’t enhance texture quality the same way that supersampling does. This means that textures (especially objects with transparent textures) have aliased edges that this method does not address. In the example below, note that MSAA anti-aliases object edges, but the chain-link fence texture and reflective water are not affected.
Because of these imperfections, graphics card companies like AMD and Nvidia have adopted proprietary anti-aliasing methods to complement MSAA. We discuss those next. But before we do that, let’s look at some image-quality comparisons to see how GeForce and Radeon cards stack up against each other when it comes to these basic anti-aliasing techniques.
Supersampling and Multisampling Image Comparisons
The first thing we can note is that Nvidia removed the supersampling option from its driver some time ago. The company states that the feature was taken out because its performance hit is unacceptable, so we aren’t able to compare GeForce supersampling quality.
Similarly, AMD only supports supersampling in DirectX 9—DirectX 10 and 11 are not supported. However, this isn’t as bad as it sounds, since most games continue to support a DirectX 9 code path, and supersampling is probably something you’ll want to avoid anyway due to its large performance hit.
We will compare supersampling and MSAA using Valve’s Source engine in DirectX 9:
As you can see, the AMD and Nvidia implementations of MSAA are very similar. It also seems that more than four anti-aliasing samples provide diminishing returns. For example, 4x MSAA does a much better job than 2x MSAA, but 8x MSAA doesn't achieve that much better of aresult than 4x MSAA. The difference between 8x MSAA and 16x MSAA is difficult to see.
- Defining Anti-Aliasing
- Generic Anti-Aliasing Implementations
- Texture Transparency: Nvidia’s TAAA And AMD’s Adaptive Anti-Aliasing
- Coverage Sampling Modes: Nvidia’s CSAA And AMD’s EQAA
- GeForce-Exclusive Anti-Aliasing Modes And Driver Settings
- Radeon-Exclusive Anti-Aliasing Modes And Driver Settings
- Driver-Forced Anti-Aliasing: Surprisingly Unreliable