Types of Aliasing

While all aliasing artifacts can be traced back to the sampling issue of representing a continuous signal on a fixed grid comprising a limited number of pixels, the details of how they are caused are highly relevant in determining which anti-aliasing techniques may effectively combat them. As later sections will show, some anti-aliasing methods may deal perfectly with simple geometry aliasing as illustrated in Figure 1, but fail entirely to remedy aliasing introduced by other rendering processes.

Therefore, to be able to fully discuss the relative strengths and weaknesses of anti-aliasing techniques, we have grouped aliasing artifacts as they occur in 3D rendering into 5 separate categories. This grouping depends on the exact circumstances of the generation of the artifacts. Figure 2 illustrates these types of aliasing on a real example rendered using OpenGL.

Figure 2: Various types of aliasing. The program used to generate this and similar images is available for download here. From top left to bottom right:
•A single screen-aligned rectangle with a partially transparent texture.
•A fan consisting of screen-aligned alternating white and black triangles.
•Multiple black lines of varying width, starting from 1 pixel at the top to 0.4 pixel at the bottom, and a white line of thickness 0.5 forming a sine wave.
•A cube consisting of 6 flat colored rectangles
•An inclined plane textured with a high-frequency grass texture.
•A screen-aligned rectangle with a pixel shader determining the color of each pixel based on a sinus function.

The most common type of aliasing, and the one detailed previously, is geometry aliasing. This artifact occurs when some scene primitive (usually a triangle) partially intersects a pixel, but this partial coverage is not taken into account by the rendering process.

Transparency aliasing, on the other hand, happens within textured primitives that are partially transparent. The upper left part of Figure 2 is rendered using a single rectangle, filled with a partially transparent texture that shows a chain-link fence. As that texture is itself simply a fixed grid of pixels, it needs to be sampled at the locations each pixel of the rendered image maps to, and for each such location a decision on whether or not it is transparent needs to be made. This results in the same sampling problem that also happens with solid geometry.

While it is in fact a type of geometry aliasing, sub-pixel aliasing requires special consideration as it introduces unique problems for analytical anti-aliasing methods, which have recently gained great popularity in game rendering and will be covered in detail later in this article. Sub-pixel aliasing happens when the structure being rasterized maps to less than a single pixel on the framebuffer grid. This is most often the case with narrow objects, such as spires, phone or electric lines, or even a sword if it is sufficiently far away from the camera.

Figure 3 illustrates sub-pixel aliasing on a simple scene consisting of two line segments. The upper line has a width of one pixel, and while it shows the familiar staircase artifact of geometry aliasing when rasterized, the output still matches the input in overall shape. The lower line, on the other hand, is half a pixel in width. As it is rasterized, some columns of pixels it crosses have not a single pixel centre within the extents of the line – as a consequence, it is split into several disconnected fragments. The same can be observed on the straight lines and sine curve in Figure 2.

Texture aliasing happens when a high-frequency texture is insufficiently sampled, especially in anisotropic sampling scenarios (these are cases where the surface is at a steep incline towards the screen). Usually, the artifacts produced by this form of aliasing are not apparent in still screenshots, but they manifest as flickering and instability of pixels in motion. Figure 4 shows this on a few frames of the example program in animation mode.

Figure 4:Animated high-frequency texture with flickering artifacts

Texture aliasing can usually be prevented by mip-mapping and high-quality texture filtering, but it is sometimes still an issue, particularly with some driver versions of popular GPUs under-sampling highly anisotropic textures. As it is also affected differently by various anti-aliasing methods, it is included in the demo program.

Finally, shader aliasing occurs when a pixel shader program, which is evaluated for each pixel to determine its colour, generates an aliased result. This often happens in games with shaders producing hard lighting, such as specular highlights based on a normal map or hard lighting techniques like cel shading or rim lighting. In the demo program, this is approximated by a simple shader that evaluates a sinus function on the texture coordinates, colouring all negative results black and all positive results white.