Multisampling Anti-Aliasing: A Closeup View
Today, we'd like to pick apart a rather special topic: multisampling anti-aliasing. The basics were touched upon in an older article (that hasn't been translated yet). Today we'll get to the bottom of it.
We'll quickly run through some prerequisite information, but won't go into too much detail there. We hope that the article is still comprehensible.
This topic is by no means just theory, it's implemented in actual, purchasable hardware. First we examine the multisampling procedures used by GeForce3, 4 Ti and FX, later we'll look at the multisampling of the Radeon line (Radeon 9500 or higher).
On virtually all modern cards anti-aliasing is performed via multisampling. Thus this method must have certain advantages and analysing these makes up a big part of this article. But nothing comes for free, and the disadvantages which might not be initially obvious, are disussed as well.
The raster-process: How geometry turns into graphics
The first thing a graphics card does when it receives a triangle, which is located in a virtual space, is projecting it onto the screen surface. Hence this triangle only posesses 2D-coordinates now, X and Y. (the Z coordinate for depth is still saved alongside, though).
Now the triangle setup determines in which lines the triangle is located, by checking all three vertices. Then it iterates through the lines covered by the triangle from smallest Y through largest Y. Since the X values of the vertices are still known, it can be determined for each line, at which X value the triangle begins and ends.
The chosen illustration should just give a general overview about the raster process, which we need because multisampling is based on it. We do not take into account any decoupling of triangle setup and piplines, which was introduced in conjunction with early Z at the latest.
Example: A triangle covers 4 lines.
By initialising the texture stages, the pipline "knows" which textures have to be applied on the triangle. Now with every vertex of the triangle a texture coordinate for every texture is passed on. The pipeline samples the right point from the texture for this pixel by adjusting these coordinates accordingly; first line-by-line, then pixel-by-pixel. With that goes a perspective correction, because a linear interpolation of the texture coordinates along two axes isn't sufficient. But supposedly modern graphics cards have a special algorithm, which calculates the perpectively corrected texture coordinate directly from the pixel coordinates within the triangle. The Z values are processed as well, so that also depth is known per pixel.
Now all the data required for texturing the pixel is available. The TMU of the pipeline gets the (perspectively corrected) texture coordinates and returns the texture sample. Depending on filter settings 4 or 8 texels are usually needed.
We only mentioned the points that are important for anti-aliasing, but rest assured, a future article will continue from this point, but now back on topic: Multisampling anti-aliasing.
That's how the rasterised triangle looks like: loss of information at the edges.
As the image above shows, inaccuracies are inevitable. This does not only concern the geometry, but also the texturing, as discussed later.
First about the edges: How can we overcome these inaccuracies?