Aliasing

Figure 7.10: (a) The rasterization stage results in aliasing; straight edges appear to be staircases. (b) Pixels are selected for inclusion based on whether their center point $ p$ lies inside of the triangle.
\begin{figure}\begin{center}
\begin{tabular}{cc}
\psfig{file=figs/barycentric2.e...
...er.eps,width=2.7truein} \\
(a) & (b) \\
\end{tabular}\end{center}
\end{figure}

Several artifacts arise due to discretization. Aliasing problems were mentioned in Section 5.4, which result in perceptible staircases in the place of straight lines, due to insufficient pixel density. Figure 7.10(a) shows the pixels selected inside of a small triangle by using (7.9). The point $ p$ usually corresponds to the center of the pixel, as shown in Figure 7.10(b). Note that the point may be inside of the triangle while the entire pixel is not. Likewise, part of the pixel might be inside of the triangle while the center is not. You may notice that Figure 7.10 is not entirely accurate due to the subpixel mosaics used in displays (recall Figure 5.22). To be more precise, aliasing analysis should take this into account as well.

By deciding to fully include or exclude the triangle based on the coordinates of $ p$ alone, the staircasing effect is unavoidable. A better way is to render the pixel according to the fraction of the pixel region that is covered by the triangle. This way its values could be blended from multiple triangles that are visible within the pixel region. Unfortunately, this requires supersampling, which means casting rays at a much higher density than the pixel density so that the triangle coverage fraction can be estimated. This dramatically increases cost. Commonly, a compromise is reached in a method called multisample anti-aliasing (or MSAA), in which only some values are calculated at the higher density. Typically, depth values are calculated for each sample, but shading is not.

Figure 7.11: A mipmap stores the texture at multiple resolutions so that it can be appropriately scaled without causing signficant aliasing. The overhead for storing the extra image is typically only $ 1/3$ the size of the original (largest) image. (The image is from NASA and the mipmap was created by Wikipedia user Mulad.)
\begin{figure}\centerline{\psfig{file=figs/mipmap.ps,width=4.0truein}}\end{figure}

Figure 7.12: (a) Due to the perspective transformation, the tiled texture suffers from spatial aliasing as the depth increases. (b) The problem can be fixed by performing supersampling.
\begin{figure}\begin{center}
\begin{tabular}{cc}
\psfig{file=figs/badtexture1.ps...
...re2.ps,width=2.7truein} \\
(a) & (b) \\
\end{tabular}\end{center}
\end{figure}

A spatial aliasing problem results from texture mapping. The viewing transformation may dramatically reduce the size and aspect ratio of the original texture as it is mapped from the virtual world onto the screen. This may leave insufficient resolution to properly represent a repeating pattern in the texture; see Figure 7.12. This problem is often addressed in practice by pre-calculating and storing a mipmap for each texture; see Figure 7.11. The texture is calculated at various resolutions by performing high-density sampling and storing the rasterized result in images. Based on the size and viewpoint of the triangle on the screen, the appropriately scaled texture image is selected and mapped onto the triangle to reduce the aliasing artifacts.

Steven M LaValle 2016-12-31