![Page 1: Compact, Fast and Robust Grids for Ray Tracing](https://reader033.vdocuments.net/reader033/viewer/2022051622/568152e7550346895dc10554/html5/thumbnails/1.jpg)
Compact, Fast and RobustGrids for Ray Tracing
Ares Lagae & Philip Dutré
19th Eurographics Symposium on Rendering
EGSR 2008 Wednesday, June 25th
![Page 2: Compact, Fast and Robust Grids for Ray Tracing](https://reader033.vdocuments.net/reader033/viewer/2022051622/568152e7550346895dc10554/html5/thumbnails/2.jpg)
Introduction
• Acceleration structures for ray tracing– Kd-tree, BVH, …
• Build time: slower (super-linear)• Render time: faster
– Grid• Build time: faster (linear)• Render time: slower
Minimize time to image– Time to image = render time + build time– Especially for dynamic scenes
![Page 3: Compact, Fast and Robust Grids for Ray Tracing](https://reader033.vdocuments.net/reader033/viewer/2022051622/568152e7550346895dc10554/html5/thumbnails/3.jpg)
Introduction
• Algorithms in general– CPU-bound
• Execution time = f( CPU speed )
– Memory-bound• Execution time = f( memory speed )
Accelerate by decreasing memory footprint
Minimize memory footprint– Especially for large models
![Page 4: Compact, Fast and Robust Grids for Ray Tracing](https://reader033.vdocuments.net/reader033/viewer/2022051622/568152e7550346895dc10554/html5/thumbnails/4.jpg)
Grid Data Structures
• Grid and linearized grid
2
1
0
0 1 2
0 1 2 3 4 5 6 7 8
2D
1D
linea
rize
0
1
2
![Page 5: Compact, Fast and Robust Grids for Ray Tracing](https://reader033.vdocuments.net/reader033/viewer/2022051622/568152e7550346895dc10554/html5/thumbnails/5.jpg)
Grid Data Structures
• Data structure using linked lists0 1 2 3 4 5 6 7 8
1 1 0 2
1
0
2 0 2 2
1
• 1 word / cell
• 2/3 words / object reference
![Page 6: Compact, Fast and Robust Grids for Ray Tracing](https://reader033.vdocuments.net/reader033/viewer/2022051622/568152e7550346895dc10554/html5/thumbnails/6.jpg)
Grid Data Structures
• Data structure using dynamic arrays0 1 2 3 4 5 6 7 8
1 1 0 0
1
2
1
2
0 2 2
2 0 2 1 2 1 2 1 4 3 2 2 2 1 2 1 2 1
• 3 words / cell
• 1-2 words / object reference : unused space
![Page 7: Compact, Fast and Robust Grids for Ray Tracing](https://reader033.vdocuments.net/reader033/viewer/2022051622/568152e7550346895dc10554/html5/thumbnails/7.jpg)
Compact Grid
• Data structure– Concatenate object lists, store begin index
0 0 1 2 6 8 9 10
0 1 2 3 4 5 6 7 8
11
1 1 0 0 1 1 2 0 2 2
0 1 2 3 4 5 6 7 8 9 10 11
1 word / cell, 1 word / object reference
3
2
![Page 8: Compact, Fast and Robust Grids for Ray Tracing](https://reader033.vdocuments.net/reader033/viewer/2022051622/568152e7550346895dc10554/html5/thumbnails/8.jpg)
3i i
NM S
V
Compact Grid
• Build algorithm (Bound – Count – Accumulate – Insert)
1. Bound Compute bounding box of objects
Determine grid resolution
Grid size linear in number of objects
![Page 9: Compact, Fast and Robust Grids for Ray Tracing](https://reader033.vdocuments.net/reader033/viewer/2022051622/568152e7550346895dc10554/html5/thumbnails/9.jpg)
Compact Grid
• Build algorithm (Bound – Count – Accumulate – Insert)
2. Count Compute size of object lists (1st pass)
0 1 1 1 2 1 1 1
0 1 2 3 4 5 6 7 8
0 1 2 3 4 5 6 7 8 9 10 11
3
![Page 10: Compact, Fast and Robust Grids for Ray Tracing](https://reader033.vdocuments.net/reader033/viewer/2022051622/568152e7550346895dc10554/html5/thumbnails/10.jpg)
Compact Grid
• Build algorithm (Bound – Count – Accumulate – Insert)
3. Accumulate Compute indices of object lists
0 1 2 3 8 9 10 11
0 1 2 3 4 5 6 7 8
0 1 2 3 4 5 6 7 8 9 10 11
6
![Page 11: Compact, Fast and Robust Grids for Ray Tracing](https://reader033.vdocuments.net/reader033/viewer/2022051622/568152e7550346895dc10554/html5/thumbnails/11.jpg)
Compact Grid
• Build algorithm (Bound – Count – Accumulate – Insert)
4. Insert Reversely insert the object references (2nd pass)
0 0 1 2 6 8 9 10
0 1 2 3 4 5 6 7 8
1 1 0 0 1 1 2 0 2 2
0 1 2 3 4 5 6 7 8 9 10 11
2
3
![Page 12: Compact, Fast and Robust Grids for Ray Tracing](https://reader033.vdocuments.net/reader033/viewer/2022051622/568152e7550346895dc10554/html5/thumbnails/12.jpg)
Compact Grid
• Build algorithm– Time complexity
Linear in the number of objects
– Space complexity Linear in the number of objects
• Traversal algorithm– Any grid traversal algorithm
![Page 13: Compact, Fast and Robust Grids for Ray Tracing](https://reader033.vdocuments.net/reader033/viewer/2022051622/568152e7550346895dc10554/html5/thumbnails/13.jpg)
Hashed Grid
• Reduce memory footprint even further– Fast build algorithm– Efficient access during traversal
• Redundancy– Object lists? no
Experiments with object list compression failed
– Cells? yesGrid is sparse, up to 99% of the cells are empty
![Page 14: Compact, Fast and Robust Grids for Ray Tracing](https://reader033.vdocuments.net/reader033/viewer/2022051622/568152e7550346895dc10554/html5/thumbnails/14.jpg)
Hashed Grid
• Row displacement compression
1
5
11
12 15
C
![Page 15: Compact, Fast and Robust Grids for Ray Tracing](https://reader033.vdocuments.net/reader033/viewer/2022051622/568152e7550346895dc10554/html5/thumbnails/15.jpg)
Hashed Grid
• Row displacement compression
1
5
11
12 15
C O
H
![Page 16: Compact, Fast and Robust Grids for Ray Tracing](https://reader033.vdocuments.net/reader033/viewer/2022051622/568152e7550346895dc10554/html5/thumbnails/16.jpg)
Hashed Grid
• Row displacement compression
1
5
11
12 15
1
1
C O
H
0
![Page 17: Compact, Fast and Robust Grids for Ray Tracing](https://reader033.vdocuments.net/reader033/viewer/2022051622/568152e7550346895dc10554/html5/thumbnails/17.jpg)
Hashed Grid
• Row displacement compression
1
5
11
12 15
1
5
1 5
C O
H
0
1
![Page 18: Compact, Fast and Robust Grids for Ray Tracing](https://reader033.vdocuments.net/reader033/viewer/2022051622/568152e7550346895dc10554/html5/thumbnails/18.jpg)
Hashed Grid
• Row displacement compression
1
5
11
12 15
1
5
11
111 5
C O
H
0
1
1
![Page 19: Compact, Fast and Robust Grids for Ray Tracing](https://reader033.vdocuments.net/reader033/viewer/2022051622/568152e7550346895dc10554/html5/thumbnails/19.jpg)
Hashed Grid
• Row displacement compression
1
5
11
12 15
1
5
11
12 15
12 11 151 5
C O
H
0
1
1
3
![Page 20: Compact, Fast and Robust Grids for Ray Tracing](https://reader033.vdocuments.net/reader033/viewer/2022051622/568152e7550346895dc10554/html5/thumbnails/20.jpg)
Hashed Grid
• Row displacement compression
12 11 151 5
O
HC[i,j] H[O[i] + j]
0
1
1
3
![Page 21: Compact, Fast and Robust Grids for Ray Tracing](https://reader033.vdocuments.net/reader033/viewer/2022051622/568152e7550346895dc10554/html5/thumbnails/21.jpg)
Hashed Grid
• Row displacement compression
12 11 151 5
D O
H|D| + |O| + |H| << |C|
0
1
1
3
![Page 22: Compact, Fast and Robust Grids for Ray Tracing](https://reader033.vdocuments.net/reader033/viewer/2022051622/568152e7550346895dc10554/html5/thumbnails/22.jpg)
4/3( ) ( )O M O M
Hashed Grid
• Build algorithm– Bound– Compute domain bits– Compute hash function– Count– Accumulate– Insert
• Time complexity:
![Page 23: Compact, Fast and Robust Grids for Ray Tracing](https://reader033.vdocuments.net/reader033/viewer/2022051622/568152e7550346895dc10554/html5/thumbnails/23.jpg)
Results
• Comparison traditional grid data structures
Memory usage Build time
![Page 24: Compact, Fast and Robust Grids for Ray Tracing](https://reader033.vdocuments.net/reader033/viewer/2022051622/568152e7550346895dc10554/html5/thumbnails/24.jpg)
Results
• Hashed grid
Tha
i Sta
tue
• Scene: 28.06 M triangles, 343.32 MB
• Memory object lists: 69.78 MB
• Memory cells: 152.75 MB 8.97 MB
• Build time: 1.17 s 1.76 s
• Render time: 1.55 s 1.43 s
Cru
iser
• Scene: 3.64 M triangles, 124.84 MB
• Memory object lists: 28.84 MB
• Memory cells: 55.48 MB 6.20 MB
• Build time: 0.39 s 0.72 s
• Render time: 2.49 s 2.52 s
![Page 25: Compact, Fast and Robust Grids for Ray Tracing](https://reader033.vdocuments.net/reader033/viewer/2022051622/568152e7550346895dc10554/html5/thumbnails/25.jpg)
Applications
• Interactive ray tracing of dynamic scenes
Scene: 260 K triangles - FPS: 8.38 FPS (512 x 512)
![Page 26: Compact, Fast and Robust Grids for Ray Tracing](https://reader033.vdocuments.net/reader033/viewer/2022051622/568152e7550346895dc10554/html5/thumbnails/26.jpg)
Applications
• Ray tracing large models
St.
Mat
thew • Scene: 372.77 M triangles, 12.50 GB
• Time to image: - / 60.75 s
• Memory usage: - / 2.36 GB
Dav
id
• Scene: 56.23 M triangles, 1.89 GB
• Time to image: 7.55 s / 10.21 s
• Memory usage: 1.17 GB / 379.94 MB
![Page 27: Compact, Fast and Robust Grids for Ray Tracing](https://reader033.vdocuments.net/reader033/viewer/2022051622/568152e7550346895dc10554/html5/thumbnails/27.jpg)
Conclusion & Future Work
• Conclusion– Compact grid method
Optimal grid representation (1 word / cell, 1 word / object reference)
– Hashed grid method Applied perfect spatial hashing to grids for ray tracing
• Future Work– Extend to hierarchical grids– Extend to other acceleration structures
![Page 28: Compact, Fast and Robust Grids for Ray Tracing](https://reader033.vdocuments.net/reader033/viewer/2022051622/568152e7550346895dc10554/html5/thumbnails/28.jpg)
Thanks!
• Questions?
AcknowledgmentsAres Lagae is a Postdoctoral Fellow of the Research Foundation Flanders (FWO)The Stanford 3D Scanning Repository, The Digital Michelangelo Project, the bwfirt benchmark, Matthias Rolf, Bernhard Finkbeiner and Greg Ward
![Page 29: Compact, Fast and Robust Grids for Ray Tracing](https://reader033.vdocuments.net/reader033/viewer/2022051622/568152e7550346895dc10554/html5/thumbnails/29.jpg)
![Page 30: Compact, Fast and Robust Grids for Ray Tracing](https://reader033.vdocuments.net/reader033/viewer/2022051622/568152e7550346895dc10554/html5/thumbnails/30.jpg)
Robust Grid Traversal
• Discard intersections outside of cell Not robust
{}
{…}
![Page 31: Compact, Fast and Robust Grids for Ray Tracing](https://reader033.vdocuments.net/reader033/viewer/2022051622/568152e7550346895dc10554/html5/thumbnails/31.jpg)
Robust Grid Traversal
• Discard intersections outside of cell Not robust
Regular grid traversal
![Page 32: Compact, Fast and Robust Grids for Ray Tracing](https://reader033.vdocuments.net/reader033/viewer/2022051622/568152e7550346895dc10554/html5/thumbnails/32.jpg)
Robust Grid Traversal
Do not discard intersections outside of cell– Keep closest intersection, terminate after the intersection
Regular grid traversal Robust grid traversal
![Page 33: Compact, Fast and Robust Grids for Ray Tracing](https://reader033.vdocuments.net/reader033/viewer/2022051622/568152e7550346895dc10554/html5/thumbnails/33.jpg)
Parallelization
• Using sort-middle approach of Ize et al.
Asian Dragon Nature
![Page 34: Compact, Fast and Robust Grids for Ray Tracing](https://reader033.vdocuments.net/reader033/viewer/2022051622/568152e7550346895dc10554/html5/thumbnails/34.jpg)
![Page 35: Compact, Fast and Robust Grids for Ray Tracing](https://reader033.vdocuments.net/reader033/viewer/2022051622/568152e7550346895dc10554/html5/thumbnails/35.jpg)
Results
• Comparison traditional grid data structures
Memory usage Build time
![Page 36: Compact, Fast and Robust Grids for Ray Tracing](https://reader033.vdocuments.net/reader033/viewer/2022051622/568152e7550346895dc10554/html5/thumbnails/36.jpg)
Parallelization
• Using sort-middle approach of Ize et al.
Asian Dragon Nature
![Page 37: Compact, Fast and Robust Grids for Ray Tracing](https://reader033.vdocuments.net/reader033/viewer/2022051622/568152e7550346895dc10554/html5/thumbnails/37.jpg)
Hashed Grid
• Row displacement compression
1
5
11
12 15
1
5
11
12 15
12 11 151 5
C O
HC[i,j] H[O[i] + j]
0
1
1
3