Exploiting Temporal Coherence in Ray Casted Walkthroughs
Exploiting Temporal Coherence in Ray Casted Walkthroughs
Exploiting Temporal Coherence in Ray Casted Walkthroughs
4 Reprojection Errors To solve the view frustum error we check if the current
camera position is outside the view frustum of the previous
Reprojecting points from 3D space onto the image plane camera position. In such a case we skip the reprojection
does not guarantee the correctness of results for ray cast- phase and compute visibility of all pixels by the ORSA.
ing. There are two cases when the reprojection can fail: However, since in a walkthrough the camera is typically
the view frustum error and the occlusion error. Similar moving forward or rotates, the reprojection is almost al-
sources of error in the context of image based rendering ways possible. Note that the view frustum error cannot
are called the external and internal exposure errors [19]. occur for objects that appear in the view frustum due to
We discuss these two errors in the context of our ray cast- camera rotation. Such objects are either behind entries in
ing algorithm and suggest methods to handle them. P OSi1 array (if also translation forward is involved) or
there are no entries for the corresponding pixel and thus distance on V Pi for the reprojected point is smaller, the
the ORSA is invoked. point is a possible source of occlusion error and we dis-
card it from the reprojection.
To determine the correct reprojection order we subdi-
4.2 Occlusion Error
vide the image plane V Pi1 into four quadrants according
The occlusion error is caused by appearance of previously to the epipole Ei1. Within each quadrant we apply a dif-
occluded objects. If an occluded object becomes visible at ferent processing order of the points to guarantee that the
a pixel (x, y), it is possible that the reprojection suggests reprojected point has a larger distance from the epipole
that another object is visible at (x, y). This follows from Ei1 than the previously projected points [18][page 62].
the fact that we have no information about the previously The ordering is illustrated at the top of Figure 4.
occluded objects or their occluded parts.
The occlusion error is illustrated in Fig. 3. For the
camera position C1 object Y occludes object X between
points c and d. For the camera position C2 the points on X
between b and c reproject to the new viewing plane. Thus
if there was a previously occluded object in the marked
quadrilateral, it is missed by the reprojection phase. The
reprojection cannot determine in advance whether there is
an occluded object. We apply a method that identifies re-
projected points that interfere with previously occluded re-
gions in the reprojection (between b and c in our example).
The occlusion problem has been dealt in the context of Figure 4: (Top) The order of point reprojection with re-
image based rendering [19, 18], volumetric rendering [12], spect to the V Pi1. (Bottom) Result of the reprojection
and visibility preprocessing [16]. Our solution to the prob- to V Pi . The order of reprojection and the min/max repre-
lem is an extension of the method of Gudmundsson [12]. sentation of the already projected points identifies possible
We apply a verification of a reprojected point with respect occlusion problems.
to the previously reprojected points that is based on their
depths. If the verification fails we discard the reprojected To check if the distance of a reprojected point from the
point. epipole E2 is increased we keep maximal orthogonal dis-
The verification technique exploits properties of epipo- tances of already reprojected points for each column and
lar geometry of two camera positions. We project the row of AIPi . For each reprojected point we compute its
current camera position Ci to the previous viewing plane vertical distance to the row of the epipole and its horizon-
V Pi1 to obtain the epipole Ei1. Similarly we project tal distance to the column of the epipole. These distances
Ci1 to V Pi to obtain the epipole Ei. The points are are compared with the min/max distances (depending on
reprojected in an order of increasing distance from the the quadrant) stored at the column and the row the point
epipole Ei1 on V Pi1. We check if the points exhibit projects to. If both distances are increased (in absolute
increasing distance from the epipole Ei on V Pi . If the values) we update min/max for the row and the column
and insert the reprojected point to AIPi . Otherwise the distance at each frame. We assume that the object Os that
point is discarded since it can be a source of the occlusion we want to detect is attached to a larger already visible ob-
error. The described processed is illustrated in Figure 4. ject. Thus we compute , taking t as a signed distance of
each reprojected point. is compared with the size of the
4.3 Undersampling Errors camera movement. If the camera movement is larger than
, the point is approaching the camera too fast and it is
The errors discussed above can occur due to missing in- discarded from the reprojection.
formation about invisible scene objects either due to view Setting N = 9 in this context is theoretically correct
frustum restrictions or due to occlusion. In this section we but very conservative. In practice, setting N = 4 was
discuss an additional source of error that can occur due to sufficient and did not result in any visible artifacts in our
the discrete character of the method, namely the insuffi- test walkthroughs.
cient sampling density.
Ray casting computes visibility of scene objects by sam-
pling and so some small objects (below pixel size) can 5 Implementation
be missed. As the camera is moving the objects should
become visible, but since we have no information about In this section we briefly discuss the implementation issues
these objects they cannot be handled by the reprojection. and two optimization techniques.
As a solution to the problem we suggest to use regular
resampling in the spatio-temporal domain. For each N -
th frame we compute some pixels of the image using the 5.1 Implementing Reprojection
ORSA. We use disjoint sets of pixels for each of the N
The reprojection of a point is applied for each entry of the
subsequent images, which guarantees that after N frames
P OS array. Therefore an efficient implementation of the
all the pixels in N images were at least once computed
reprojection is a key to achieve performance improvement
exactly by the ORSA. We used N = 9, thus in each
of the proposed method.
frame we compute one pixel in a window of 3 3 pix-
Unlike reprojection algorithms used in image-based
els using the ORSA (see Figure 5). The sampling pattern
rendering [19, 18], we need to compute a signed dis-
aims to minimize discrepancy in the spatio-temporal do-
tance of the reprojected point from the camera center (re-
main for straightforward camera motion. The pattern has
quired in Algorithm 1). Our implementation of reprojec-
been found experimentally by computing discrepancy of
tion based on the principle component of camera forward
all possible patterns for 3 3 window. ~ precomputes 7 coefficients that are valid for the
vector N
whole image. The reprojection of one 3D point requires
the following operations: 8 (+), 3 (), 12 (), 1
(/), 1 ( ), and 2 (IF ). In our implementation the
reprojection takes time comparable to computation of an
intersection between a ray and a sphere. Thus it is reason-
ably fast not to become a bottleneck of the method.
As the ORSA we use a ray shooting algorithm using a Table 1: Results for the townhouse scene (85k objects).
kd-tree built according to the surface area heuristics with The walkthrough consists of 825 frames. TR is the total
split-clipping [13]. The reprojection algorithm was im- time of rendering (including Phong shading), FR is the
plemented in C++ and compiled using gcc-3.0.3 compiler. average frame rate. ORSA is the ordinary ray shooting
The tests were conducted on a PC equipped with AMD algorithm based on a kd-tree for each pixel. REP R1 is the
Athlon 1.1 GHz, 768 MB RAM, running Linux. reprojection algorithm as described in Section 3. REP R2
We have tested our reprojection algorithm on walk- is REP R1 combined with shifting ray origin. IRSA is
N IT < 1 since
an ideal ray shooting algorithm; note that N
throughs of three different scenes: townhouse, office,
and theatre. The townhouse scene contains 85k objects a background is visible.
Method TR FR IT
N T S
N cE [%] cR [%]
(see snapshot in Fig. 6-left). The office scene contains
626k objects. The theatre scene contains 112k objects. ORSA 979.6 1.19 3.79 58.1
The walkthroughs were rendered in resolution of 512512 REP R1 837.9 1.39 2.73 26.0 31.1 57.8
pixels. REP R2 835.9 1.39 2.69 24.6 31.1 57.8
In order to quantify the success of the reprojection we IRSA 373.8 3.11 0.999 0.0
compute the percentage of pixels computed by the single
ray/object intersection (cR [%]) and by the ORSA due to Table 2: Results for the theatre scene (112k objects). The
failure of the reprojection (cE [%]). The number of pixels walkthrough consists of 1165 frames.
computed by the ORSA due to regular resampling was Method TR FR IT
N T S
N cE [%] cR [%]
constant for all walkthroughs (cO = 11.1%). The results ORSA 892.3 1.66 3.02 44.5
show the performance of the ORSA, two variants of our REP R1 789.4 1.89 1.89 21.9 33.6 55.3
reprojection method (REP R1 and REP R2), and an ideal REP R2 801.5 1.85 1.88 21.7 33.6 55.3
ray shooting algorithm IRSA. The ideal ray shooting
IRSA 354.6 4.19 0.71 0.0
algorithm[13] is an abstract concept that uses the results
of the ORSA to determine the performance of computing Table 3: Results for the theatre scene (626k objects). The
ray/object intersections if the intersected object is already walkthrough consists of 1489 frames.
known. The results are summarized in Table 1, 2, and 3.
The proposed method achieves the following increase
of the average frame rates: 1.17 to 1.72 for the townhouse
scene, 1.66 to 1.89 for the office scene, 1.19 to 1.39 for the ideal ray shooting algorithm IRSA. These numbers
the theatre scene. We note that the ORSA used in our test include time of shading at the computed ray/object inter-
is an already highly optimized algorithm that is considered section points. If we exclude time for shading and eval-
one of the most efficient ray shooting techniques [29]. The uate speedups for pure visibility computation, we achieve
reprojection algorithm would provide a more significant frame rate increases for computing visibility between 18%
speedup for less efficient ray shooting algorithms. and 82%. This evaluation is based on code profiling; the
profiler reported that about 30% of the total rendering time
of the ORSA was spent in the shading routine.
7 Discussion The speedup obtained by the reprojection is propor-
tional to the number of pixels the reprojection succeeds
7.1 Visual Quality on. The utilization of reprojection increases with the reso-
Firstly, we verified the visual quality of the generated im- lution of generated images and decreases with the number
ages. As a reference we used images generated by the of visible silhouettes and their length. The length of the
ORSA on the same walkthrough sequence. We did not silhouettes in the image increases linearly with resolution,
observe any visual artifacts caused by the reprojection for but the number of pixels rendered increases quadratically.
all tested walkthroughs. This suggests that the presented method has a greater po-
tential for a high resolution rendering.
Surprisingly we have observed that the acceleration
7.2 Speedup
technique that shifts the ray origin (REP R2) did not per-
We increased the frame rates from 14% to 47% and form as well as expected. It provided a slight speedup
achieved the performance 1.70 to 2.23 times slower than for the theatre scene, but for the office scene it led to a
slight performance loss. We conclude that this is caused and proposed methods that handle these errors. In par-
by its computational overhead that is simply too high to ticular we used splatting, checking camera position with
further improve the already quite efficient ray casting im- respect to the view frustum, ordered reprojection, regular
plementation. The technique for handling the background resampling, and handling abrupt camera motion. We sug-
is computationally inexpensive, but since the tested scenes gested two optimization techniques to handle the image
did not contain many empty pixels its impact could not be background and to accelerate ray traversal by shifting the
properly evaluated. ray origin.
We verified our algorithm by a series of tests. On the
tested walkthrough sequences the reprojection succeeded
7.3 Limits of Ray Casting Acceleration in determining of up to 78% pixels. The frame rate was
increased approximately by 14 to 47% for moderately
We discuss the limits of ray casting acceleration and relate
sized scenes. We discussed the achieved results in the
the speedup provided by our technique to these limits. Our
context of the limits of ray shooting acceleration. We
discussion is based on the abstract concept of the ideal ray
have shown that the proposed technique is relatively close
shooting algorithm (IRSA) that knows exactly which ob-
to the ideal ray shooting algorithm. In particular it is
ject is intersected by the given ray. In other words such an
1.70 to 2.23 times slower than the ideal state. This obser-
algorithm acts as an ideal predictor for each input ray.
vation suggests that a further purely algorithmic accelera-
The experimental measurements (Tables 1, 2, and 3)
tion of ray casting with conservative results is very com-
show that even the ORSA based on kd-trees is rela-
plicated. We see a greater potential for acceleration by
tively close to the optimal algorithm: it is 1.93 to 2.75
reducing the number of rays cast or by explicit paralleliza-
times slower than IRSA for the tested scenes. Also the
tion.
hardware-independent values such as number of ray/object
In the future we plan to investigate properties of our al-
intersections and the number of traversal steps are very
gorithm in context of global illumination methods. We
close to ideal state. Thus the space for an improvement
would also like to extend the algorithm for scenes with
is already quite small. The main reason why the perfor-
moving objects.
mance increase of our method is relatively small (14% to
47%) is the proximity of the achieved running time to the
IRSA. Judging from these results we conjecture that fur- Acknowledgements
ther algorithmic acceleration of ray shooting is very com-
plicated. We see a greater potential for acceleration by re- Here, we want to thank Philippe Bekaert for providing
ducing the number of rays cast [23] (thus obtaining less us the scene models for research purposes and Jaroslav
precise images) or by exploiting explicitly parallel com- Krivanek for having comments on previous version of the
putations [29]. paper. Further, we would like to thank all anonymous re-
viewers of the previous version of the paper. This work has
been partially supported by the Austrian Science Founda-
7.4 Extension for Shadow Rays tion (FWF) contract no. p-13876-INF and by IST 2001-
In the scope of ray tracing it is significantly more difficult 34744 funding.
to exploit temporal coherence of secondary rays than the
coherence of primary rays [1]. For a moving camera the
secondary rays have low coherence with respect to direc-
References
tions and origins of the rays in the previous frame. How- [1] S.J. Adelson and L.F. Hodges, Generating exact
ever, the reprojection can be extended to handle direct il- ray-traced animation frames by reprojection, j-
lumination by point-light sources similarly to method of IEEE-CGA, 15(3):4352, 1995.
Adelson [1]. This technique can also be extended to han-
[2] A. Appel, Some techniques for shading machine
dle area light sources approximately.
renderings of solids, in AFIPS 1968 Spring Joint
Computer Conf., vol. 32, pp. 3745, 1968.
[3] J. Arvo and D. Kirk, A survey of ray tracing accel-
8 Conclusion and Future Work eration techniques, pp. 201262. Academic Press,
We presented a novel method for ray casting acceleration 1989.
that exploits temporal coherence in the scope of walk- [4] J.S. Badt, Two algorithms for taking advantage
throughs of static scenes. The proposed method uses re- of temporal coherence in ray tracing, The Visual
projection of the set of visible points from the previous Computer, 4(3), pp. 123132, 1988.
frame to guide ray casting in the current frame. The aim [5] J. Bittner and V. Havran, Exploiting temporal and
of our technique was to eliminate the ray traversal and to spatial coherence in hierarchical visibility algo-
compute only a single ray/object intersection per pixel. We rithms, in Journal of Visualization & Computer
discussed several source of errors due to the reprojection Animation, 12(5):277286, 2001.
(a) (b)
Figure 6: (a) A snapshot from a walkthrough of the townhouse scene. (b) Visualization of the reprojection and the ren-
dering phases. Red pixels are computed successfully by a single ray/object intersection, green pixels have been computed
exactly by the ORSA due to reprojection failure, white pixels are computed by the ORSA due to regular resampling, and
blue pixels are computed by the ORSA due to detection of abrupt camera motion. The profiler reported 14.7% of time
spent by reprojection phase, 41.4% spent by computing the normal and Phong shading, 2% spent by the initialization of
rays, 25.5% spent by the ORSA, 3.24% spent by computing single ray/object intersection, and the rest (13.2%) spent in
the main ray casting function.
[6] Catmull, E.E. (1975). Computer display of curved ceedings in The First Conference on Visualization
surfaces. In Proceedings of the IEEE Conference on in Biomedical Computing, Atlanta, 1990.
Computer Graphics, Pattern Recognition, and Data
Structure, 1117. [13] V. Havran, Heuristic Ray Shooting Algorithms. PhD
thesis, Czech Technical University in Prague, Nov.
[7] S. Coorg and S. Teller, Temporally coherent con- 2000.
servative visibility, in Proceedings of the Twelfth
Annual Symposium On Computational Geometry [14] H. Hey and W. Purgathofer, Occlusion culling
(ISG 96), pp. 7887, ACM Press, May 1996. methods, in STAR in Eurographics 2001, Euro-
[8] S. Coorg and S. Teller, A spatially and temporally graphics Association, Sept. 2001.
coherent object space visibility algorithm, Tech. [15] Q. Lin, P.-E. Danielson, and B. Gudmunson,
Rep. TM-546, Department of Computer Graphics, Frame-coherent volume rendering, in Proceed-
MIT, Feb. 1996. ings of the IASTED International Conferent, COM-
[9] J. Demers, I. Yoon, T.-Y. Kim, and U. Neumann, PUTER GRAPHICS AND IMAGING, Nov. 2000.
Accelerating ray tracing by exploiting frame-
to-frame coherence, Technical Report 1998/668, [16] X. Liu, H. Sun, and E. Wu, Visibility preprocess-
Computer Science Department, The University of ing with occluder fusion for urban walkthroughs,
Southern California, Los Angeles, 1998. Proceedings of VRST2000, pp. 55-60, 2000.
[10] F. Durand, 3D Visibility: Analytical Study and Ap- [17] W. Martin, S. Parker, P. Shirley, and W. Thomp-
plications. PhD thesis, Universite Joseph Fourier, son, Temporally coherent interactive ray tracing,
Grenoble, France, July 1999. Tech. Rep. UUCS-01-005, Computer Science De-
[11] N. Greene and M. Kass, Hierarchical Z-buffer vis- partment, University of Utah, May 2001.
ibility, in Proc. of SIGGRAPH93, pp. 231240, [18] W.R. Mark, Post-Rendering 3D Image Warping:
1993. Visibility, Reconstruction, and Performance for
[12] B. Gudmundsson and M. Randen, Incremental Depth-Image Warping. PhD thesis, Chapel Hill,
generation of projections of ct-volumes., in In Pro- University of North Carolina, 1999.
[19] L. McMillan, An Image-Based Approach to Three-
Dimensional Computer Graphics. PhD thesis,
Chapel Hill, University of North Carolina, 1997.
[20] H. Pfister, M. Zwicker, J. van Baar, and M. Gross,
Surfels: Surface elements as rendering primi-
tives, in Siggraph 2000, Computer Graphics Pro-
ceedings, pp. 335342, 2000.
[21] E. Reinhard, P. Shirley, and C. Hansen, Paral-
lel point reprojection, in Proceedings of the 2001
IEEE Symposium on Parallel and Large-Data Visu-
alization and Graphics, Oct. 2001.
[22] S. Rusinkiewicz and M. Levoy, QSplat: A
multiresolution point rendering system for large
meshes, in Siggraph 2000, Computer Graphics
Proceedings, pp. 343352, 2000.
[23] A. Scheel, M. Stamminger, J. Putz, and H.-P.
Seidel, Enhancements to Directional Coherence
Maps, in Proceedings of WSCG01, pp. 403410,
2001.
[24] M. Simmons, A dynamic mesh display representa-
tion for the holodeck ray cache system, Tech. Rep.
CSD-00-1090, University of California, Berkeley,
2000.
[25] M. Simmons, C.H. Sequin, Tapestry: A Dynamic
Mesh-based Display Representation for Interactive
Rendering, in Rendering Techniques 00, pp. 329-
340, 2000.
[26] O. Sudarsky, Exploiting temporal coherence in
animation rendering, Technical Report CIS9326,
Technion - Computer Science Department, Israel,
1993.
[27] L. Szirmay-Kalos and G. Marton. Worst-case ver-
sus average case complexity of ray-shooting. Com-
puting, 61(2):103131, 1998.
[28] S. Teller and J. Allex, Frustum casting for progres-
sive, interactive rendering, Tech. Rep. MIT LCS
TR-740, MIT, Jan. 1998.
[29] I. Wald, P. Slusallek, C. Benthin, and M. Wagner,
Interactive rendering with coherent ray tracing,
in EG 2001 Proceedings, vol. 20(3) of Computer
Graphics Forum, pp. 153164, 2001.
[30] B. Walter, G. Drettakis, and S. Parker, Interactive
rendering using render cache, in Rendering Tech-
niques 99, pp. 1930, 1999.
[31] R. Yagel and Z. Shi, Accelerating volume anima-
tion by space-leaping, in Proceedings of Visualiza-
tion93, pp. 6269, Oct. 1993.