Ray Tracing Complex Scenes
Ray Tracing Complex Scenes
269
~. S I G G R A P H '86
y
cupied by the object. For the sake of computational
simplicity, we wish to bound each object in a volume
that is simpler than the object itself. If a ray-extent in-
tersection is significantly faster than a ray-object inter-
section, the results of the ray-extent intersections can
be used to prune a majority of the expensive ray-object
intersections. If a ray does not hit an object's bounding
volume, then clearly it will miss the object itself. r
In choosing bounding volumes for arbitrarily com-
plex objects, two opposing constraints must be bal-
anced. If a bounding volume fits an object loosely,
many rays that hit the bounding volume will miss the
object. If a bounding volume describes an object's ex-
tent precisely, very few ray-object intersection calcula~ Figure 2: Planes corresponding to P~ t h a t bound an
tions will be wasted. By this criterion alone, the best object
bounding volume for an object is the object itself. On
the other hand, intersecting rays with simpler bound-
in g volumes requires fewer calculations. This constraintIf the normal vector jb~ is fixed, leaving the distance d
suggests that simple spheres, ellipsoids and rectangular free to vary, Equation 1 then describes the set of all
solids are good bounding volumes. For exaznple, Rubin planes normal to J~. See Figure 1. Out of any such
set we choose two planes that bound a given object.
and W h i t t e d and Toth [Toth 85] used rectangulax solids
to describe object extents, while Weghorst used a mix- See Figure 2. Significantly, we can describe these two
planes by exactly two real numbers d~ ear and d~at, the
ture of objects such as rectangular solids and spheres.
values of d for the two planes. W e call the region in
With respect to the tightness versus speed tradeoff,
space between such planes a slab. The normal vector
the bounding volumes n o w presented can be tailored to
defining the orientation of a slab is termed a plane-set
suit the particular scene being rendered.
normal.
Different choices of plane-set normals Pi yield dif-
2.1 Bounding Volume Description ferent bounding slabs for an object. T h e intersection of
We bound objects with parallelopipeds constructed a set of bounding slabs yields a bounding volume. In
of planes. An arbitrvxy plane in 3-space is described order to create a closed bounding volume in 3-space,
implicitly by the equation at least three bounding slabs must be involved, and
they must be chosen so that the defining normal vectors
A x + B y + C z - d = O. O) span 3-space. For the sake of simplicity, the examples
in the figures axe presented in 2-space, in which a mini-
Geometrically, Equation 1 describes a plane with nor- m u m of two vectors will span. The generalization to 3-
space requires the addition of a third coordinate to each
mal vector P~ = B lying d units from the origin. vector; the equations generalize without modification.
C Figure 3a shows an object bounded by slabs with nor-
270
Dallas, A u g u s t 18-22 V o l u m e 20, N u m b e r 4, 1986
Figure 3: Bounding an object using various normals 2.2 Computing Bounding Volumes
The d~ ear and d~at values are simply the endpoints
of the extent of the projection of the object onto the
normal
A modeling transformation is associated with each
object in the database. This transformation must be
taken into account because the bounding volumes exist
in world space. We will treat a modeling transforma-
tion as a three-by-three matrix M and a translation
vector T. We describe the bounding volume calculation
for several types of objects.
i- E x a m p l e 1. P o l y h e d r a
A polyhedron is defined by a collection of vertices
Figure 4: Objects bounded by a fixed set of normals yj . We compute the bounding volume for the
zi
polyhedron by computing the bounding volume enclos-
ing these vertices. There axe three steps.
mals ( 1 )0 and ( 0 )1 " Figure 3b shows the same ob-
1. The bounding volume belongs in final world coor-
dinates, the vertices must be transformed by M.
d~ar = m a x {dij } .
define rectangular solid bounding volumes whose faces
are perpendicular to the coordinate axes. The plane-set IA row vector followed by a column vector denotes dot product.
271
~. S I G G R A P H '86
m
E x a m p l e 2. I m p l i c i t s u r f a c e s N
y
Z
which satisfy the implicit \
!iiiiii!!!iii!!:
~ii!i!ii:i+!!~i:
equation of the surface. We will first treat the trans-
formation by M and then account for T afterwards.
After transforming by M, we project each point onto
P/. The transformation and projection yield
f (+) +((+))
y
Z
= M y
Z
.
\
f >(+)
y
Z
= M y
Z
.
The contribution of T to the position of each slab
is T • ~ . Combining the contributions from M and T
yields
] (x) y
Z
=Az+By+CYz. (2)
computing bounding volumes for each subobject. These
bounding volumes can then be combined. As Figure 5
demonstrates, the bounding volume of two bounding
volumes is simply the pairwise minimum of each d~ ear
and the pairwise maximum of each ~ r value.
Here we have a scalar field constrained by the implicit
For example, the branches of the trees in the re-
equation, and we wish to find the minimum and maxi-
suits section are cylinders with a sphere at each end.
mum values assumed by f . Problems of this type can
A branch's bounding volumes is computed as a combi-
be solved readily using the method of Lagrange multi-
nation of the two sphere's bounding volumes. We can
pliers (see [Apostol 69]).
ignore the bounding volume of the cylinder because it is
Next we account for the translation T. We need
guaranteed to lie within the combined bounding volume
to translate each (d~e'r, d~~ ) pair by the length of the
of the two spheres.
component of T parallel to jb~, which is simply T . ~ .
For example, the implicit equation of a sphere is
2.3 Ray-Volume Intersection
z2+y 2+z 2-1=0. (3) The intersection algorithm presented here is similar
in spirit to that of Cyrus and Beck [Cyrus 78].
The method of Lagrange multipliers tells us that the
A ray intersects with a slab to yield an interval along
extrema occur when
(A) (2+)
B = A 2y .
the ray. To compute this interval, we intersect the ray
R = ~t + b (4)
C 2z with the each of the two planes bounding the slab. The
solution of this intersection in terms of the ray param-
Substituting back into Equations 2 and 3 gives eter t is computed by substituting the ray Equation 4
into the plane Equation 1 yielding
= ± x / A 2 + B 2 + C 2. d , - P,.b
f
I YXZ ) x2"kY2-kzz --1=0
t - P, a (5)
272
Dallas, August 18-22 Volume 20, Number 4, 1986
273
S I G G R A P H '86
274
Dallas, A u g u s t 18-22 Volume 20, N u m b e r 4, 1986
275
~. S I G G R A P H '86
tors involved. In the hopes of establishing a basis for [Fujirnoto 86] Fujimoto, Akira, Takayuki Tanaka, and
future comparison, we offer our databases to anyone Kansei Iwata, "ARTS: Accelerated Ray-Tracing
who wishes to put their programs through its paces. S y s t e m ' , IEEE Computer Graphics and Appli-
Furthermore, we welcome discussions regarding which cations, 6(4), April I986, 16-26.
benchmarks would be most informative.
The few comparisons we can make between Glass- [Glassner 84] Glassner, Andrew S., USpace Subdivision
for Fast Ray Tracing," IEEE Computer Graph-
her's data and our own seem to suggest that our method
ics and Applications, 4(10), October, 1984, pp.
is significantly faster. We managed to faithfully repro-
duce only one of his models. We recomputed our ver- 15-22.
sion on a Vax/780 for the sake of comparison. Glassner [Kaplan 85] Kaplan, Michael R., "The Uses of Spatial
program used 8700 seconds of Vax/780 time to render Coherence in Ray Tracing," ACM S I G G R A P H
his "recursive pyramid ~ of Figure 10, while our imple- '85 Course Notes 11, July 22-26 1985.
mentation took 2706 seconds. Because the viewpoints
differed slightly, he shot 352322 rays to our 298588. [Kay 86] Kay, Timothy L., M.S. dissertation in prepa-
Taking this into account, we can conclude that, for ration.
this particular image, our program runs 2.6 times faster
[Kajiya 83] Kajiya, James T., "New Techniques for Ray
than his.
Tracing Procedurally Defined Objects", Com-
We can increase the number of plane-set normals
puter Graphics, 17(3}, July, 1983, pp. 91-102.
beyond the required three. Figure 8 demonstrates that
objects can be bounded very tightly in this fashion. The [Rubin 801 Rubin, Steve M. and T. Whitted., "A Three-
pyramid benchmark ran the fastest when the combined Dimensional Representation for Fast Rendering
normals of an octahedron were combined with a single of Complex Scenes," Computer Graphics 14(3),
additional normal pointing upwards. July 1980, pp. 110-116.
When ray tracing on a supercomputer, a larger num-
ber of plane-set normals is very advantageous. In that [Sedgewick 831 Sedgewick, Robert, Algorithms, Addison-
environment, the traversal algorithm may be vector- Wesley, Reading, 1983, pp. 127-142.
ised, and the incremental cost of additional plane sets
[Toth 85] Toth, Daniel L., "On Ray Tracing Paramet-
is minimal.
ric Surfaces," Computer Graphics 19(3), July
1985, pp. 171-179.
276
Dallas, August 18-22 Volume 20, Number 4, 1986
Figure 8a
Figure 9
Figure 8b
Figure I0 Figure 11
277
S I G G R A P H '86
Figure 12
Figure 13
Figure 14
278