Sign in with
Sign up | Sign in

Generic Anti-Aliasing Implementations

Anti-Aliasing Analysis, Part 1: Settings And Surprises
By

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.

Supersampling

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

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.

Display all 86 comments.
This thread is closed for comments
  • -4 Hide
    atikkur , April 13, 2011 4:19 AM
    PERTAMAX gan. .
  • 8 Hide
    burnley14 , April 13, 2011 4:24 AM
    Awesome article. I am unfortunately not one of the elite few who know all the ins and outs of graphics performance, so this was very enlightening for me.
  • 4 Hide
    dragonsqrrl , April 13, 2011 5:28 AM
    Great article, very informative. I've never really used forced anti-aliasing through the driver, and from what I've read it doesn't really sound like a good idea anyway, given the fact that most modern games provide adequate AA levels through in-game settings (these are usually better optimized as well). Seems like forced driver level AA is pretty hit-or-miss. With a few rare exceptions it just doesn't seem like it's worth the effort.

    ...went to the link for Tom's Geforce3 article. The good old Geforce3, now that takes me back.
  • 8 Hide
    tallguy1618 , April 13, 2011 5:36 AM
    This is definitely one of the better articles I've read
  • 0 Hide
    Anonymous , April 13, 2011 6:37 AM
    what are you talking about?
    we can still force Supersampling
    as of 266.58 on Nvidia cards
  • 1 Hide
    army_ant7 , April 13, 2011 7:00 AM
    Why does it say here, http://www.geforce.com/#/Optimize/Guides/AA-AF-guide (go to the next page of this article), that it internally renders the frame at a resolution 4 times greater? But according to the 2nd page of this article, it says that at x4 AA it only internally renders a frame at a resolution 2 times greater.
  • 3 Hide
    JimmiG , April 13, 2011 7:23 AM
    Great article, but this is really something Nvidia and AMD will have to fix together with game developers...

    The settings I select in the driver control panel should apply without me having to worry about coverage samples, multi samples, DirectX versions or the alignment of the planets. It should just work.

    Similarly, any self-respecting game made in the last 6-8 years should have proper anti-aliasing options in its in-game menu. Not just an On/Off switch, but the full range of AA settings available with the video card being used.
  • -1 Hide
    BulkZerker , April 13, 2011 7:24 AM
    MrBonkBonkwhat are you talking about?we can still force Supersampling as of 266.58 on Nvidia cards



    IF the game lets it! Drivers trying to force AA doens't mean the game will allow it. If the game doesnt' support it your not goting to get tehy type of AA.

    Either way this AA fragmentation is almost as bad as all these custom versions of Driod.
  • 1 Hide
    Assmar , April 13, 2011 7:24 AM
    Maybe I'm wrong, but no Batman or Mass Effect 2 forced AA settings?
  • 2 Hide
    heycarnut , April 13, 2011 7:29 AM
    @army_ant7:

    Nvidia article is wrong, or at the very least semantically sloppy.

    4X samples generally means doubling of resolution for both axes. 4*(x*y)==(2*x)*(2*y).
  • 1 Hide
    army_ant7 , April 13, 2011 7:33 AM
    Quote:
    Nvidia article is wrong, or at the very least semantically sloppy.

    4X samples generally means doubling of resolution for both axes. 4*(x*y)==(2*x)*(2*y).


    Thanks for the reply heycarnut.

    With that it mind, what does 2X sampling multiply the axes by?
  • 0 Hide
    nileshd , April 13, 2011 7:43 AM
    if the game doesn't support anti aliasing, forcing through the driver may or may not work, but the point here is that nvidia drivers still do support supersampling as opposed to that mentioned in the article.
  • 0 Hide
    mattmock , April 13, 2011 9:25 AM
    Nvidia is currently offering a SSAA tool for download. Its a bit primitive and just sets SSAA for all games.
    http://nvidia.custhelp.com/cgi-bin/nvidia.cfg/php/enduser/std_adp.php?p_faqid=2624
  • 0 Hide
    tavix , April 13, 2011 10:48 AM
    Gr8 article. Thanks!
  • 0 Hide
    ghostie , April 13, 2011 11:11 AM
    Thanks for the great article Don.
  • 0 Hide
    rpgplayer , April 13, 2011 11:22 AM
    how about some benchmarks with the games that accepted forced driver settings? that way we can see if the in game setting is biased toward one card company. like left for dead 2, benchmarks of the ingame setting for 2x,4x,8x. then benchmarks of the driver setting 2x MSAA/SSAA, 4x MSAA/SSAA and so on. that way we can see if the game is being biased.
  • 0 Hide
    feeddagoat , April 13, 2011 1:17 PM
    Ive always wondered what was the difference between and what was better between application decided and driver based AA. In far cry 2 using my HD4870 The trees turned into green blobs using driver based AA but in game AA worked perfectly. Since then Ive just left the let the application decide box ticked and ignored Driver based. Can't wait for part 2 to see what gives the best result if it even works. Great work toms!!
  • 2 Hide
    warhammerkid , April 13, 2011 1:20 PM
    Nvidia Inspector (http://blog.orbmu2k.de/tools/nvidia-inspector-tool) is like the Nvidia control panel on steroids. It gives access to many more of the configuration options than the Nvidia control panel, like SSAA, several settings for transparency anti-aliasing, and a whole bunch of other advanced configuration options. I prefer it over nHancer (http://www.nhancer.com/), as I've had better luck with it in the past, but both should work. I'm somewhat surprised, though, that no one at Tom's Hardware actually used it to test out Nvidia SSAA, as I've had quite a lot of success with it.

    assmarMaybe I'm wrong, but no Batman or Mass Effect 2 forced AA settings?

    I used Nvidia Inspector on Mass Effect 1 and Mass Effect 2 to play the game with 2x2 SSAA (2x horizontal and 2x vertical), and it definitely works if you set it to force the game to use those settings. Forcing MSAA in those games didn't seem to work though, or if it did the effect wasn't noticeable enough to be worth it, not surprising considering some of the issues Unreal Engine games have with anti-aliasing. I didn't bother trying this with Batman because the built-in AA for the game looked fine.
  • 0 Hide
    WyomingKnott , April 13, 2011 2:01 PM
    I can see the benefit from AA in the examples, but doesn't it make things look fuzzy? I suppose it's a necessary trade-off for now.
  • 1 Hide
    cleeve , April 13, 2011 2:44 PM
    army_ant7Why does it say here, http://www.geforce.com/#/Optimize/Guides/AA-AF-guide (go to the next page of this article), that it internally renders the frame at a resolution 4 times greater? But according to the 2nd page of this article, it says that at x4 AA it only internally renders a frame at a resolution 2 times greater.


    Depends on how you frame it I guess: when the dimensions are doubled, the area is quadrupled.

    Twice the size is four times the samples: Like a 2"x2" grid contains four square inches, and twice the size is 4"x4" but it contains 16 square inches... four times as much area, but only twice the size when you look at the dimensions.

    army_ant7With that it mind, what does 2X sampling multiply the axes by?


    1.5 times? :p 

    It's probably easier to just think of the number as how many samples per pixel. 2xAA=2 samples per pixel, 4xAA=4 samples per pixel, etc...
Display more comments