The Nature of Aliasing

"It is said that if you know your enemies and know yourself, you will not be imperilled in a hundred battles"

As Sun Tzu teaches us, to defeat an enemy we first need to understand it. The enemy—forgive the dramatization – of anti-aliasing techniques are aliasing artifacts. Thus, our first order of business is understanding how and why aliasing happens.

The term aliasing was first introduced in signal processing, where it originally described an effect that occurs when different continuous signals become indistinguishable (or aliases of one another) upon sampling. In 3D rendering, the term usually takes on a more specific meaning: it refers to the range of undesirable artifacts that may occur when a 3D scene is rendered to be displayed on a screen consisting of a fixed grid of pixels.

In this case, the 3D scene is the continuous signal, and the process of generating colour values for each pixel samples this signal in order to generate a rendering output. The goal of anti-aliasing methods is to make this output resemble the scene as closely as possible on the given grid of pixels, while minimizing visually distracting artifacts.

Figure 1 illustrates aliasing on a simple scene consisting of a single white triangle on a black background. During the rasterization step of normal rendering, the centre position of each pixel is sampled: if it is within the triangle, the pixel will be coloured white, otherwise it is coloured black. This results in a pronounced "staircase" effect, one of the most commonly recognized aliasing artifacts.

Perfect anti-aliasing would involve determining for each pixel how much of its area is covered by the triangle. If the pixel is covered by 50%, then it should be filled with a colour 50% between white and black (a medium grey). If it covered by less, it should be proportionally darker – and conversely, if a larger area is covered, it should be proportionally lighter. A fully covered pixel is white and one that is not covered at all is black. The result of this process is illustrated in the fourth image. However, performing this calculation is infeasible for real-time graphics in the general case.

Figure 1: Basic Aliasing