Multisample Anti-Aliasing
Encyclopedia
Multisample anti-aliasing (MSAA) is a type of anti-aliasing
, a technique used in computer graphics
to improve image quality.
. 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 game is highly TCL-bound or CPU
-bound, supersampling can be used without much performance hit.)
According to the OpenGL
GL_ARB_multisample specification, "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, 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.
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 triangles vertices using the pixel center as the interpolating and sampling 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.
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.
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.
Anti-aliasing
In digital signal processing, spatial anti-aliasing is the technique of minimizing the distortion artifacts known as aliasing when representing a high-resolution image at a lower resolution...
, a technique used in computer graphics
Computer graphics
Computer graphics are graphics created using computers and, more generally, the representation and manipulation of image data by a computer with help from specialized software and hardware....
to improve image quality.
Definition
The term generally refers to a special case of supersamplingSupersampling
Supersampling is an antialiasing technique, the process of eliminating jagged and pixelated edges . It is a method of smoothing images rendered in computer games or other programs that generate imagery.-Overview:...
. 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
Graphics processing unit
A graphics processing unit or GPU is a specialized circuit designed to rapidly manipulate and alter memory in such a way so as to accelerate the building of images in a frame buffer intended for output to a display...
are capable of this form of antialiasing, but it greatly taxes resources such as texture bandwidth and fillrate
Fillrate
The term fillrate usually refers to the number of pixels a video card can render and write to video memory in a second. In this case, fillrates are given in megapixels per second or in gigapixels per second , and they are obtained by multiplying the number of raster operations by the clock...
. (If a game is highly TCL-bound or CPU
Central processing unit
The central processing unit is the portion of a computer system that carries out the instructions of a computer program, to perform the basic arithmetical, logical, and input/output operations of the system. The CPU plays a role somewhat analogous to the brain in the computer. The term has been in...
-bound, supersampling can be used without much performance hit.)
According to the OpenGL
OpenGL
OpenGL is a standard specification defining a cross-language, cross-platform API for writing applications that produce 2D and 3D computer graphics. The interface consists of over 250 different function calls which can be used to draw complex three-dimensional scenes from simple primitives. OpenGL...
GL_ARB_multisample specification, "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
Stencil buffer
A stencil buffer is an extra buffer, in addition to the color buffer and depth buffer found on modern computer graphics hardware. The buffer is per pixel, and works on integer values, usually with a depth of one byte per pixel...
values. (This is not the same as supersampling, but by the OpenGL
OpenGL
OpenGL is a standard specification defining a cross-language, cross-platform API for writing applications that produce 2D and 3D computer graphics. The interface consists of over 250 different function calls which can be used to draw complex three-dimensional scenes from simple primitives. OpenGL...
1.5 specification, 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.
Description
When a fragmentFragment (computer graphics)
In computer graphics, a fragment is the data necessary to generate a single pixel's worth of a drawing primitive in the frame buffer.This data may include, but is not limited to:* raster position* depth...
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 triangles vertices using the pixel center as the interpolating and sampling 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.
Advantages
- The pixel shader usually only needs to be evaluated once per pixel.
- The edges of polygons (the most obvious source of aliasingAliasingIn signal processing and related disciplines, aliasing refers to an effect that causes different signals to become indistinguishable when sampled...
in 3D graphics) are antialiased.
Alpha testing
Alpha testing is a technique common to older video games used to render translucent objects by rejecting pixels from being written to the framebufferIf 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.
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.