9
An efficient hierarchical- traversal algorithm for ray tracing Hao-Ren Ke 1 and Ruei-Chuan Chang z, 3 1 Institute of Computer and Information Science, National Chiao Tung University, Hsinchu, Taiwan, Republic of China z Institute of Computer and Information Science, National Chiao Tung University, Hsinchu, Taiwan, Republic of China e-mail: [email protected] a Institute of Information Science, Academia Sinica, Nankang, Taipei, Taiwan, Republic of China Ray tracing has been shown to be an ex- cellent technique for rendering realistic im- ages. However, it is important to reduce the lengthy computation time resulting from the brute-force nature of the original ray-tracing algorithms. In this paper, two ideas are proposed to speed up the well- known hierarchical subdivision method. First, a new hierarchy traversal scheme is described to reduce the number of ray- bounding volume intersection tests for sec- ondary rays. Then, a plane-sweep method is proposed to make fewer intersection checks for eye rays. Experiments and dis- cussions are presented to prove the feasi- bility of our methods. Key words: Ray tracing - Hierarchical subdivision Plane sweep Correspondence to: R.-C. Chang 1 Introduction Since Whitted (1980) refined the original ray-trac- ing algorithm (Appel 1968) to implement the global illumination model, which involves the phenomena of reflections, refractions, shadows, and specular reflections, it has become one of the most powerful approaches to image synthesis. The basic idea of ray tracing is simple, but this technique is very expensive because of the lengthy computation time required to calculate the intersections of rays and objects. Thus, many algorithms (Glassner 1984; Fujimoto et al. 1986; Kay and Kajiya 1986; Scher- son and Caspary 1987) to speed up ray tracing were described after Whitted proposed the meth- od. One way to speed up ray tracing is to reduce the number of intersection calculations. The most primitive method is to surround each object with a simple bounding volume. If a ray has no intersec- tion with the bounding volume, it is not necessary to check for intersection with the object enclosed. This idea was suggested by Rubin and Whitted (1980), who used spheres as bounding volumes. Weghorst et al. (1984) then proposed some criteria to use in selecting bounding volumes and a cost function to choose the bounding volume for a cer- tain object automatically. Kay and Kajiya (1986) enclosed objects with parallelpipeds constructed of planes. Although using bounding volumes to speed up ray tracing is simple, it cannot improve the per- formance much. Hence, many complex, but effi- cient speed-up approaches have been proposed. See Arvo and Kirk (1988) for a survey of the algorithms concerned. One accelerating scheme, spatial subdivision, subdi- vides the environment into disjoint cells and asso- ciates with each cell a list of objects within it. Two methods can be used to subdivide the environment: Fujimoto et al. (1986) suggested partitioning the whole world into regular grids (uniform grid cell subdivision) and Glassner (1984) subdivided the en- vironment recursively until the number of objects within each cell was smaller than a certain thresh- old (octree subdivision). All cells that are pierced by a ray are checked according to their order along the ray. Intersection checks are performed for all objects in the current cell. If intersection points exist, the nearest one is selected and the process is terminated. Otherwise, this process is repeated for the next cell along the ray. This searching goes on until a nearest intersection point is located in some cell or all cells penetrated by the ray are tested, but no intersection point is found. Another method is called hierarchical subdivision The Visual Computer (1993) 10:79-87 Springer-Verlag 1993 79

An efficient hierarchicaltraversal algorithm for ray tracing

Embed Size (px)

Citation preview

Page 1: An efficient hierarchicaltraversal algorithm for ray tracing

An efficient hierarchical- traversal algorithm for ray tracing

H a o - R e n K e 1 a n d R u e i - C h u a n C h a n g z, 3

1 Institute of Computer and Information Science, National Chiao Tung University, Hsinchu, Taiwan, Republic of China z Institute of Computer and Information Science, National Chiao Tung University, Hsinchu, Taiwan, Republic of China e-mail: [email protected] a Institute of Information Science, Academia Sinica, Nankang, Taipei, Taiwan, Republic of China

