# Aliasing

## What Aliasing Is

Due to the fact that the world is sampled and then rendered, possibilities for errors exist. Depending on how the samples are taken, multiple worlds can actually serve as aliases for one another and produce exactly the same sample set. This incorrect rendering of a scene because a model is masquerading as one of many other models who sample identically is called aliasing.

## Temporal Aliasing

A very common type of aliasing is what is known as Temporal Aliasing. In fact, almost everyone has experienced it when you watch a carŐs wheels accelerate, or the blades of a helicopter accelerate. Because the eye can only sample the world at a certain number of frames per second, objects appear to behave peculiarly. It is for this reason that helicopter blades appear to speed up, slow down, and then actually travel in reverse as the helicopter powers up. The following movie illustrates an already flying helicopter. Note that the blades appear to be moving forward quite slowly, when in reality they are spinning at thousands of revolutions per minute.

## Spatial Aliasing

One of the causes of aliasing in computer graphics is the fact that only a finite number of rays can be sampled from the scene. No matter how many rays are packed, one can always miss an object if it is small enough or far enough away. The effect of missing an object because it "falls between" two rays is called .

## Anti Aliasing

In order to solve the fundamental problem of representing continuous objects in discrete systems, a variety of anti-aliasing techniques have evolved. The following techniques are all methods for combating spatial aliasing.

### Supersampling

Supersampling is the process of measuring an increased number of rays for every pixel. This does not solve aliasing problems, but it does attempt to reduce the effect they have on the final image. In the following example, nine rays are sent out from a pixel. Six are blue and 3 are green. The resulting color for the pixel would be two-thirds blue and one-third green.

### Adaptive Supersampling - Monte-Carlo Sampling

Adaptive Supersampling (also known as Monte-Carlo Sampling) is an attempt to supersample in a more intelligent manner. It starts by sending a fixed number of rays into a pixel and comparing their colors. If the colors are similar, the program assumes that the pixel is looking at one object and the average of the rays are computed to be the color of that pixel. If the rays are sufficiently different (as defined by some threshold value) then some "interesting is going on in that pixel, and further examination is required. In this case, the pixel is subdivided into smaller regions, and each new region is treated as a whole pixel. The process begins again, with the same pattern of rays being fired into each new section. Once no further subdivision is necessary (because all the sub-pixels are internally consistent) the average of the sub-pixel colors are taken to determine the color of the pixel as a whole.

### Stochastic Ray Tracing

Unfortunately, Adaptive Supersampling still divides pixels into regular patterns of rays, and suffers from aliasing that can occur from regular pixel subdivision. Stochiastic (Random) sampling sends a fixed number of rays into a pixel, but makes sure they are randomly distributed (but more or less evenly cover the area). In addition, stochiastic ray tracing attempts to solve the problem of following incoming rays. On bumpy surfaces, an outgoing ray can be the product of many incoming rays, and a ray tracer must decide which one to follow when it recursively traces the ray back to the light source. Stochiastic tracing randomly picks an incoming ray to trace, and tries to optimize picking by selecting rays that lead to light sources, and ignoring ones that do not.

### Statistical Supersampling

All of the following techiques attempt to provide for a "good enough" estimate for the color of a pixel. In order to calculate what is "good enough", one sends a number of rays into a pixel to obtain a larger picture of everything that the pixel "sees". A vast body of statistical analysis can be used to calculate, on the basis of the distribution of the rays and their number, the likelyhood that a calculated color is actually the true color for that pixel. For example, sending in 4 pixels distributed in a certain pattern might be calculated to be 90% accurate, using certain statistical equations. Depending on the desired quality and speed of the renderer, one can specify what percentages are "good enough" and what percentages require more analysis (by shooting more rays into the object). This proces is called statistical supersampling.