0% found this document useful (0 votes)
12 views10 pages

Ray Tracing Complex Scenes

Uploaded by

joaonunes
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views10 pages

Ray Tracing Complex Scenes

Uploaded by

joaonunes
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Dattas, August 18-22 Volume 20, Number 4, 1986

Ray Tracing Complex Scenes


Timothy L. Kay
James T. Kajiya
California Institute of Technology
Pasadena, CA 91125

Abstract b o u n d i n g volumes a r o u n d each object in their database.


If a given ray failed to intersect the b o u n d i n g volume for
A n e w algorithm for speeding u p ray-object a p a r t i c u l a r object, the object n e e d e d no f u r t h e r consid-
intersection calculations is presented. Objects eration. This way, t h e y avoided m a n y r a y - o b j e c t inter-
are b o u n d e d by a n e w type of extent, w h i c h c a n section calculations. By grouping objects hierarchically
be m a d e to fit c o n v e x hulls arbitrarily tightly. and placing a b o u n d i n g v o l u m e encompassing the ex-
T h e objects are placed into a hierarchy. A n e w t e n t of all children at each n o d e of the hierarchy tree,
hierarchy traversal algorithm is presented w h i c h the m a j o r i t y of the r a y - b o u n d i n g v o l u m e intersection
is efficient in the sense that objects along the ray calculations could also be avoided. R u b i n and Whit-
are queried in an e~cient order. ted chose r e c t a n g u l a r solids as b o u n d i n g volumes. To
Results are presented w h i c h d e m o n s t r a t e that improve tightness, t h e y d e f o r m e d the r e c t a n g u l a r solids
o u r t e c h n i q u e is s e v e r a l t i m e s f a s t e r t h a n o t h e r with an affine m a t r i x , t h e r e b y requiring a m a t r i x - v e c t o r
published algorithms. Fu.rthermore, we demon- multiply before the r a y - b o u n d i n g v o l u m e test could be
s t r a t e t h a t i t is c u r r e n t l y p o s s i b l e t o r a y t r a c e performed.
s c e n e s c o n t a i n i n g h u n d r e d s o f t h o u s a n d s o f ob- Weghorst, et. al. [Weghorst 84] p r o p o s e d and bench-
jects. m a r k e d a similar scheme. Notably, t h e y studied the use
Keywords: Ray tracing, extent, bounding vol- of different types of b o u n d i n g volumes in a single hier-
11me, h i e r a r c h y , t r a v e r s a l archy.
C o n c u r r e n t l y b u t independently, Glassner [Glassner
84] and K a p l a n [Kaplan 85] and m o r e recently Fuji-
1 Introduction moto, et. al. [Fujimoto 86} studied a different ap-
proach to the problem. W h e r e a s Rubin and W h i t t e d
Our purpose in studying ray tracing is to develop and Weghorst c r e a t e d b o u n d i n g volumes t o s u r r o u n d
techniques for synthesizing complex, realistic images. their objects, Glassner and K a p l a n divided their ob-
W e have two primary requirements; the rendering pro- jects into cells of an octree. As a ray passed t h r o u g h
gram must produce images of the highest possible qual- space, the octree d a t a s t r u c t u r e rejected any objects
ity, and it must be able to handle hundreds of thousands trivially fax away f r o m t h e ray. A significant feature
or millions of objects. of the G l a s s n e r - K a p l a n a l g o r i t h m is t h a t it considered
Rubin and Whitted [Rubin 80] determined that their objects along a given r a y r o u g h l y in the order that they
program spent most of its time computing ray-object occurred along the ray. A m a j o r d r a w b a c k of this space-
intersections in order to calculate which object was vis- p a r t i t i o n i n g a p p r o a c h is t h a t any p a r t i c u l a r object might
ible for a given ray. The performance worsened lin- end up in more t h a n one o c t r e e cell, p o t e n t i a l l y requir-
early as the number of objects in the scene increased. ing a ray to be intersected w i t h the same object more
To improve performance, they proposed placing simple t h a n once.
In this p a p e r we p a r t i t i o n objects r a t h e r t h a n space.
We present a new t y p e of b o u n d i n g v o l u m e for which
a ray intersection requires very little c o m p u t a t i o n . Un-
Permission to copy without fee all or part of this material is granted like previously described bounding volumes, ours have
provided that the copies are not made or distributed for direct the advantage that they can be m a d e to fit the convex
commercial advantage, the ACM copyright notice and the title of the hull of an object arbitrarily tightly in exchange for a
publication and its date appear, and notice is given that copying is by
permission of the Association for Computing Machinery.To copy slower intersectiort computation.
otherwise, or to republish, requires a fee and/or specific permission. W e present a new algorithm for traversing a hier-
archy of such bounding volumes. The algorithm is el-
© 1986 ACM 0-89791-196-2/86/008/0269 $00.75

