I'm surely not the only one here who was having a hard time getting a hold of all the different types of anti-aliasing methods, what they mean and how they perform.
So it would be best to comprise this topic in all its glory into one thread.What is aliasing?
To better understand aliasing, shown below we see what would potentially be the edge of a rendered image, mountains if you will. Now we see that this surface is on a grid, with each section of the grid representing a pixel. Because we generally render on a per-polygon and per-pixel basis, we either color the pixel or we don 't. It becomes like binary, either 1 (on) or 0 (off).What is anti-aliasing?
Anti-aliasing (AA) is a computer graphics technique that attempts to minimise the unwanted 'staircase' or jagged object outlines which occur due to the limited resolution in 3D-Renderers, essentially by 'smoothing' these lines. Enabling this graphics feature will also increase the texture quality in some cases._______________
16x anti-aliasing_What kinds of anti-aliasing are there?
Basically, there are only three main methods of anti-aliasing: Supersampling
. Any other method is either a variation, combination or an application-specific method based on them.Supersample anti-aliasing (SSAA):
This is the type of AA that creates the best image quality. It is “pure” AA with no compromises. All the other AA technologies exist because SSAA is very slow.
SSAA works by first calculating more pixels than what the resolution is on the screen, and then averaging those pixels to determine the colors of the actual pixels on the screen. The ratio of calculated pixels to displayed pixels is often described by a number put before the acronym. For instance, 8xSSAA describes that each pixel on screen will be the avarage of 8 calculated pixels.
SSAA is slow because the pixel rendering stage of the rendering pipeline must do the same amount of work as if the screen resolution was many times the resolution of what it is. For instance, with a resolution of 1920x1080 and 8xSSAA (4x2), the hardware must calculate the same amount of pixels as if the resolution was 7680x2160.
We differ between the two mainly used methods of SSAA are Ordered Grid Supersampling (OGSSAA)
and Sparse Grid Supersampling (SGSSAA)
The sampling pattern of plain SSAA is called Regular Grid or Ordered Grid (OGSSAA). It can be pictured as a grid that has higher resolution than the pixel grid. Where OGSSAA samples in each square in that grid, SGSSAA samples in only some of the squares.
SGSSAA is the first in a series of AA types that represent a compromise designed to trade image quality for performance.
SGSSAA can be better or worse than OGSSAA depending on the game. In some games it can be blurry while OGSSAA isn't, and vice versa. It works by rendering multiple times to several offscreen intermediate buffers, each time it applies an offset to the sample coordinates in a different direction. Then it resolves (blends) the buffers post-processing.
Another method used is downsampling. This means that you manually create a custom resolution that is higher than what your screen is capable of, so it's virtually the same as OGSSAA, but works in every case, whereas OGSSAA may not. Therefor you experience the same kind of performance hit. So you should really only use this if no other anti-aliasing method works.Multisample anti-aliasing (MSAA):
For years now, MSAA has been the standard method for anti-aliasing, as it has a good balance between performance and image quality.
In a pixel pipeline, the final color of each pixel on the screen is determined by taking into account samples from Shader, Texture, Color, Depth and Stencil resources.
Of these, Shader samples are by far the most expensive (slow to calculate) because the source of these samples are calculations done in software by an arbitrarily complex program that runs on the graphics card, called a Shader. Texture samples are also somewhat expensive. So, while SSAA retrieves the same amount of samples from each resource, MSAA lessens the load on Shader and Texture resources by only retrieving a single Shader, Texture and Color sample for each pixel regardless of how many Depth and Stencil samples are retrieved for each pixel.
The result is that, compared to SSAA, MSAA runs much faster but it smoothes only the edges of polygons. It does not help for the internal areas of polygons as those are based on samples from Shaders and Textures.
Also, you can combine multi- with supersampling, forming Hybrid Sampling Anti-Aliasing (HSAA). This is essentially just MSAA + OGSSAA (using a shader instead of fixed function) + automatic lod bias adjustment. The result is the perfect balance of image quality and performance. Of course since it has an SSAA component it can cause blurring.Post-processing anti-aliasing:
Instead of actively recalculating the image with pure hardware power, "PPAA" can be understood to be more of a software-based smoothing/softening filter. Very simply speaking, you could compare it to a digital camera: Instead of concentrating on the specs of the camera to process the image, you add a filter in front of the lens. There are many different post-processing AA techniques out there, for example from Morphological Anti-Aliasing (MLAA), Fast Approximate Anti-Aliasing (FXAA), over the increasingly popular Subpixel Morphological Antialiasing (SMAA) to up and coming Subpixel Reconstruction Antialiasing (SRAA)... PPAA methods are shader based programs that can be added to virtually any application. They are applied to the already rendered image and therefor have hardly any performance hit, but at the cost of image quality, as these methods tend to make the image blurry and may decrease contrast.
Whereas more and more games offer post-processing AA as an alternative in their menus, graphic cards companies nVidia (FXAA) and AMD (MLAA) have their own technologies. Next to these "official" implementations, there are also AA injection mods available, such as "Inject FXAA" and "SweetFX", which offer a wide array of tweaks.Transparency anti-aliasing:
TrAA describes AA types such as Transparency Multi-sampling Anti-aliasing (TMSAA) and Transparency Super-sampling Anti-aliasing (TSSAA) that are designed to handle flat pictures with see-through areas (Billboards, Decals or Point Sprites in 3D graphics lingo) differently from real 3D models.
In a 3D scene, there are two main ways of displaying items that have see-through areas, such as a tree. If the tree must appear real from all angles, a 3D model is used. But if the tree is seen from only one angle or from far away, one may be able to get away with displaying just a flat picture of a tree in that location, thereby rendering the scene faster. TrAA applies to such flat pictures.
TrAA exists because flat pictures are not handled well by MSAA. This is because flat pictures do not have any geometry associated with them and AA methods other than SSAA derive most of their samples from geometry.
TMSAA: Allows MSAA to eliminate aliasing on transparent textures for a minimal performance hit. Performance hit at a given number of samples is constant regardless of the amount of the screen covered by transparent textures. Works by adding an alpha test to MSAA. So effectively it's as if MSAA thinks that transparent texture edges are geometry edges.
TSSAA: Huge performance hit. Performance hit depends on the number of pixels covered by transparent textures and the number of samples you use. May cause transparent textures to become blurry. Can be less effective then TMSAA sometimes. This works by rendering to multiple offscreen buffers in passes. If the alpha test fails it runs the pixel shader once for each buffer. If the alpha test passes it runs the pixel shader once and fills the same slot in all of the buffers with that color. The buffers are resolved the same way SGSSAA is. This is because SGSSAA is just a hack that causes the alpha test to always fail and therefore apply SSAA to all pixels.Variations:CSAA and EQAA
Next to the standard MSAA, nVidia and AMD have developed techniques to increase the coverage samples. nVidia's is Coverage Sampling Anti-aliasing (CSAA) and AMD uses Enhanced Quality Anti-Aliasing (EQAA), respectively.
Increasing the number of coverage sampes per stored color sample significantly improves the accuracy of AA with a very minimal performance hit. MSAA normally has 1 coverage sample per depth/stencil/stored color samples, CSAA/EQAA is just increasing the number of coverage samples so it's not like it's a totally different form of AA, just an enhancement._CFAA
AMD has introduced a new technique called Custom Filter Anti-Aliasing (CFAA). It is a programmable method that gathers samples not only from within the pixel, but even from outside the pixel edge. This means that samples can be taken within a circular radius of the pixel, unrestricted by pixel boundaries, with the influence of the sample further weighted by its distance from the center of the pixel. On release, AMD offered three CFAA filter options: narrow tent, wide tent, and edge-detect._TXAA
nVidia's latest coup is Temporal Approximate Anti-Aliasing. TXAA is based on hardware multi-sampling, a high quality sample to pixel filter, and temporal super-sampling (which is optional but provides a 2x quality improvement). So in a nutshell, TXAA is a wide tent (>1px) MSAA filter combined with a temporal filter. Although nVidia is currently keeping the exact detail under wraps, this sounds like a similar technique as CFAA.
TXAA is designed to produce as soft an image as possibly, which might make things too blurry in some cases; the point is to get a movie-like look instead of a realtime-CGI look. The 'T' means it's a temporal filter, which means it's designed to fix the case where you notice a jagged edge 'crawl' along an edges as the camera slowly moves -- it does this by greatly smoothing out almost-horizontal/vertical lines.
It's also a resizing filter, so you can render at a low, pixelated resolution, then upscale to full HD without introducing 'jaggies' (or render at higher resolution and downsample for extreme quality).
In motion, TXAA approaches the quality of other high end, professional anti-aliasing algorithms, though the higher quality filtering used by TXAA does result in a softer image compared to the lower quality filtering of traditional MSAA.
Because TXAA requires MSAA support and motion vector tracking by the game itself, it can only be used in games that specifically implement it. As a result of that, there are not very many comparison images yet, so here's nVidia's official one:Common AA modes in detailImage comparison chart of various AA methods
(click to zoom)Benchmarks_SamplesCSAA DX10 Sample
(from nVidia)FXAA DX11 Sample
(from nVidia)MLAA DX10 Demo
(from Jorge Jimenez)SMAA DX10 Demo
(from Jorge Jimenez)GuidesHow To: Anti-Aliasing Injection (FXAA, SMAA and SweetFX)HOWTO: Downsampling (custom res. 2100 x 1314 - 3840 x 2400) in DX9 / DX10 / DX11 with NVidia...Additional DownloadsNVIDIA InspectorRadeonPro
Changes, additions and suggestions are welcome! Changelog (Click to show)
November 26th 2012:
Sources (Click to show)
-Moved images to OCN
-Added CFAA info
-Added TXAA info
-Added image comparison chart