Ray tracing has been shown to be an ex- cellent technique for rendering realistic im- ages. However, it is important to reduce the lengthy computation time resulting from the brute-force nature of the original ray-tracing algorithms. In this paper, two ideas are proposed to speed up the well- known hierarchical subdivision method. First, a new hierarchy traversal scheme is described to reduce the number of ray- bounding volume intersection tests for sec- ondary rays. Then, a plane-sweep method is proposed to make fewer intersection checks for eye rays. Experiments and dis- cussions are presented to prove the feasi- bility of our methods.

Key words: Ray tracing - Hierarchical subdivision Plane sweep

Correspondence to: R.-C. Chang

1 Introduction Since Whitted (1980) refined the original ray-trac- ing algorithm (Appel 1968) to implement the global illumination model, which involves the phenomena of reflections, refractions, shadows, and specular reflections, it has become one of the most powerful approaches to image synthesis. The basic idea of ray tracing is simple, but this technique is very expensive because of the lengthy computation time required to calculate the intersections of rays and objects. Thus, many algorithms (Glassner 1984; Fujimoto et al. 1986; Kay and Kajiya 1986; Scher- son and Caspary 1987) to speed up ray tracing were described after Whitted proposed the meth- od. One way to speed up ray tracing is to reduce the number of intersection calculations. The most primitive method is to surround each object with a simple bounding volume. If a ray has no intersec- tion with the bounding volume, it is not necessary to check for intersection with the object enclosed. This idea was suggested by Rubin and Whitted (1980), who used spheres as bounding volumes. Weghorst et al. (1984) then proposed some criteria to use in selecting bounding volumes and a cost function to choose the bounding volume for a cer- tain object automatically. Kay and Kajiya (1986) enclosed objects with parallelpipeds constructed of planes. Although using bounding volumes to speed up ray tracing is simple, it cannot improve the per- formance much. Hence, many complex, but effi- cient speed-up approaches have been proposed. See Arvo and Kirk (1988) for a survey of the algorithms concerned. One accelerating scheme, spatial subdivision, subdi- vides the environment into disjoint cells and asso- ciates with each cell a list of objects within it. Two methods can be used to subdivide the environment: Fujimoto et al. (1986) suggested partitioning the whole world into regular grids (uniform grid cell subdivision) and Glassner (1984) subdivided the en- vironment recursively until the number of objects within each cell was smaller than a certain thresh- old (octree subdivision). All cells that are pierced by a ray are checked according to their order along the ray. Intersection checks are performed for all objects in the current cell. If intersection points exist, the nearest one is selected and the process is terminated. Otherwise, this process is repeated for the next cell along the ray. This searching goes on until a nearest intersection point is located in some cell or all cells penetrated by the ray are tested, but no intersection point is found. Another method is called hierarchical subdivision

The Visual Computer (1993) 10:79-87 �9 Springer-Verlag 1993 79

Page 2: An efficient hierarchicaltraversal algorithm for ray tracing

(Whitted 1980; Weghorst et al. 1984; Kay and Ka- jiya 1986). In this method, each object is enclosed with a bounding volume. Furthermore, several bounding volumes are also surrounded by a larger volume. By recursively surrounding volumes with a larger one, an object hierarchy is built. The idea is that if a ray does not hit the larger bounding volume, all smaller ones, as well as objects con- tained in those volumes, can be pruned without further consideration. To determine whether a ray intersects with objects, the following strategy is used: if a node in the hierarchy is hit by a ray, all its children are checked recursively; otherwise, all children are excluded from further testing. Ini- tially, the root of this hierarchy, representing the bounding volume of the whole scene, is checked for intersection. Previous schemes for improving the hierarchical traversal algorithms were pro- posed by Kay and Kajiya (1986), and by Scherson and Caspary (1987). In the former approach, a heap is introduced to cut off some unnecessary intersec- tion checks; the latter is a hybrid approach com- bining hierarchical subdivision and octree subdivi- sion. In this paper, we exploit the traversal algorithm presented by Kay and Kajiya (1986) as a paradigm and suggest a new traversal scheme to speed up ray tracing. The idea is that when a ray, especially a secondary ray, is shot, it is more likely to have the nearest intersection with objects in the neigh- borhood of the ray origin. Applying this idea, we attempt to test bounding volumes from near to far. A combined top-down and bottom-up traver- sal algorithm is presented to achieve this goal; this new traversal approach works for rays that origi- nate from objects and is the subject of Sect. 2. In Sect. 3, we try to cast fewer eye rays and make fewer ray-object and ray-extent intersection checks for eye rays. The image plane is divided into re- gions. A plane-sweep method is used on each re- gion to extract any bounding volumes, which are taken into further consideration. Section 4 presents experimental results together with some discus- sions about the results. Concluding remarks are contained in Sect. 5.

2 Traversal algorithm When hierarchical subdivision is used as a paradigm for ray tracing, the computation time is dominated by the time required to find intersections between rays and bounding volumes. Scherson and Caspary

80

(1987) reported that about 55% of the processing time is spent on finding intersections between rays and bounding volumes. Hence, in order to reduce the computation time as much as possible, it is essential to accelerate ray-volume intersection cal- culation. In this section, a new traversal approach is presented. Many ray-volume intersection calcu- lations can be pruned by this new algorithm. Thus, the computation time can be reduced. The idea is based on an observation: if two objects both have intersection with a ray, the object locat- ed in the neighborhood of the ray origin has a nearer intersection point than the farther one has. Therefore, for a given ray, we attempt to order all bounding volumes/objects from near to far and check them in this order. From the criteria for a good hierarchy suggested by Kay and Kajiya (1986), one inference can be drawn:

The distance between two octants in the hierarchy should reflect the true distance in the real world; that is, the farther apart they are in the hierarchy, the farther apart they are in the real world.

Here, the distance between two octants in a hierar- chy is defined as the number of edges of the path connecting them. By this inference, each octant in the hierarchy can be assigned a nonnegative integer equal to its distance from a pre-determined octant in the hierarchy. These numbers impose a partial order that defines a roughly near-to-far order on all octants for the pre-determined octant (see Fig. 1). We exploit this partial order to improve the traver- sal algorithm proposed by Kay and Kajiya (1986). This improvement works for rays originating from objects.

A

Fig. 1. A hierarchy. Numbers associated with octants are distances from a particular octant A. Those numbers constitute a partial order on all octants with respect to A

Page 3: An efficient hierarchicaltraversal algorithm for ray tracing

Given a ray that shoots from some object, we at- tempt to impose a partial order on all objects and bounding volumes according to their distances from the ray origin. Because each such ray fires from some object, it is natural to have a partial order for all octants with respect to the octant that corresponds to this object's bounding volume. By following this order, the intersection test can pro- gress nearly in the order in which objects and bounding volumes appear along the ray. We can employ the partial order alone to traverse the hierarchy. However, it may not be much im- provement, because the hierarchy built for a scene is not necessarily a good one. Hence, we try to traverse the hierarchy using the partial order along with some intermediate results obtained during the traversal. The heap used by Kay and Kajiya (1986)

is a good structure for storing the intermediate re- sults. The traversal algorithm presented in Fig. 2 ex- plores the hierarchy in the partial order just de- scribed, and exploits the Kay and Kajiya algorithm to prune some unnecessary intersection checks. This algorithm works for rays firing from some objects; for other rays, the Kay and Kajiya algo- rithm must be used. The partial order is not derived obviously. Instead of traversing from the root, we take the object from which the ray originates and all its siblings for intersection first and continue traversing these subtrees using the basic Kay and Kajiya (1986) traversal method. Once all these sub- trees have been completely traversed, we take the parent of the object and the parent's siblings into intersection check and go up the hierarchy in the same way.

