Graphics Reference
In-Depth Information
we might wish to render other primitives in the future, such as spheres or implicit
surfaces. Such primitives can intersect a ray multiple times. If we assume that
the shadow ray never intersects the current surface, those objects would never
self-shadow.
15.4.9 A More Complex Scene
Now that we've built a renderer for one or two triangles, it is no more difficult to
render scenes containing many triangles. Figure 15.12 shows a shiny, gold-colored
teapot on a white ground plane. We parsed a file containing the vertices of the cor-
responding triangle mesh, appended those triangles to the Scene 's triangle array,
and then ran the existing renderer on it. This scene contains about 100 triangles,
so it renders about 100 times slower than the single-triangle scene. We can make
arbitrarily more complex geometry and shading functions for the renderer. We are
only limited by the quality of our models and our rendering performance, both of
which will be improved in subsequent chapters.
This scene looks impressive (at least, relative to the single triangle) for
two reasons. First, we see some real-world phenomena, such as shiny high-
lights, shadows, and nice gradients as light falls off. These occurred naturally
from following the geometric relationships between light and surfaces in our
implementation.
Second, the image resembles a recognizable object, specifically, a teapot.
Unlike the illumination phenomena, nothing in our code made this look like a
teapot. We simply loaded a triangle list from a data file that someone (originally,
Jim Blinn) happened to have manually constructed. This teapot triangle list is a
classic model in graphics. You can download the triangle mesh version used here
from http://graphics.cs.williams.edu/data among other sources. Creating
models like this is a separate problem from rendering, discussed in Chapter 22
and many others. Fortunately, there are many such models available, so we can
defer the modeling problem while we discuss rendering.
We can learn a lesson from this. A strength and weakness of computer graphics
as a technical field is that often the data contributes more to the quality of the final
image than the algorithm. The same algorithm rendered the teapot and the green
triangle, but the teapot looks more impressive because the data is better. Often a
truly poor approximation algorithm will produce stunning results when a master
artist creates the input—the commercial success of the film and game industries
has largely depended on this fact. Be aware of this when judging algorithms based
on rendered results, and take advantage of it by importing good artwork to demon-
strate your own algorithms.
Figure 15.11: The dark dots on
the green triangle are shadow
acne caused by self-shadowing.
This artifact occurs when the
shadow ray immediately inter-
sects the triangle that was being
shaded.
Figure 15.12: A scene composed
of many triangles.
15.5 Intermezzo
To render a scene, we needed to iterate over both triangles and pixels. In the pre-
vious section, we arbitrarily chose to arrange the pixel loop on the outside and the
triangle loop on the inside. That yielded the ray-casting algorithm. The ray-casting
algorithm has three nice properties: It somewhat mimics the underlying physics, it
separates the visibility routine from the shading routine, and it leverages the same
ray-triangle intersection routine for both eye rays and shadow rays.
 
 
 
Search WWH ::




Custom Search