269
~. S I G G R A P H '86

ficient in the sense that, for a given type of bounding P,


volume and a given ray, the objects are queried in a
well-defined, efficient order regardless of the hierarchy.
The results section compares our method to recently-
published work and finds that our algorithm is roughly
three times faster. More importantly, our technique has
proven capable of rendering scenes containing over one
hundred thousand objects. This enabled us to compute
two sequences for the S I G G R A P H '84 O m n i m a x film
The Magic Egg and the piece Trees in the SIGGRAPH
'85 film show.

2 Object Extents Figure 1: The set of planes defined by J~


The e x t e n t of an object is the region of space oc-

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

n°rmals ~3 ' ~33 ' -3~33 and 3~

define eight-sided parallelopipeds.


Bounding volumes constructed using a larger num-
ber of plane-set normals will bound objects more tightly.
For example, Figure 13 shows a tree for which we wish
to compute bounding volumes. Figure 8a shows the
bounding volumes created using the first three normals
mentioned in the previous paragraph. Figure 8b shows
b c the volumes formed using all seven normals.

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.

Figure 3c shows the same object bounded using all four


normals.
A realistic scene will contain millions of objects.
() ()
xi
y;.
z~.
= M
xi
yy
zi
+ T.

Storing plane-set normals and corresponding d near and


2. Each vertex is projected onto each P~.
d~ar for each object would require a great deal of mem-
ory and, as we will soon see, a great deal of compu-
tation. Therefore, we choose our plane-set normals in e 1

advance, independent of the particular objects to be


bounded. This will restrict our choices of bounding
volumes, but will allow us to describe them by a small
set of numbers. Figure 4 shows several objects bounded 3. Corresponding to each ~ , compute
by volumes restricted to preselected plane-set normals.

The plane-set normals 0


0
,
0
(°) (°)
1 and 0
1
and
d~ear = min {d~j-}

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

Spheres and other implicit surfaces must be