Algorithm 1 (Hybrid Traversai) Given a ray and the scene definition, report the nearest ray-scene intersection.

Global Variables (1) t=distance to the nearest object pierced so

far (2) p = the nearest object pierced so far (3) HEAP

Local Variables subtree_traversed = the current subtree traversed

Remarks This algorithm calls a procedure, K&K-Tra- versing. This procedure is essentially the tra- versal algorithm presented by Kay and Kajiya, except that t and p are not initialized in K&K- Traversing. They are global for both algorithms.

Method Initialize t ~ oe Initialize p +-- nil

subtree_traversed~ the object from which the ray originates While subtree_traversed exists do the following

Reset HEAP Put subtree_traversed into HEAP as the first

candidate Call procedure K&K-Traversing subtree_traversed +-- parent of subtree_tra-

versed Endwhile

Fig. 2. The hybrid bottom-up and top-down algorithm

This approach has two merits: - when a ray originates from some object, it natu- rally has intersection with the parent of the object, the grandparent of the object, etc. Because we know that all ancestors of this object must have intersection with the ray, they can be put into the heap without testing. Hence, many intersection tests are avoided. - A l l bounding volumes/objects are checked roughly from near to far. As a result, an intersec- tion point that is near the ray origin can be ob- tained quickly. It can be used to prune more sub- trees. The local nearest-intersection point found when the tree is traversed according to the above strategy is not necessarily the global nearest-intersection point, because all bounding volumes at the same level may overlap. An example to illustrate the phe- nomenon is shown in Fig. 3. In other words, if all bounding volumes at the same level do not overlap, once we find the local nearest-intersection point of a subtree, this point is also the global nearest intersection point. Our algorithm differs from the algorithm described by Kay and Kajiya (1986) in that: - For rays originating from objects, their algo- rithm traverses from farther bounding volumes. Our algorithm searches from near to far, which means a near-optimal initial intersection point can be found quickly. - The Kay and Kajiya algorithm imposes a total order on all primitive objects. In our algorithm, a partial order is imposed on all bounding volumes

81

Page 4: An efficient hierarchicaltraversal algorithm for ray tracing

3

D / /

/ Ray S WORLD

W O R L D ~

C D

4

"A

C D E

a3

World

1 ............................ i

4 .....

5 .............

6 ........................... !

I I ....... ! ...................................

