Multisample Anti-Aliasing
Encyclopedia
Multisample anti-aliasing (MSAA) is a type of anti-aliasing
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 supersampling
Supersampling
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 fragment
Fragment (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 aliasing
    Aliasing
    In 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 framebuffer
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.

Aliasing

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.

Point Sampling

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

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.

Regular grid

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

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 number of samples. Edge optimization is good for screen aligned edges, and image quality is good for a moderate number of multisamples.

Stochastic sample patterns

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.

Quality

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.
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK