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.
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:
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.
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.
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].
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.htmlIf 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:
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):
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:
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.
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])
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].
A few screenshots that compare SMAA with other antialiasing techniques:
(source)
[9]
(
source
[10])
(
source
[11])
A video comparison using Crysis 2/CryEngine 3, that implemented it for the first time (Youtube):
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):
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.
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.