Graphics Reference
In-Depth Information
Figure 20.13: Aliasing arising from single-sample ray tracing of a checkerboard texture
(Courtesy of Kefei Lei).
Figure 20.13 shows a very simple example, a ray-traced scene in which there's no
lighting, but there is a single infinite ground plane and an infinite sky plane. The
sky is blue; the ground has a checkerboard pattern. The color for a ray traced into
the scene is therefore either blue, black, or white.
Even though the checkerboard texture is absolutely perfect, in the sense that
it's represented by a function, namely, “Is floor(x) + floor(y) odd?” rather than
interpolated from an image, it's clear that the picture doesn't look very good. The
moiré patterns at the horizon are distracting and unnatural.
The reason for these patterns is clear: On any single horizon-parallel line, the
texture looks like a square wave; the Fourier transform of the square wave contains
arbitrarily high frequencies. And the image-space frequency of this square wave
gets higher as we approach the horizon. Nonetheless, we're taking samples at a
fixed spacing (one per output pixel, sampled at the pixel center). We're sampling
a non-band-limited function, and the degree to which it's not band-limited gets
worse as we get closer to the horizon. Naturally, aliases appear.
This doesn't mean that texture mapping is a bad idea by any means. It only
tells us that we need to think about sampling before we use texture-mapped values.
We need to band-limit the signal before we take samples.
How much must we band-limit? At the very least, to the Nyquist rate for the
sampling, that is, a half-period per pixel spacing. On the ground plane itself, the
upper limit on frequency varies with distance: If one checkerboard square at dis-
tance 5 from the camera projects to a span of 20 pixels left to right, then at distance
50 it will project to just two pixels and at distance 100 it will project to a sin-
gle pixel, so a black-white cycle (two adjacent squares of the checkerboard) will
project to exactly two pixels, which means that at distance 100 even the funda-
mental frequency of the square wave is at the Nyquist limit. For distances beyond
100, the best we can do is to replace the square wave by its average value (i.e.,
display a uniformly gray plane). A similar analysis applies in the projection of the
checkerboard squares in the vertical direction. Evidently, the band-limit in each
direction needs to decrease linearly with distance. Fortunately, this notion is now
built into much hardware: It's easy to specify, when you use a texture map, that
Search WWH ::




Custom Search