share
ArqadeWhat are the differences between the different anti-aliasing / multisampling settings?
[+112] [5] DMA57361
[2011-10-06 20:05:58]
[ graphics-card ]
[ https://gaming.stackexchange.com/questions/31801/what-are-the-differences-between-the-different-anti-aliasing-multisampling-set ]

I'm tweaking the settings in DiRT 2 and I'm presented with these choices (in order) for multisampling:

Using the nVidia Control panel I'm presented with

I assume those without text on the nVidia panel are probably MSAA.

The naive guess would be bigger numbers are visually better. But then MSAA, CSAA and QCSAA come in to play (presumably different methods of performing AA) and confuse matters by not being in the right order.

For example is 8x / 8x MSAA "better" than 8x CSAA somehow? Otherwise why would it be further down the list on the nVidia panel? And is 8x QCSAA "better" than 16xCSAA as per the order in DiRT2?

In terms of image quality, performance and any other quirks, what are the differences between the various types of AA?
I'm not asking about the algorithmic/implimentation differences; that's probably off-topic anyway.

[+76] [2011-10-07 05:24:52] Jeff Atwood [ACCEPTED]

This is a great question because other than "is AA on or off?" I hadn't considered the performance implications of all the various anti-aliasing modes.

There's a good basic description of the three "main" AA modes at So Many AA Techniques, So Little Time [1], but pretty much all AA these days is MSAA or some tweaky optimized version of it:

  1. Super-Sampled Anti-Aliasing (SSAA). The oldest trick in the book - I list it as universal because you can use it pretty much anywhere: forward or deferred rendering, it also anti-aliases alpha cutouts, and it gives you better texture sampling at high anisotropy too. Basically, you render the image at a higher resolution and down-sample with a filter when done. Sharp edges become anti-aliased as they are down-sized. Of course, there's a reason why people don't use SSAA: it costs a fortune. Whatever your fill rate bill, it's 4x for even minimal SSAA.

  2. Multi-Sampled Anti-Aliasing (MSAA). This is what you typically have in hardware on a modern graphics card. The graphics card renders to a surface that is larger than the final image, but in shading each "cluster" of samples (that will end up in a single pixel on the final screen) the pixel shader is run only once. We save a ton of fill rate, but we still burn memory bandwidth. This technique does not anti-alias any effects coming out of the shader, because the shader runs at 1x, so alpha cutouts are jagged. This is the most common way to run a forward-rendering game. MSAA does not work for a deferred renderer because lighting decisions are made after the MSAA is "resolved" (down-sized) to its final image size.

  3. Coverage Sample Anti-Aliasing (CSAA). A further optimization on MSAA from NVidia [ed: ATI has an equivalent]. Besides running the shader at 1x and the framebuffer at 4x, the GPU's rasterizer is run at 16x. So while the depth buffer produces better anti-aliasing, the intermediate shades of blending produced are even better.

This Anandtech article [2] has a good comparison of AA modes in relatively recent video cards that show the performance cost of each mode for ATI and NVIDIA (this is at 1920x1200):

                       ---MSAA---   --AMSAA---    ---SSAA---
                 none  2x  4x  8x   2x  4x  8x    2x  4x  8x
                 ----  ----------   ----------    ----------
ATI 5870           53  45  43  34   44  41  37    38  28  16
NVIDIA GTX 280     35  30  27  22   29  28  25

So basically, you can expect a performance loss of..

  • no AA → 2x AA

    ~15% slower

  • no AA → 4x AA

    ~25% slower

There is indeed a visible quality difference between zero, 2x, 4x and 8x antialiasing. And the tweaked MSAA variants, aka "adaptive" or "coverage sample" offer better quality at more or less the same performance level. Additional samples per pixel = higher quality anti-aliasing [3].

Graphic comparing AA and MSAA sampling of a pixel

Comparing the different modes on each card, where "mode" is number of samples used to generate each pixel.

Mode   NVIDIA   AMD
--------------------
2+0    2x       2x
2+2    N/A      2xEQ
4+0    4x       4x
4+4    8x       4xEQ
4+12   16x      N/A
8+0    8xQ      8x
8+8    16xQ     8xEQ
8+24   32x      N/A

In my opinion, beyond 8x AA, you'd have to have the eyes of an eagle on crack to see the difference. There is definitely some advantage to having "cheap" 2x and 4x AA modes that can reasonably approximate 8x without the performance hit, though. That's the sweet spot for performance and a visual quality increase you'd notice.

[1] http://hacksoflife.blogspot.com/2011/04/so-many-aa-techniques-so-little-time.html
[2] http://www.xbitlabs.com/articles/graphics/display/ati-radeon-hd4850_19.html
[3] http://www.anandtech.com/show/4061/amds-radeon-hd-6970-radeon-hd-6950/10

Great answer, but I disagree with the last paragraph. e.g. Both 8x CSAA and 16x CSAA are noticeably more jaggy than 8x MSAA in nVidia's control panel (3D settings preview area.) IMO, it takes 16xQ CSAA to reasonably approximate 8x MSAA. - Rob
1
[+74] [2011-10-06 21:19:10] Aubergine

If you prune through this article [1] you will probably be able to gather most of the information you seek, but I'll try and summarize the relevant bits.

First, you should understand that MSAA is a type of Supersampling [2] anti-aliasing (SSAA). SSAA, also known as FSAA, removes "jags" from an image by rendering the image at a higher resolution:

Full-scene anti-aliasing by supersampling usually means that each full frame is rendered at double (2x) or quadruple (4x) the display resolution, and then down-sampled to match the display resolution. So a 2x FSAA would render 4 supersampled pixels for each single pixel of each frame. While rendering at larger resolutions will produce better results, more processor power is needed which can degrade performance and frame rate.

MSAA is a more efficient form of FSAA, but the multiplier still has the same meaning, roughly. This means (as you probably know), that a higher multiplier gives better results, but demands more processing power.

CSAA is an even more efficient form of SSAA, which uses some advanced 3D magic (just read the paper if you really must know) to deliver better results:

In summary, CSAA produces antialiased images that rival the quality of 8x or 16x MSAA, while introducing only a minimal performance hit over standard (typically 4x) MSAA.

In essence, if you equate your multipliers, MSAA will produce better results than CSAA (though it is implied that the results will not be significantly better), but will demand significantly more on the processing power department.

QCSAA is simply CSAA with twice as many sample points used to perform the anti-aliasing, so obviously QCSAA is better than CSAA.

Wikipedia's Supersampling article actually provides a great image showing why more samples mean better accuracy:

Multiple samples

All this being said, the order in which DiRT2 lists its anti-aliasing options looks perplexing, to say the least. Since I doubt you can personally tell the difference once the multiplier hits 8x and upwards, I'd stick to CSAA/QCSAA for the performance gain.

Finally, here is a nice comparison shot of the various techniques on a specific, simple, image (from the article in the first link):

Anti-aliasing results

[1] http://developer.nvidia.com/csaa-coverage-sampling-antialiasing
[2] http://en.wikipedia.org/wiki/Supersampling

Excellent answer! If you are a developer, @Aubergine, be sure to check out the game development stack exchange as well :) - BlueRaja - Danny Pflughoeft
Thanks, @BlueRaja-DannyPflughoeft! I appreciate the appreciation ;) - Aubergine
Does using CSAA require hardware support? Or should any card that supports MSAA in general be able to use the setting? - Jeff Mercado
(1) @JeffMercado: CSAA is something only NVidia's cards do. AMD have an equivalent called EQAA. See here. - Aubergine
This is a great answer! - TrewTzu
@TrewTzu: Much obliged. - Aubergine
Very detailed~~ - XiaJun
2
[+14] [2013-04-22 12:39:23] Athari