for the set of points (')


approached differently. We wish to compute bounds

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
.
\

Figure 5: The bounding volume of two bounding vol-


umes
We apply the associative property.

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

If we let = (T P'- bM+P'I'T" P' ÷ ''1)"


B = PJM T = MT~, ) E x a m p l e 8. C o m p o u n d o b j e c t s
The bounding volumes for compound objects such
C
as boohans (constructed as unions, intersections and
we can rewrite f as subtractions of other objects) can be calculated by first

] (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

T h e c o m p u t a t i o n for b o t h planes is identical, and each T h e e x p e n s e of a r a y - b o u n d i n g v o l u m e intersection


p r o v i d e s one e n d p o l n t to t h e interval along the ray. grows linearly w i t h the n u m b e r of slabs used to b o u n d
C a r e m u s t be t a k e n to orient the two e n d p o i n t s cor- an object. A slight m o d i f i c a t i o n i m p r o v e s p e r f o r m a n c e .
rectly. If the d e n o m i n a t o r of E q u a t i o n 5 is less t h a n Most r a y s miss m o s t b o u n d i n g v o l u m e s by a wide m a r -
zero, t h e n t h e roles of t h e n e a r a n d fax values m u s t be gin. W h e n this occurs, t h e i n t e r s e c t i o n of t h e different
reversed. Also, in the event t h a t this dot p r o d u c t is r a y - s l a b c o m p u t a t i o n s will be e m p t y a f t e r no m o r e t h a n
close to zero, the division in E q u a t i o n 5 m i g h t cause three slabs axe processed. T h e r e f o r e , the interval inter-
an overflow (or division b y zero}. We will provide a section calculation should be d o n e in t a n d e m with the
solution to this p r o b l e m later. r a y - s l a b intersection calculation. If the intersection be-
To c o m p u t e the intersection of a r a y w i t h a b o u n d - comes e m p t y , the r e s t of the r a y - s l a b intersections can
ing v o l u m e , we c o m p u t e the intersection of the r a y w i t h be ignored.
each slab, a n d t h e n c o m p u t e t h e intersection of these
intervals. We c o m p u t e the intersection of the intervals
by c o m p u t i n g the m a x i m u m of the n e a r values a n d the 3 Object Hierarchies
m i n i m u m of the far values.
If t h e r a y h a p p e n e d to miss the b o u n d i n g v o l u m e , While a large savings c a n be o b t a i n e d by placing
t h e n t near will be larger t h a n t far. O t h e r w i s e we h a v e each object in a b o u n d i n g v o l u m e , t h e cost of c o m p u t -
t h e value of t at the two intersections of the r a y w i t h the ing an i m a g e r e m a i n s p r o p o r t i o n a l to the n u m b e r of
b o u n d i n g v o l u m e . T h e s e values are useful as e s t i m a t e s objects in the image. A m u c h l a r g e r savings can be
of the p o s i t i o n of the object along the ray. achieved by c r e a t i n g a h i e r a r c h y of objects. We define
the e x t e n t of a p a r t i c u l a r n o d e in the h i e r a r c h y to be the
c o m b i n e d e x t e n t of all t h a t n o d e ' s children. For each
2.4 Cost of Intersection
such n o d e we c o m p u t e a b o u n d i n g volume. T h e n if a
By c o u n t i n g o p e r a t i o n s in E q u a t i o n 5 we see t h a t r a y misses the b o u n d i n g v o l u m e at a given node in the
each r a y - s l a b intersection requires four d o t p r o d u c t s , hierarchy, we can reject that node's entire subtree from
two s u b t r a c t s a n d two divides w h e n t a k i n g b o t h planes further consideration. Using a hierarchy causes the cost
into account. T h e s e n u m b e r s m u s t be multiplied b y of c o m p u t i n g an i m a g e to b e h a v e l o g a r i t h m i c a l l y in the
t h e n u m b e r of slabs involved in each b o u n d i n g v o l u m e , n u m b e r of objects in the scene.
a n d a m i n i m i z a t i o n and a m a x i m i z a t i o n m u s t b e done In c r e a t i n g a hierarchy, we require one f u n d a m e n -
across t h e slabs. t a l o p e r a t i o n on b o u n d i n g v o l u m e s . We m u s t be able
B u t we have d e t e r m i n e d o u r choice of plane-set nor- to c o m p u t e t h e b o u n d i n g v o l u m e of a p a r t i c u l a r node
reals a priori. For a given ray, we c a n c o m p u t e the d o t in the h i e r a r c h y t r e e given t h e b o u n d i n g v o l u m e s of
p r o d u c t s to be used in all calculations just once. If t h a t n o d e ' s children. T h e v o l u m e enclosing two o t h e r
there are m a n y r a y - b o u n d i n g v o l u m e intersections as- b o u n d i n g v o l u m e s is s i m p l y the m i n i m u m of the d~ ear
s o c i a t e d w i t h each ray, a n d this is generally the case, a n d t h e m a x i m u m of the d~ar values for the p a i r of
the e x p e n s e of the d o t p r o d u c t c o m p u t a t i o n will be of b o u n d i n g v o l u m e s in question.
little significance. F u r t h e r m o r e , at the t i m e t h a t the
dot p r o d u c t s are p r e c o m p u t e d , we can calculate the re-
3.1 Hierarchies
ciprocal of the d e n o m i n a t o r of E q u a t i o n 5 and replace
the divide w i t h a multiply. Before taking its reciprocal, T h e r e are m a n y schemes for c o n s t r u c t i n g a hierar-
t h o u g h , the value m u s t be checked for the possibility of chy. S o m e are easy to i m p l e m e n t a n d fast to execute,
overflow or divide by zero. If this is the case, a large while o t h e r s m i g h t b e s o p h i s t i c a t e d and c o n s u m e large
n u m b e r can be used in place of the reciprocal. 2 a m o u n t s of c o m p u t e r time. T h e r e are several interre-
l a t e d p r o p e r t i e s t h a t would s e e m to distinguish a good
t = (d, - S)T. h i e r a r c h y f r o m a b a d one.
where S = Jbi - b and T __
-- 1
P~.a"
Any given s u b t r e e should c o n t a i n objects t h a t are
T h e new c o m p u t a t i o n requires two s u b t r a c t s , two n e a r each other. " N e a r n e s s " is relative, b u t the
multiplies a n d a c o m p a r i s o n for each slab c o n t r i b u t i n g
lower the s u b t r e e is w i t h r e s p e c t to the entire hi-
to the b o u n d i n g volume. T h e calculation is now very erarchy, the "nearer" objects should be.
fast.
2Let M b e t h e s q u a r e r o o t of t h e l a r g e s t n u m b e r r e p r e s e n t a b l e b y
• T h e v o l u m e of each node should b e m i n i m a l .
t h e m a c h i n e . I f we r e s t r i c t t h e d a t a b a s e t o lie w i t h i n a s p h e r e
of t h i s r a d i u s , c e n t e r e d at t h e origin, t h e n we c a n Barely r e p l a c e • T h e s u m of the v o l u m e of all b o u n d i n g volumes
t h e r e c i p r o c a l w i t h M a n d avoid overflows. should be m i n i m a l .

273
S I G G R A P H '86

The construction of the tree should concentrate


on the nodes nearer the root of the tree. Pruning
a branch of the tree there allows a large subtree
to be remove from further consideration, whereas
pruning one lower d o w n removes just a few bound-
ing volumes and objects from further considera-
tion.

T h e time spent c o n s t r u c t i n g the hierarchy tree


should more t h a n pay for itself in time saved ren-
dering t h e image.

T h e simplest hierarchy involves almost no compu-


tation, and gives no consideration to the Unearness" Figure 6: T h e ray tracing program must compute two
criterion. Taking the objects in the order that they are object intersections
described, we simply create a tree with a fixed branch-
ing ratio using a bottom-up construction. This con-
struction does moderately well with regard to nearness T h e intersection of a ray with an object's bounding
if the database is modeled in a coherent fashion. volume yields two numbers. W e call the nearer number
W e could spend additional computer time to con- the estimated distance of the object along the ray. For
struct a better hierarchy. A median-cut scheme will a given ray, a bounding volumes will assign a unique es-
help group near objects together even if they aren't tlmated distance to each object in the database. These
modeled coherently. The scheme constructs a binary numbers impose a total order on the objects which de-
tree in a top-down fashion. At each level all the ob- fines the best order to search the database to resolve
jects in the database are sorted by their x coordinate. the ray's intersection.
The objects are then partitioned at their median. This The first object in the preferred order is not nec-
defines which objects belong on each side of the tree. essarily the one in which we are interested. Figure 6
T h e process is repeated recursively, except that at each demonstrates that the firstobject is not always the vis-
level the objects are sorted and partitioned on a differ- ible object. The best we can do is to proceed through
ent coordinate axis. the objects in order and compute ray-object intersec-
The previous algorithm attempts to group objects tions. If we find an object that intersects the ray at a
based on their nearness to each other, but it does so point closer than the remaining objects' distance esti-
along one dimension at a time. It might do better to mates, then the object in question is the visible object.
group objects in along three dimensions at once by em- The hierarchy traversal algorithm presented in Fig-
ploying an octree. This preprocessing step would be ure 7 will search the database in the total order just
very similar to the one described in [Glassner 84] or defined. Because objects are queried in the same or-
[Kaplan 85]. T h e difference is that, if an object str~- der regardless of the object bounding volume hierarchy,
dles two or more octree cells, it is arbitrarily placed in the difference between a poorly constructed hierarchy
exactly one of them. Furthermore, after the preprocess- and a good one is slight. Given a poor hierarchy, the
ing is completed, the octree is used solely to define the program will spend more time computing ray-bounding
hierarchy; each object must stillbe assigned a distinct volume intersections. The performance of the rest of the
bounding volume. program (ray-object intersections, shading calculations)
will be unaffected.
T h e traversal a l g o r i t h m searches the hierarchy tree,
4 Hierarchy Traversal b u t unlike a d e p t h first or b r e a d t h first search, it tra-
verses the hierarchy tree in an o r d e r derived while the
W e present a traversal algorithm whose output is traversal is in progress. A candidate node is one whose
insensitive to the m a n n e r in which the hierarchy is con- bounding volume is k n o w n to be in the path of the ray,
structed. This traversal algorithm bears similaritiesto but whose children have yet to be interrogated. W e
the fractal intersection algorithm of Kajiya [Kajiya 83]. keep track of candidate nodes in a priority queue, im-
W e will assume that the type of bounding volume to plemented as a heap (see [Aho 74] or [Sedgewick 83]).
be used has has been fixed a priori. W e demonstrate The heap guides the search by selecting the candidate
that for any ray there is a preferred order with which with the smallest nonnegative distance estimate.
to query the objects in the database. W e have found that the use of a heap is essential to

274
Dallas, A u g u s t 18-22 Volume 20, N u m b e r 4, 1986

We are given a ray


Compute dot products and reciprocals (section 2.4) Pyramid Pyramid Super- Tree Tree
Let t = distance to the nearest object hit so far ** 4 ** 5 q u a d r i c Branches Leaves Tress
Initialize t = + inf
Objects 1024 4096 2402 1272 7 4 5 8 110000÷
Let p contain a pointer to the nearest object hit so far Lights 1 1 2 I 1 1
Initialize p = nil Pixsls 262 262 262 262 282 262
While heap is non-empty and distance to top node < t Color Rays 263 263 263 263 263 263
Extract candidate from heap Shadow Rays 37 34 410 135 155
If the candidate is a leaf Total Rays 300 297 673 398 418
Compute ray-object intersection Rays that H i t 43 41 241 151 206
Object Int. B21 330 841 354 983
If ray hits candidate and distance < t then B. V. I n t . 2810 3678 44802 18491 3 3 7 8 3 288000@
t = distance Time 4 3 8 1 see 980 1033 E147 2429 4116
p = candidate (see/ray) .00327 .00348 .00765 .00610 .00986
Endif (see/ray .02276 .02523 .02138 .01608 .otgg8
Else that hit)
For each child of the candidate
111 pixsl, r a y and i n t e r s e c t i o n counts are in thousands.
Compute ray-bounding volume intersection
If the ray hits the bounding volume @ Computed on a 3 0 8 1 u s i n g an e a r l y version of the code.
Insert the child into the heap
Endif
End for Table 1: T i m i n g d a t a
Endif
Endwhile
addition to 6184 p o l y g o n a l leaves.
Figure 7: Traversal a l g o r i t h m
All images were c o m p u t e d on an I B M 4 3 8 1 / G r o u p
12 using A m d a h l UTS, a version of U n i x / S y s t e m V. De-
the efficiency of the algorithm. In previous implemen- p e n d i n g on the scene, a 4381 b e n c h m a r k s 3.5-4.0 times
t a t i o n s it was f o u n d t h a t a t r e m e n d o u s a m o u n t of time faster t h a n a Vax 11/780 r u n n i n g Berkeley Unix 4.2.
was spent in sorting routines. A heap does a b e t t e r job The pictures were c o m p u t e d at 512 by 512 pixel reso-
while c o n s u m i n g much less c o m p u t e r time. lution. For the sake of the presentation, all images in
this p u b l i c a t i o n were antialiased using 4 by 4 subsam-
piing. T h e samples were then filtered using an eight-
5 Results lobe, windowed sinc function. T h e values r e p o r t e d in
Table 1 c o r r e s p o n d to the same images c o m p u t e d with
The ray tracing scheme just described has been un- one sample per pixel.
der development for several years. A primitive ver- It is reasonable to present the b e n c h m a r k s in terms
sion was used to compute the Space Colony and Saturn of a t o m i c actions r a t h e r t h a n as execution times for pic-
Flyby sequences from the S I G G R A P H '84 O m n i m a x tures of some a r b i t r a r y siz,e. Since we are c o n c e n t r a t i n g
film The Magic Egg. on the r a y casting aspects of ray tracing, we r e p o r t the
A revised version of the p r o g r a m was used to com- speed of the p r o g r a m in units of seconds per ray.
p u t e Trees, which was shown at the S I G G R A P H '85 Table 1 contains the statistics for the test images.
Film Show. Figure 9 is a f r a m e from this movie. T h e T i m i n g s are given in seconds, seconds per ray, and sec-
Trees d a t a b a s e contains a b o u t 110,000 objects. onds per o b j e c t - h i t t i n g ray. T h e time per ray value
The ability to c o m p u t e these two movies d e m o n - changes drastically w i t h each image. W h e n the a m o u n t
s t r a t e s the feasibility of our algorithms. We expect to of visible b a c k g r o u n d increases, there axe more rays
ray trace a scene containing at least one million objects t h a t miss the world. These rays require very little
by the end of 1986. c o m p u t a t i o n a n d t h e r e b y bias the statistics. We ig-
The test images represent an increasing sequence of nore these rays by keeping track of the object-hitting
scene compositions and complexities. With Figure 10 rays. While the time p e r ray changes a great deal from
we attempt to duplicate a test case in Glassner's paper. image to image, the time per o b j e c t - h i t t l n g r a y stays
The pyramid is constructed of 1024 triangles. Figure relatively c o n s t a n t .
11 contains four copies of the pyramid from Figure 10. In their recent papers, Glassner and Weghorst re-
Figure 12 contains 2 superquadrics [Baxr 81l and 400 p o r t execution times for their r a y tracing programs. We
tileseach composed of 6 faces. Figure 13 contains a base had h o p e d to do an in-depth c o m p a r i s o n of the speeds
polygon and a single tree composed of 1271 branches. of their i m p l e m e n t a t i o n s with ours. Despite our efforts,
Figure 14 contains the same objects as Figure 13 in we have found t h a t there are t o o m a n y u n k n o w n fac-

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.

6 Conclusion [Weghorst 841 Weghorst, Hank, Gary Hooper, and Don-


ald P. Greenberg, "Improved Computational Meth-
As databases become increasingly complex, the time ods for Ray Tracing," ACM Transactions on Graph-
spent computing the visible object for a ray becomes the ics, 3(1}, January 1984, pp. 52-69.
dominant concern. We have presented a new algorithm
for speeding up this process. [Whitted 801 Whitted, Turner, "An Improved Illumi-
nation Model for Shaded Display," Communica-
tions of the ACM, 23(6), June 1980, 343-349.
7 References

[Apostol 69] Apostol, Tom M., Calculus, Volume II,


Wiley, New York, 1969, pp. 314-318.

[Burr 81] Burr, Alan H., "Superquadrics and Angle Pre-


serving Transformations, n Computer Graphics an.d
Applications, 1(1).
[Cook 84] Cook, Robert L., Thomas Porter and Loren
Carpenter, "Distributed Ray Tracing, ~ Computer
Graphics, 18(3), July 1984, pp. 137-145.

[Cyrus 78] Cyrus, M. and J. Beck, "Generalized two


and three dimensional Clipping," Computers and
Graphics, 3(1}, 1978, pp. 23-28.

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

You might also like