Aliasing
Joren Van Onder

Table of Contents

Introduction

Imagine the following scene:

jittered_spheres_10px.png

Figure 1: 100x100px image with red and green alternating circles, each with a diameter of 10px

Reducing the size of each circle to 1px gives a predictable result. The resulting image has alternating green and red vertical lines:

uniform_spheres_1px.png

Figure 2: 100x100px image with red and green alternating circles, each with a diameter of 1px (uniform sampling, 1 sample/px)

Different sampling methods

Depending on the sampling method used the lines may not have a uniform color. The same scene rendered with jittered sampling results in:

jittered_spheres_1px.png

Figure 3: 1px circles rendered with jittered sampling (16 samples/px)

The end result however is still an image with vertical lines containing either shades of green or shades of red i.e. a vertical green line contains no shades of red and vice versa.

Aliasing artifacts

When the size of the circles varies slightly from the sampling frequency, aliasing artifacts occur. E.g. sampling 1.05px circles uniformly (1 sample/px):

uniform_spheres_1_05px.png

Figure 4: Aliasing artifacts with circles with a 1.05px diameter, rendered with uniform sampling (1 sample/px)

This shows a clear pattern that does not exist in the scene. Although usually more subtle, this demonstrates clearly why most rendering methods use various anti-aliasing techniques to avoid this.

Jittered sampling is quite effective at eliminating most forms of aliasing. Although it looks better, for this case the end result is not acceptable:

jittered_spheres_1_05px.png

Figure 5: Aliasing artifacts with circles with a 1.05px diameter, rendered with jittered sampling (16 samples/px)

Analysis

Uniform

When sampling circles of 1px the sampling occurs in in lockstep:

Sorry, your browser does not support SVG.

Figure 6: Lockstep uniform sampling (1 sample/px)

Although different sampling techniques might sample these individual pixels differently, there is only either green or red in each pixel.

When the circle is slightly larger than the pixel size (1.05px) the sampling no longer occurs in lockstep:

uniform_samples_larger_spheres.png

Figure 7: Non-lockstep uniform sampling (1 sample/px), sample points are given in blue

With uniform sampling at 1 sample/px this results in the black symmetric spots in Figure 4. The regular pattern of the scene results in the multiple areas where only the background is sampled. In figure 7 happens in the bottom right pixels.

Jittered

The core issue with this pattern is that every sampled pixel will contain a varying amount of red and green. From left to right the pixels will contain:

  1. only green (+ background)
  2. mostly green, little bit of red (+ background)
  3. equal amounts green and red (+ background)
  4. mostly red, little bit of green (+ background)
  5. only red (+ background)
  6. etc…

The jittered sampling in Figure 5 gets rid of the symmetric black spots but still has some aliasing artifacts. There are multiple vertical bands of noise. These noisy bands occur when the pixels are being sampled as described in steps 2, 3 and 4.

More advanced jittered sampling patterns like e.g. multi-jittered sampling won't do any better:

multi_jittered_spheres_1_05px.png

Figure 8: Aliasing artifacts with circles with a 1.05px diameter, rendered with multi-jittered sampling (16 samples/px)

The core issue remains the same, namely that going left to right pixels contain a varying amount of red and green.

Conclusion

Avoiding these vertical noise bands is not straight-forward. An ideal solution would necessarily have to result in uniform noise. There is simply not enough available resolution to do better. Therefore it is best to avoid this situation all together by either:

Interestingly, the classic anti-aliasing checkerboard example side-steps this problem 1:

Reconstruction-Mitchell-Checkerboard.png

Figure 9: Anti-aliased checkerboard

The same bands appear, but because the square size decreases rapidly as the distance from the camera increases they are not noticeable.

Footnotes:

1

By Portsmouth (Own work) [Public domain], via Wikimedia Commons