Multisample anti-aliasing

From Wikipedia, the free encyclopedia
Jump to: navigation, search

Multisample anti-aliasing (MSAA) is a type of anti-aliasing, a technique used in computer graphics to improve image quality.


The term generally refers to a special case of supersampling. Initial implementations of full-scene anti-aliasing (FSAA) worked conceptually by simply rendering a scene at a higher resolution, and then downsampling to a lower-resolution output. Most modern GPUs are capable of this form of antialiasing, but it greatly taxes resources such as texture, bandwidth, and fillrate. (If a program is highly TCL-bound or CPU-bound, supersampling can be used without much performance hit.)

According to the OpenGL GL_ARB_multisample specification,[1] "multisampling" refers to a specific optimization of supersampling. The specification dictates that the renderer evaluate the fragment program once per pixel, and only "truly" supersample the depth and stencil values. (This is not the same as supersampling but, by the OpenGL 1.5 specification,[2] the definition had been updated to include fully supersampling implementations as well.)

In graphics literature in general, "multisampling" refers to any special case of supersampling where some components of the final image are not fully supersampled. The lists below refer specifically to the ARB_multisample definition.


When a fragment is rendered with multisample anti-aliasing, if any of the multi sample locations in a pixel are covered by the triangle that created it, a shading computation must be performed for that triangle. Shading inputs (texture coordinates, etc) are interpolated from values stored at the triangle's vertices, usually using the pixel center as the sample point. If the pixel center is outside the triangle, shading inputs are extrapolated. Extrapolation can be avoided by using centroid sampling, where the shading inputs are sampled at the covered multisample location nearest to the pixel center, but may result in non-uniform screen space sampling near edges.[3]


  • The pixel shader usually only needs to be evaluated once per pixel.
  • The edges of polygons (the most obvious source of aliasing in 3D graphics) are antialiased.


Alpha testing[edit]

Alpha testing is a technique common to older video games used to render translucent objects by rejecting pixels from being written to the framebuffer.[4] If the alpha value of a translucent fragment is not within a specified range, it will be discarded after alpha testing. Because this is performed on a pixel by pixel basis, the image does not receive the benefits of multi-sampling (all of the multisamples in a pixel are discarded based on the alpha test) for these pixels. The resulting image may contain aliasing along the edges of transparent objects or edges within textures, although the image quality will be no worse than it would be without any anti-aliasing.[5] Translucent objects that are modelled using alpha-test textures will also be aliased due to alpha testing. This effect can be minimized by rendering objects with transparent textures multiple times, although this would result in a high performance reduction for scenes containing many transparent objects.[6]


Because multi-sampling calculates textures only once per pixel, aliasing and other artifacts will still be visible inside rendered polygons where fragment shader output contains high frequency components

Sampling methods[edit]

Point sampling[edit]

In a point sampled mask, the coverage bit for each multisample is only set if the multisample location is located inside the rendered primitive. Samples are never taken from outside a rendered primitive, so images produced using point-sampling will be geometrically correct, but filtering quality may be low because the proportion of bits set in the pixel’s coverage mask may not be equal to the proportion of the pixel that is actually covered by the fragment in question.

Area sampling[edit]

Filtering quality can be improved by using area sampled masks. In this method, the number of bits set in a coverage mask for a pixel should be proportionate to the actual area coverage of the fragment. This will result in some coverage bits being set for multisamples that are not actually located within the rendered primitive, and can cause aliasing and other artifacts.

Sample patterns[edit]

Regular grid[edit]

A regular grid sample pattern, where multisample locations form an evenly spaced grid throughout the pixel, is easy to implement and simplifies attribute evaluation (i.e. setting subpixel masks, sampling color and depth). This method is computationally expensive due to the large number of samples. Edge optimization is poor for screen-aligned edges, but image quality is good when the number of multisamples is large.

Sparse regular grid[edit]

A sparse regular grid sample pattern is a subset of samples that are chosen from the regular grid sample pattern. As with the regular grid, attribute evaluation is simplified due to regular spacing. The method is less computationally expensive due to having a fewer samples. Edge optimization is good for screen aligned edges, and image quality is good for a moderate number of multisamples.

Stochastic sample patterns[edit]

A stochastic sample pattern is a random distribution of multisamples throughout the pixel. The irregular spacing of samples makes attribute evaluation complicated. The method is cost efficient due to low sample count (compared to regular grid patterns). Edge optimization with this method, although sub-optimal for screen aligned edges. Image quality is excellent for a moderate number of samples.


Compared to supersampling, multisample anti-aliasing can provide similar quality at higher performance, or better quality for the same performance. Further improved results can be achieved by using rotated grid subpixel masks. The additional bandwidth required by multi-sampling is reasonably low if Z and colour compression are available.[7]

There are 2x, 4x, 8x, and 16x MSAA. Higher results in better quality but can be slower.

See also[edit]


  1. ^ ARB_multisample "Additions to Chapter 3 of the 1.2.1 specification". 
  2. ^ "F.3". OpenGL 1.5 specification. 
  3. ^ The OpenGL Pipeline Newsletter 003. Archived from the original on 2008-03-13. 
  4. ^ "ShaderLab syntax: Alpha testing". 2008-04-27. Retrieved 2012-07-31. 
  5. ^ "Multisampling Anti-Aliasing: A Closeup View". Retrieved 2012-07-31. 
  6. ^ "Visual comparison of the various Anti-Aliasing modes". Retrieved 2012-07-31. 
  7. ^ "Multisampling Anti-Aliasing: A Closeup View". Retrieved 2012-07-31.