NVIDIA has created another algorithm, FXAA (Fast Approximate Anti-Aliasing) [1]. Unlike currently used MSAA, CSAA and their variations, it works on a pixel level, never touching geometry. It finds jagged edges and smoothes them. It is faster than the rest. Like FSAA, it has no problems with alpha channels, shaders etc. However, the results are more blurry.

I see two uses for FXAA: first, if you want AA, but the penalty of MSAA/CSAA is too high for your hardware; second, if a game heavily relies on alpha and shaders and your hardware is not godly enough for FSAA.

Aliased, 4xMSAA, FXAA:

FXAA Comparison

[1] http://en.wikipedia.org/wiki/Fast_approximate_anti-aliasing

3
[+4] [2019-02-25 15:42:20] Joachim

In addition to the excellent answers already here, I'd like to mention the relatively new SMAA, or " Subpixel Morphological Antialiasing [1]", which is, like FXAA, a post-process antialiasing method. In many cases it outperforms other AA methods in terms of the image quality/cost ratio.


WHAT IS SMAA?

In the words of the developers Jorge Jimenez, Jose I. Echevarria, and Diego Gutierrez from the Universidad de Zaragoza, and Tiago Sousa from Crytek,

SMAA is a very efficient GPU-based MLAA implementation, capable of handling subpixel features seamlessly, and featuring an advanced pattern detection & handling mechanism. ( source [2])

Or, more extensively (with my emphases):

We present a new image-based, post-processing antialiasing technique, which offers practical solutions to the common, open problems of existing filter-based real-time antialiasing algorithms. Some of the new features include local contrast analysis for more reliable edge detection, and a simple and effective way to handle sharp geometric features and diagonal lines. This, along with our accelerated and accurate pattern classification allows for a better reconstruction of silhouettes. Our method shows for the first time how to combine morphological antialiasing (MLAA) with additional multi/supersampling strategies (MSAA, SSAA) for accurate subpixel features, and how to couple it with temporal reprojection; always preserving the sharpness of the image. All these solutions combine synergies making for a very robust technique, yielding results of better overall quality than previous approaches while more closely converging to MSAA/SSAA references but maintaining extremely fast execution times. Additionally, we propose different presets to better fit the available resources or particular needs of each scenario. ( source [3])


