gpu ray tracing using irregular grids
play

GPU Ray-tracing using Irregular Grids Arsne Prard-Gayot, Javor - PowerPoint PPT Presentation

GPU Ray-tracing using Irregular Grids Arsne Prard-Gayot, Javor Kalojanov, Philipp Slusallek April 28, 2017 1 Introduction Ray Tracing with Grids Challenges Irregular Grids Construction (Part I) Traversal Construction (Part II) Results


  1. GPU Ray-tracing using Irregular Grids Arsène Pérard-Gayot, Javor Kalojanov, Philipp Slusallek April 28, 2017 1

  2. Introduction Ray Tracing with Grids Challenges Irregular Grids Construction (Part I) Traversal Construction (Part II) Results 2

  3. Introduction

  4. Introduction: Ray Tracing with Grids Pros • Very fast parallel construction • Stackless & ordered traversal, early exit Cons • Empty space skipping: Teapot in the Stadium • Cannot minimize both intersections and traversal steps 3

  5. Introduction: Uniform Grid Redundant intersections Empty space 4

  6. Introduction: Uniform Grid Redundant intersections Empty space 4

  7. Introduction: Uniform Grid Redundant intersections Empty space 4

  8. Introduction: Uniform Grid Redundant intersections Empty space 4

  9. Introduction: Uniform Grid Redundant intersections Empty space 4

  10. Introduction: Uniform Grid Redundant intersections Empty space 4

  11. Introduction: Uniform Grid Redundant intersections Empty space 4

  12. Introduction: Uniform Grid Redundant intersections Empty space 4

  13. Introduction: Uniform Grid Redundant intersections Empty space 4

  14. Introduction: Uniform Grid Redundant intersections Empty space 4 � �� � � �� �

  15. Introduction: Uniform Grid Increasing resolution • Fewer intersections • More traversal steps 4

  16. Introduction: Our solution Idea: Remove regularity • Start with a dense subdivision • Optimize cell shape to minimize traversal cost 5

  17. Introduction: Our solution Uniform Grid: Low Resolution Traversal steps + Intersections 5 200 0

  18. Introduction: Our solution Uniform Grid: Medium Resolution Traversal steps + Intersections 5 200 0

  19. Introduction: Our solution Irregular Grid: Low Resolution Traversal steps + Intersections 5 200 0

  20. Introduction: Our solution Irregular Grid: Medium Resolution Traversal steps + Intersections 5 200 0

  21. Introduction: Our solution Irregular Grid: High Resolution Traversal steps + Intersections 5 200 0

  22. Irregular Grids

  23. Data Structure 6 Voxel Map 9 5 3 3 7 3 3 8 5 7 Irregular Grid 4 1 1 2 2 1 1 2 4 2 = + Cells 1 2 3 4 5 7 8 9 Primitive References

  24. Construction (Part I) Initialization • Initial grid • Two-level construction: 1. A coarse uniform grid 2. An octree in each of the grid cells • Adaptive: More effort where the geometry is complex 7 • Dense: Up to 2 15 resolution in each second-level cell

  25. Construction (Part I) Initialization 7

  26. Construction (Part I) Initialization • With scene volume V and number of objects N [Cle+83]: 3 V 7 • User-defined λ 1 controls top-level resolution √ λ 1 N R { x , y , z } = d { x , y , z } • Tries to make cells cubic

  27. Construction (Part I) Initialization 7

  28. Construction (Part I) Initialization • Octree depth computed independently in each cell • Clamp resolution to a power of two: 7 • Same formula, but: λ 2 , local number of objects & volume D = ⌈ log 2 ( max ( R x , R y , R z )) ⌉ • Compact: only log 2 ( log 2 ( R max )) bits needed • 4 bits = max. resolution of 2 15 × 2 15 × 2 15

  29. Construction (Part I) Initialization 7 3 2 0 2 1 1

  30. Construction (Part I) Initialization 7

  31. Construction (Part I): Virtual Grid Property 8 Cells are aligned on a virtual grid of resolution R x , y , z 2 D

  32. Construction (Part I): Voxel Map Voxel map as a two level grid Memory efficient/Fast lookup 9

  33. Interlude: Traversal Traversal • The data structure is not optimal • But it can already be used for traversal Ideas • Maintain position on the virtual grid • Recompute increment along the ray at each step 10

  34. Interlude: Traversal 1. Locate ray origin 2. Loop 2.1 Intersect primitives 2.2 Exit if hit is within cell 2.3 Locate exit point 2.4 Move to next cell 11

  35. Interlude: Traversal 1. Locate ray origin 2.1 Intersect primitives 2.2 Exit if hit is within cell 2.3 Locate exit point 2.4 Move to next cell 11 2. Loop

  36. Interlude: Traversal 1. Locate ray origin 2. Loop 2.1 Intersect primitives 2.2 Exit if hit is within cell 2.3 Locate exit point 2.4 Move to next cell 11

  37. Interlude: Traversal 1. Locate ray origin 2. Loop 2.1 Intersect primitives 2.2 Exit if hit is within cell 2.4 Move to next cell 11 2.3 Locate exit point

  38. Interlude: Traversal 1. Locate ray origin 2. Loop 2.1 Intersect primitives 2.2 Exit if hit is within cell 2.3 Locate exit point 11 2.4 Move to next cell

  39. Interlude: Traversal 1. Locate ray origin 2.1 Intersect primitives 2.2 Exit if hit is within cell 2.3 Locate exit point 2.4 Move to next cell 11 2. Loop

  40. Interlude: Traversal 1. Locate ray origin 2. Loop 2.1 Intersect primitives 2.2 Exit if hit is within cell 2.4 Move to next cell 11 2.3 Locate exit point

  41. Interlude: Traversal 1. Locate ray origin 2. Loop 2.1 Intersect primitives 2.2 Exit if hit is within cell 2.3 Locate exit point 11 2.4 Move to next cell

  42. Interlude: Traversal 1. Locate ray origin 2.1 Intersect primitives 2.2 Exit if hit is within cell 2.3 Locate exit point 2.4 Move to next cell 11 2. Loop

  43. Interlude: Traversal 1. Locate ray origin 2. Loop 2.1 Intersect primitives 2.2 Exit if hit is within cell 2.4 Move to next cell 11 2.3 Locate exit point

  44. Interlude: Traversal 1. Locate ray origin 2. Loop 2.1 Intersect primitives 2.2 Exit if hit is within cell 2.3 Locate exit point 11 2.4 Move to next cell

  45. Interlude: Traversal 1. Locate ray origin 2.1 Intersect primitives 2.2 Exit if hit is within cell 2.3 Locate exit point 2.4 Move to next cell 11 2. Loop

  46. Interlude: Traversal 1. Locate ray origin 2. Loop 2.1 Intersect primitives 2.2 Exit if hit is within cell 2.3 Locate exit point 2.4 Move to next cell 11

  47. Interlude: Traversal 1. Locate ray origin 2. Loop 2.1 Intersect primitives 2.2 Exit if hit is within cell 2.4 Move to next cell 11 2.3 Locate exit point

  48. Interlude: Traversal 1. Locate ray origin 2. Loop 2.1 Intersect primitives 2.2 Exit if hit is within cell 2.3 Locate exit point 11 2.4 Move to next cell

  49. Interlude: Traversal 1. Locate ray origin 2.1 Intersect primitives 2.2 Exit if hit is within cell 2.3 Locate exit point 2.4 Move to next cell 11 2. Loop

  50. Interlude: Traversal 1. Locate ray origin 2. Loop 2.1 Intersect primitives 2.2 Exit if hit is within cell 2.3 Locate exit point 2.4 Move to next cell 11

  51. Interlude: Traversal 1. Locate ray origin 2. Loop 2.1 Intersect primitives 2.3 Locate exit point 2.4 Move to next cell 11 2.2 Exit if hit is within cell

  52. Contruction (Part II) Traversal Performance Cell Merging and Expansion • Local (greedy) optimizations • Examine cells and their neighborhoods • Keep optimizations simple and parallelizable 12 • Poor empty space skipping = ⇒ memory latency • Redundant intersections = ⇒ instr./memory latency

  53. Contruction (Part II): Optimization Passes 13 Initial Grid Cell Merging Repeat ... z x y Cell Expansion Repeat ... ... x y z

  54. Contruction (Part II): Optimization Passes 13 Initial Grid Cell Merging Repeat ... z x y Cell Expansion Repeat ... ... x y z

  55. Contruction (Part II): Optimization Passes 13 Initial Grid Cell Merging Repeat ... z x y Cell Expansion Repeat ... ... x y z

  56. Contruction (Part II): Cell Merging Cell Merging • Merge each cell with its neighbor if the SAH decreases: 14 |R ( A ) | SA ( A ) + |R ( B ) | SA ( B ) ≥ |R ( A ∪ B ) | SA ( A ∪ B ) − C t • For empty and non-empty cells

  57. Contruction (Part II): Cell Merging Limitations • Only consider the union of 2 aligned cells • Union must be a box 14

  58. Contruction (Part II): Cell Merging Stopping criterion • Keep merging until: • N after / N before : number of cells after/before merging 14 N after ≥ α N before • α = 0 . 995

  59. Contruction (Part II): Optimization Passes 15 Initial Grid Cell Merging Repeat ... z x y Cell Expansion Repeat ... ... x y z

  60. Contruction (Part II): Optimization Passes 15 Initial Grid Cell Merging Repeat ... z x y Cell Expansion Repeat ... ... x y z

  61. Contruction (Part II): Cell Expansion Cell Expansion • Expand the exit boundaries of the cells • Must maintain correctness of traversal: 16 R ( B ) ⊂ R ( A )

  62. Contruction (Part II): Cell Expansion Cell Expansion • Expand the exit boundaries of the cells • Must maintain correctness of traversal: 16 R ( A ) ̸⊂ R ( B )

  63. Contruction (Part II): Cell Expansion Limitations • Must examine every neighbor on the box face • Binary decision, no partial expansion 16

  64. Contruction (Part II): Cell Expansion Stopping criterion • Fixed number of expansion passes: • 3 for static scenes, • 1 for dynamic scenes. 16

  65. Contruction (Part II): Impact on Traversal 1. Locate ray origin 2. Loop 2.1 Intersect primitives 2.2 Exit if hit is within cell 2.3 Locate exit point 2.4 Move to next cell 17

Recommend


More recommend