I [ ....................... I

.... If [ ........................

A I ................ l

I 1 I

a b c d e f

Fig. 3. Object world and its corresponding hierarchy. With the hybrid method for tracing ray S, the intersection point on object G is found first, but another object F has the nearest intersection point. Hence, the local nearest is not necessarily the global nearest

Fig. 4. Sample projected world�9 In region D, there exist 2 PBVs, a a and a 3 . Hence, when tracing pixels in this region, only the bounding volumes corresponding to PBVs a , and a3 must be checked

Fig. 5. PBV A resides between (b, 3) and (e, 5). When sweeping in this area, the bounding volume corresponding to A must be checked for intersection

and objects, and several total orders are almost maintained for objects in different subtrees.

3 Plane-sweep technique

All previous traversal algorithms perform intersec- tion checks from the hierarchy root. In this section, a modified algorithm that traverses from one or more extents (not necessarily from the root) is de- scribed.

82

If we know which areas in the image plane are empty, all pixels in those regions can be shaded directly with the background color without any ray-bounding volume intersection checks. The problem is how to determine which areas are empty. The most intuitive idea is to project the whole-scene bounding volume onto the image plane. All areas outside the projected bounding volume are empty. However, this bounding volume is usually not tight; in other words, many regions inside the projected volume are also empty.

Page 5: An efficient hierarchicaltraversal algorithm for ray tracing

In order to make more precise approximation, we select one level of the hierarchy and project all bounding volumes at this level onto the image plane. For this reason, areas outside the union of all projected bounding volumes are empty; thus, no ray-scene intersection can exist. In other words, it is not necessary to test for ray-scene intersec- tions. Here, after a bounding volume has been projected onto the image plane, its projected bounding vol- ume is enclosed with a box whose edges are parallel to the axes of the image coordinate system and the enclosing box is called PBV (projected bound- ing volume). If we project all bounding volumes at some level of the tree, another mechanism exists. This mecha- nism is illustrated by an example. In Fig. 4, there are three PBVs, called aa, a2, and a3 (marked at the bottom left corner of each PBV), in the image plane. They partition the image plane into six regions called A, B .. . . , and F. Region F is an empty region; therefore, it can be eliminated from further checking. Because there is one PBV, al , in region A, only the bounding volume corre- sponding to PBV al needs to be checked for inter- section. In region B, there are two. PBVs; therefore, only PBVs a~ and a 2 must be taken into considera- tion. Following the example above, the image plane is subdivided into regions bounded by PBVs. In each region, there are one or more PBVs. While the hier- archy is traversed for pixels in each region, only those bounding volumes whose PBVs overlap this region are checked for intersections. In other words, instead of traversing from the root, the hier- archy is traversed from one or more subtrees. With this method, a number of octants that are ancestors of those bounding volumes can be eliminated from intersection checks. To implement the above idea, a plane-sweep tech- nique is used to identify which PBVs overlap some region. The image plane is subdivided by all verti- cal sides of PBVs into a set of strips; each strip is further subdivided into regions by all horizontal sides of PBVs crossing the strip. Specifically, a PBV, say A, resides in all strips located between its left and right vertical sides. Furthermore, for all strips in which A appears, it overlaps all regions between its top and bottom horizontal sides (see Fig. 5 for details). The goal is to determine which PBVs appear in a given region. Figure 6 shows the outline of the plane-sweep algorithm.

Algorithm 2 (Plane-Sweep Ray-Tracing) Plane- Sweep Technique Description

Local Variables begin_x, begin_y, end_x, end_y: the region

boundaries of each strip sweep_x: array to store from left to right all

vertical sides of PBVs active_y: array to store from up to down all

horizontal sides of PBVs which cross the current strip

active_region: array to store all bounding vol- umes which must be traced

Method Step 1 Choose one level of the hierarchy and pro-

ject all nodes at the level onto the image plane to form PBVs.

Step 2 Sort abscissae of all PBVs from left to right and store the sorted abscissae into sweep x.

Step 3 Scan sweep_x. begin_x +-- the current entry end_x ~ the next entry If begin_x is a left side of a PBV then

Add the PBV's up and bottom sides into active_y.

Else Delete from active_y the PBV's up and bottom sides.

Endif. Sort active_y from up to down. Scan active_ y.

begin_y ~ the current entry end_y ~ the next entry If begin_y is an up side of a PBV then

Add the corresponding bounding volume into active_region.

Else Delete the corresponding bounding volume from active_region.

Endif. For all pixels (x, y) begin_x < x < end_x and begin_y < y < end_y

Put all bounding volumes in active_region into the heap.

Raytrace(x, y) Endfor.

EndScanY. EndScanX.

Fig. 6. The plane-sweep ray-tracing algorithm

83

Page 6: An efficient hierarchicaltraversal algorithm for ray tracing

Table 1. Statistics about test images

Pictures Objects Lights Secondary rays

Total Hit Hit ratio

Tetra 4096 1 46261 5543 Tree 8191 7 1090K 44K Mountain 8196 1 794 K 386 K Sphere 7382 3 1375 K 482 K Ring 8401 3 1372 K 602 K Gear 9345 5 2050 K 826 K

0.12 0.04 0.48 0.35 0.44 0.40

4 Experiments and discussion

Six wel l -known benchmarks p roposed by Haines (1987) are used to prove the feasibility of our algo- rithm. See Table 1 for details abou t those images. Figures 7-12 show those scenes. All images are ren- dered at 512x 512 pixel resolut ion on an IBM RISC 6000/520. The C p rog ramming language is used to implement our ideas and no anti-aliasing

techniques are used. The hierarchies built for these scenes are octrees ment ioned by Kay and Kaj iya (1986). Tables 2 and 3 show the exper imental data. Two different versions of the hierarchical traversal algo- r i thms are compared . Columns headed K & K list all statistics for the a lgor i thm proposed by Kay and Kaj iya (1986); columns headed Hybr id list all statistics of our hybr id t op -down and bo t tom-up algorithm, by which we test secondary rays, which fire f rom objects. The statistics items are parti- t ioned into three parts: one for statistics abou t eye rays; one for statistics abou t hit-rays, which are rays intersecting with at least one object; and one for statistics abou t miss-rays, which are rays not intersecting with any objects. Rows headed Reflect/ Ref rac t /Shadow-Ray are the total numbers of hit or miss rays; rows titled Eye/Reflect/Refract/Shad- ow-Extent express the total numbers of bounding volumes checked for intersection with the specific kind of rays; and rows marked Average are the

7 8

10

Fig. 7. Tetra scene

Fig. 10. Sphere scene

84

11

Fig. 8. Tree scene

Fig. 11. Ring scene

12

Fig. 9. Mountain scene

Fig. 12. Gear scene

Page 7: An efficient hierarchicaltraversal algorithm for ray tracing

Table 2. Experimental data for Tetra, Tree, and Mountain scenes

Tetra Tree Mountain

K&K Hybrid K&K Hybrid K&K Hybrid

Eye Total ray 262144 262144 262144 262144 262144 Eye-extent 3 778 K 3 778 K 20966 K 20966 K 14638 K Average 14.4 14.4 80.0 80.0 55.8 Miss ray 212195 212195 93246 93246 87406

Hit Reflect-ray - - 159 K Reflect-extent - - - 5499 K Average . . . . 34.6 Refi'act-ray . . . . 164 K Refract-extent . . . . 7 649 K Average . . . . 46.6 Shadow-ray 5 543 5 543 43 796 43 796 63 316 Shadow-extent 189 K 120 K 4706 K 1756 K 3 859 K Average 34.2 21.8 107.4 40.1 60.9

Miss Reflect-ray . . . . 78 286 Reflect-extent . . . . 2 646 K Average - - - 33.8 Refract-ray . . . . 105 K Refract-extent - - - 3 636 K Average . . . . 34.6 Shadow-ray 40 718 40 718 1046 K 1046 K 225 K Shadow-extent 1054 K 891 K 54161 K 48 932 K 11696 K Average 25.9 21.9 51.8 46.8 52.0

CPU time (second) 898 853 11403 10404 7 737 Speed-up ratio 1,0 1.05 1.0 l. 10 1.0

Table 3, Experimental data for Sphere, Ring, and Gear scenes

Sphere Ring Gear

262144 14638 K

55.8 87406

159 K 3407 K

21.4 164 K

5665 K 34.5

63316 2466 K

39.0

78286 2254 K

28.8 105 K

3111K 29.6

225 K 10572 K

47.0

6563 1.18

K & K Hybrid K&K Hybrid K&K Hybrid

Eye Total ray 262144 262144 262144 262144 Eye-extent 16198 K 16198 K 27401 K 27401 K Average 61.8 61.8 104.5 104.5 Miss ray 0 0 0 0

Hit Reflect-ray 168 K 168 K 139 K 139 K Reflect-extent 13075 K 9978 K 13234 K 9 865 K Average 77.9 59.5 94.9 71.0 Refract-ray - - Refract-extent - - - Average - Shadow-ray 314 K 314 K 462 K 462 K Shadow-extent 25730 K 21518 K 45 573 K 35500 K Average 81.8 68.4 98.6 76.8

Miss Reflect-ray 209 K 209 K 220 K 220 K Reflect-extent 9816 K 8768 K 13317 K 12215 K Average 46.8 41.8 60.4 55.4 Refract-ray - - - Refract-extent - - - Average Shadow-ray 683 K 683 K 550 K 550 K Shadow-extent 35938 K 32523 K 45190 K 42438 K Average 52.6 47.6 82.1 77.1

CPU time (second) 15079 13346 22842 20916 Speed-up ratio 1.0 1.13 1.0 1.09

262144 262144 12354 K 12354 K

47.1 47.1 17716 17716

124 K 124 K 7690 K 5810 K

62.2 47.1 l 1 7 K 117K

7 704 K 5706 K 66.0 48.9

586 K 586 K 37384 K 35033 K

63.8 59.8

82598 82598 3253 K 2840 K

39.4 34.4 19912 19912

985 K 885 K 49.3 44.3

1121 K 1121 K 51880K 46274 K

46.3 41.3

22316 20352 1.0 1.10

85

Page 8: An efficient hierarchicaltraversal algorithm for ray tracing

average numbers of bounding volumes checked for intersection with the specific kind of rays. K means exactly 1000, with all numbers rounded to the near- est K. From Tables 2 and 3, some characteristics of our algorithm should be pointed out:

- If a secondary ray hits some objects, our hybrid algorithm reduces the number of intersection cal- culations. In the Tree scene, the average number of bounding volumes checked for hit shadow rays is reduced from 107.4 (the Kay and Kajiya algo- rithm) to 40.1 (our algorithm). In other scenes, the average number of bounding volumes checked for hit-rays also decreases considerably.

- If a secondary ray does not hit any object, all bounding volumes having intersection with this ray will be visited. Hence, no matter which algorithm

is used to test the ray, they will traverse the same nodes, although the traversing orders may be dif- ferent. However, in our algorithm, fewer bounding volumes are tested, because all ancestors of the bounding volume from which the secondary ray shoots are put into a heap without performing in- tersection check. This assertion conforms to our experimental results. Our algorithm performs 4 to 5 fewer levels of object-hierarchy intersection checks than the original algorithm does. Tables 4 and 5 show the timing statistics for our hybrid algorithm combined with the plane-sweep technique. Four experimental runs with octant pro- jected at different levels (0--3) are executed for each scene. One factor that influences the performance of our method is the percentage of background color

Table 4. Experimental data of the hybrid algorithm with the plane-sweep technique (I)

Scene Level Eye rays

Total Miss Eye-extent

CPU time (second)

Speed up ratio

Tetra 0 255518 205 569 3771 K 850 1.06 1 162252 112303 2601 K 702 1.28 2 100419 50470 1245 K 526 1.71 3 87662 37713 407 K 419 2.14

Tree 0 262144 93246 20966 K 10887 1.05 1 262144 93246 19247 K 11013 1.04 2 262144 93 246 14 690 K 9364 1.22 3 262144 93246 7710 K 9123 1.25

Mounta in 0 262144 87406 14638 K 6656 1.16 1 261055 86317 13187 K 6497 1.19 2 259 761 85023 10731 K 6169 1.25 3 248307 73569 9121 K 6023 1.28

Table 5. Experimental data of the hybrid algorithm with the plane-sweep technique (II)

Scene Level Eye rays

Total Miss Eye-extent

CPU time (second)

Speed-up ratio

Sphere 0 262144 0 16198 K 1 262144 0 14646 K 2 262144 0 11008 K 3 262144 0 6551 K

Ring 0 262144 0 27400 K 1 262144 0 25972 K 2 262144 0 22185 K 3 262144 0 15795 K

Gear 0 262144 17716 12354 K 1 262144 17716 10705 K 2 262144 17716 9030 K 3 262144 17716 8124 K

13949 13506 12945 12278

21644 20807 20519 19540

20739 20169 19965 19823

1.08 1.12 1.16 1.23

1.06 1.10 1.11 1.17

1.08 1.11 1.12 1.13

86

Page 9: An efficient hierarchicaltraversal algorithm for ray tracing

(void space) seen directly by the viewpoint. If the empty space is large, our algorithm outperforms the original one. The Tetra scene in Fig. 7 is such a case, and the speed-up ratio for rendering this scene is 2.14. The level selected to project bounding volumes also has an impact on the performance. If a higher level is chosen, the unions of PBVs approximate the non-empty region of the image plane more precise- ly and fewer eye-rays are cast; moreover, more nodes that are ancestors of extents at the level se- lected can be eliminated in checking intersections.

5 Concluding remarks

One of the most important research issues in ray tracing is to reduce lengthy computation time. A large proportion of the computation time is spent checking ray-object intersection. We propose an algorithm to determine ray-object intersection effi- ciently. A new algorithm, which combines the tra- ditional top-down traversal with bottom-up searching, is explored to speed up ray tracing for secondary rays. We also develop a plane-sweep technique to cull out some unnecessary intersection checks for eye rays. All timing statistics prove that it is more efficient to render images with the algo- rithm presented. Spatial subdivision and hierarchical subdivision are two techniques that speed up ray tracing. Each technique has its advantages. Glassner (1988) has presented a technique that combines the advan- tages of the two techniques to create a good hierar- chy. Ongoing research is attempting to find proper- ties of one technique and try to incorporate t h e m into the other technique. With such deliberate com- position, the performance of ray tracing may be further improved.

Acknowledgement. This research was supported by the National Science Council of the Republic of China under grant No. NSC81-0408-E009-20.

References

Appel A (1968) Some techniques for shading machine render- ings of solids. Proc AFIPS Spring Joint Comput Conf 32:37-45

Arvo J, Kirk D (1988) A survey of ray tracing acceleration techniques. SIGGRAPH Tutorial on Introduction to Ray Tracing, pp 1-46

Fujimoto A, Tanaka T, Iwata K (1986) ARTS: accelerated ray- tracing system. I EEE Comput Graph Appl 6 (4):16-26

Glassner AS (1984) Space subdivision for fast ray tracing. IEEE Comput Graph Appl 4(10): 15-22

Glassner AS (1988) Spacetime ray tracing for animation. IEEE Comput Graph Appl 8 (2): 6~70

Haines EA (1987) A proposal for standard graphics enwron- ments (displays on displays). IEEE Comput Graph Appl 7(11):3 5

Kay TL, Kajiya JT (1986) Ray tracing complex scenes. Comput Graph 20(4):269 278

Rubin SM, Whitted T (1980) A three-dimensional representa- tion for fast rendering of complex scenes. Comput Graph 14(3): 111~116

Scherson ID, Caspary E (1987) Data structure and the time complexity of ray tracing. The Visual Computer 3:201-213

Weghorst H, Hooper G, Greenberg DP (1984) Improved com- putational methods for ray tracing. ACM Trans Graph 3 (1): 52-69

Whitted T (1980) An improved illumination model for shaded display. Commun ACM 23 (6): 343-349

HAO-REN KE was born on June 29, 1967, in Taipei, Taiw- an, Republic of China. He re- ceived his B.S. degree in Com- puter Science in 1989 from the National Chiao Tung Universi- ty. Currently, he is a Ph.D. stu- dent in the Department of Computer and Information Sci- ence at the National Chiao Tung University. His current research interests include ray tracing and rendering algo- rithms for scientific visualiza- tion.

RUEI-CHUAN CHANG was born on January 30, 1958, in Keelung, Taiwan, Republic of China. He received his B.S. de- gree in 1979, M.S. degree in 1981, and Ph.D. degree in 1984, all in Computer Science from the National Chiao Tung Uni- versity. Currently, he is a pro- fessor in the Department of Computer and Information Sci- ence at the National Chiao Tung University in Hsinchu. He is also an associate research fel- low at the Institute of Informa- tion Science, Academia Sinica,

Taipei. His current research interests include design and analy- sis of algorithms, computer graphics, and system software.

87