HOW DOES IT WORK?

SMAA is based on MLAA and FXAA:

MLAA (Morphological AA) and FXAA (Fast Aproximate AA) are post AA modes that use blur filters. First, they detect contrasts ("edges") in the frame and then blur it along the gradient.

This results in highly reduced visible "jaggies" that also covers alpha-textures, but it also blurs everything, including textures. It is also the cheapest form of AA and often used in console version of games.

The detection of edges of SMAA, however, is comparable to that of SSAA:

The alisasing "detection" is upgraded and is closer to the detection used in MSAA then the detection used in MLAA and FXAA. The result is that SMAA still remains very cheap, still smoothes alpha-tectures and still greatly reduces the visible "jaggies", but doesnt blur the image as much. ( source [4])

This post [5] by SomeoneSimple on the Anandtech forums explains briefly what SMAA does, and how it can work in conjunction with MSAA:

SMAA Injector on its default 'SMAA_PRESET_HIGH' is just a bit more GPU-intensive then plain FXAA, so performance loss is pretty negligible in most cases.

SMAA doesn't compare to MSAA though. MSAA actually adds (subpixel-)detail to smooth polygon edges, SMAA only tries to hide jaggies (but does a good job doing so). Most noticeably, you'll still have pixel-crawling/flickering with SMAA.

However, SMAA does support being used in combination with MSAA. That's the 'subpixel' part of its name, unlike any other post-process AA filter (i know of), it can correctly detect gradients, thus it can be used in conjunction with other forms of non-PP AA, like MSAA and SSAA.

That said, I'm currently using 1.2x OGSSAA (NV custom resolution override) with SMAA injected, in games that don't play nice with MSAA. SMAA takes care of anti-aliasing, and SSAA greatly lessens the amount of pixel-crawling. It looks gorgeous, far better than only 1.2x OGSSAA or SMAA on its own.

I will not go into further detail here, as the other answers have already provided background information on the mechanism of different AA techniques. You can read more about this specific method in their paper [6] (PDF); or by leafing through their slideshow presentation [7] (direct link); or look into the code on GitHub [8].


COMPARISON WITH SEVERAL OTHER AA TECHNIQUES

A few screenshots that compare SMAA with other antialiasing techniques:

                  Call of Duty comparison

                  Elite: Dangerous comparison

                  Far Cry 4 comparison
(source) [9]

                  Watch_Dogs 2 comparison
( source [10])

Guild Wars 2 (?) comparison
( source [11])

A video comparison using Crysis 2/CryEngine 3, that implemented it for the first time (Youtube):

                  IMAGE ALT TEXT HERE

Here [12] is a direct link to the original video, unspoiled by compression.

And the following is a comparison with some MLAA, SRAA and FXAA methods (sourced from the paper linked above):

Table comparing techniques and cost of different AA methods


IMPLEMENTATION

A version of SMAA, made injectable by Andrej Dudenhefner, can be downloaded here [13], and injected into many DirectX 9/10/11 (x86) applications.
This article [14] describes how to do so in Fallout: New Vegas, but this method is very similar in most Bethesda games. It also provides some more information comparing and illustrating the different AA techniques.

[1] http://www.iryoku.com/smaa/
[2] https://github.com/iryoku/smaa
[3] http://www.iryoku.com/smaa/
[4] https://www.reddit.com/r/Games/comments/1rb964/antialiasing_modes_explained/
[5] https://forums.anandtech.com/threads/mrhaandis-injectsmaa.2266859/post-33892366
[6] http://www.iryoku.com/smaa/downloads/SMAA-Enhanced-Subpixel-Morphological-Antialiasing.pdf
[7] http://www.iryoku.com/smaa/downloads/SMAA-Enhanced-Subpixel-Morphological-Antialiasing.pptx
[8] https://github.com/iryoku/smaa
[9] https://pcgamingwiki.com/wiki/Glossary:Anti-aliasing_(AA)
[10] https://forums.anandtech.com/threads/mrhaandis-injectsmaa.2266859/
[11] https://www.reddit.com/r/watch_dogs/comments/5fq68m/visual_comparison_of_antialiasing_methods_gtx_1070/
[12] http://www.iryoku.com/smaa/downloads/SMAA-Enhanced-Subpixel-Morphological-Antialiasing.mp4
[13] http://mrhaandi.blogspot.com/p/injectsmaa.html
[14] https://delightlylinux.wordpress.com/2014/02/17/sweetfx-smaa/

For some reason, I cannot reach iryoku.com, where most of the sources presented here can be found (it doesn't seem to be down, however). In any case, the paper is also accessible here. Sadly, I haven't been able to find an uncompressed version of the video. - Joachim
4
[0] [2019-02-24 23:31:02] Uğur Gümüşhan

msaa is the slowest and is generally better looking than csaa equivalent. 8x msaa is the best quality, but the most expensive. csaa is nvidia's alternative solution, which works more efficiently. but 8x msaa really looks good.


5