Country:
 

Anti-aliasing and Anisotropic filtering demystified

hwi-h Articles » Anti-aliasing and Anisotropic filtering demystified

Anti-aliasing and Anisotropic filtering demystified Anti-aliasing and Anisotropic filtering demystified
Why should you use AF and AA in modern 3D games?

Full scene anti-aliasing

An image on a computer monitor is built up in pixels, small squares that can change colors. Although modern monitors are capable of very high resolutions, the individual pixels are still recognizable. Because we can see these individual pixel with the naked eye, this does have a negative effect in some applications. One of these is 3D games.

The best possible example of aliasing effects is a diagonal line on a computer screen; as this line will be built up in square pixels it will never be a smooth line, but it will have jagged edges (or "jaggies"). This effect is called aliasing, hence the term for the countering the effect is called anti-aliasing.

In the images shown below you can see a black line placed on a white background, the line below it is the same but we have apllied anti-aliasing to the second line. It is quite clear that the bottom line does look smoother, the zoomed image shows how the smoothing effect is done. As you can see the pixels in the smooth line are not all black or white, but the colors on the edges have been mixed with the color of the background. When a pixel is 50% part of the line and 50% of the background, AA turns the actual pixel into a 50% grey in stead of black, when a pixel would be 75% line and 25% background, the technique would turn the pixel into 75% grey. This way anti-aliasing, especially when the image is viewed from a distance, masks the fact that the screen is built up in pixels.

lineaa

Aliasing will be most visible when the object and backgorund colors are very different, like a black line on a white background. When the actual differences are not as obvious, i.e. a dark green object on a lighter green background, the aliasing effect will be a lot less obvious.

3D games will have the same problems with jaggies as in our example above. If an object, be it another player, a tree or a chair, is placed in front of a different colored background the aliasing effect will occur. The effect is worsened when playing 3D games; as the object moves, the jagged edges will move with it and become more apparent.

aaaf-sc-1-ati-0af aaaf-sc-1-ati-6af
A telephone pole in Splinter Cell: Chaos Theory, with and without anti-aliasing

Jaggies within a 3D game can be reduced by using anti-aliasing, the principle is quite simple; the image is rendered in a higher resolution, and then scaled back to the resolution used. The first generations of FSAA algorythms did work exactly like that, when you were playing at a resolution of 800x600, the image would be rendered to for instance 1600x1200 and then scaled back to the 800x600 resolution. Using this method would mean that a single pixel would be rendered into four, and when the actual image is produced on screen the single pixel would have the average of the colors rendered from the four pixels. This method is called supersampling.

Newer graphics cards use a different method, called multisampling. This method produces better results than supersampling; the image is not rendered in a higher resolution and then scaled back, but a scene will be processed by the GPU multiple times (x2, x4, etc) with a minute shift in the image. This way multiple color values will be rendered for each pixel, and the image produced on screen will be built up using the average value of the colors rendered.

Anti-aliasing also prevents another effect caused by aliasing. It is possible that an objecy in a game is that thin it only uses one pixel in width, which can lead to parts of that object not being shown in the scene at all. A good example of this effect is the antennas in scene 4 of 3DMark06.

aaaf-3dm06-2-ati-0aa
Very thin objects can dissapear partly or completely because of aliasing.

The more samples are being used to render each pixel, the better the end result will be. When you enable FSAA you can indicate how many samples the card should use. 2x FSAA will render two samples for every pixel, 4x four samples, etc. Modern graphics cards go up to as much as 6 samples or higher. Obviously the higher the value, the better the quality.

Advertisement

Related articles 3d chips

SlashdotPost to Slashdot Digg thisDigg this Add to del.icio.usAdd to del.icio.us

Hardware.Info in other countries: België - Nederland - United Kingdom - United States