Anti-Aliasing Analysis, Part 1: Settings And Surprises

Generic Anti-Aliasing Implementations

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.

Supersampling

Without anti-aliasing, your computer renders only what it finds at the very centre of the pixel and applies that single colour 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 colour detected at the centre of the pixel, multiple colour 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

Multisampling (MSAA) was created as a faster alternative to supersampling. The basic premise is to find a trade-off 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 colour sampling. Only the depth and stencil values are fully sampled. The PC uses this information to determine an optimal blend of colour 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 colour 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 colours in that pixel. DirectX 9 centroid sampling can be used to make sure the colour 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 a result than 4x MSAA. The difference between 8x MSAA and 16x MSAA is difficult to see.

Create a new thread in the UK Article comments forum about this subject
This thread is closed for comments
14 comments
Comment from the forums
    Your comment
  • mi1ez
    Is that picture on P1 from the Half-Life 2 demo thing?
  • Gonemad
    "making it less desirable in games that have a lot of small type, like MMOs"

    Bingo! That was garbling the text in one certain MMO I was playing. I mean, really garbling to the point it was unreadable, even at 19 x 12 resolutions.

    However, even after disabling AA on the driver and in-game, it was still active. Now you call that "inconclusive". Fortunately, I make a full backup copy of the game folder before tweaking settings, and it took me a full folder backup restoration to disable the option. The catch is, I am trying to recreate the conditions of the malfunction, without success.

    Good Job on the article.
  • tranzz
    Great article - a similar one about anisotropic filtering would be interesting too
  • Jay_83
    Yes tranzz, we hear you.
    Nvidia's naming scheme for AA modes made me lol. Bastards!
    Thanks for the article, cleared some stuff up for me.
  • cleeve
    Anonymous said:
    Is that picture on P1 from the Half-Life 2 demo thing?


    Yessir. Half Life Lost Coast.
  • cleeve
    Anonymous said:

    However, even after disabling AA on the driver and in-game, it was still active. Now you call that "inconclusive". Fortunately, I make a full backup copy of the game folder before tweaking settings, and it took me a full folder backup restoration to disable the option. The catch is, I am trying to recreate the conditions of the malfunction, without success.


    Ouch, that sounds like a royal pain in the arse. Thankfully I never experienced that issue yet.
  • mi1ez
    Anonymous said:
    Yessir. Half Life Lost Coast.

    Ah yes! That's the one!
  • Zingam
    We don't need AA at all. We just need 16000x10000 22" LCD panels :P
  • Zingam
    The choice of a water background for these screenshots is a bad one. You should have chosen static backgrounds for the screenshots. Nothing should change between aliased and anti-aliased modes in the picture.
  • silverblue
    mi1ezIs that picture on P1 from the Half-Life 2 demo thing?

    Exactly my thoughts as well. :)
  • Gonemad
    "We don't need AA at all. We just need 16000x10000 22" LCD panels"

    That is exactly what Supersampling does. But I distinctly remember some games that looked jagged in the good ol'days of 800x600 and looked better at 1024 x 768 with better FPS than enabling AA at 800x600. Or even going back to 640x480 and turn all the eye-candy (back then) on.

    I guess Supersampling is still valid when you hit the TOP resolution of whatever your setup is, but the graphics card( 3x SLI or 3xCF) is still not getting hit. Something like triple 30" monitors at full blast.
  • acer0169
    With my old machine, Crysis always looked better at 1080p than 1440x900 with 4x AA. Now though - new machine.. 1080p with 4x AA sexy :D
  • chechak
    Great job with this article i hope next one will mention anisotropic filtering !
  • AntiZig
    great article, for someone who studied anti-aliasing in school, it was a great read to see how the big boys do it in video games of today.

    would love to see similar article about anisotropic filtering and tessellation.