Large Ray Packets for Real-time Whitted Ray Tracing Ravi Ramamoorthi Columbia University Ryan Overbeck Columbia University William R. Mark University of Texas at Austin Intel Corporation RT08, August ‘08 Current Real-time Ray Tracing Use large ray packets (16-256 rays) Focused on primary visibility and point-light shadows Images somewhat dull Easily generated using rasterization algorithms RT08, August ‘08 This Work: Whitted Ray Tracing Whitted Ray tracing: Primary Visibility Point-light Shadows Reflections Refractions RT08, August ‘08 Mission Study large ray packets for Whitted ray tracing Scene traversal (BVH) Partition Traversal: New! Frustum Culling General secondary ray packets: New! RT08, August ‘08 Mission Evaluation of old and new algorithms Ray packet size Scene complexity Ray Recursion Complexity RT08, August ‘08 Result: Real-time Whitted RT RT08, August ‘08 Outline Motivation Frustum Culling for Secondary Rays Scene Traversal with Large Ray Packets Results RT08, August ‘08 Frustum Culling Primary Rays Reshetov et al. 2005 Point-Light Shadow Rays Boulos et al. 2006 , Wald et al. 2007 Reflection + Refraction Rays New! RT08, August ‘08 Frustum Culling: Point Light 1. Choose dominant axis: 2. Find intersection points at 3. Get min/max . coords. 1 RT08, August ‘08 Frustum Culling: Point Light 1. Choose dominant axis: 2. Find intersection points at 3. Get min/max . coords. 4. Create 4 corner rays. 5. Compute plane normals. 1 RT08, August ‘08 Frustum Culling: Reflection RT08, August ‘08 Frustum Culling: Reflection Scene Bounding Box Samples’ Bounding Box RT08, August ‘08 Frustum Culling: Reflection 1. Choose dominant axis: 2. Find 1. 2. intersections with 2 planes: from scene AABB. from samples’ AABB. 3. Get min/max coords. 4. Create 4 corner rays. 5. Compute plane normals. RT08, August ‘08 Outline Motivation Frustum Culling for Secondary Rays Scene Traversal with Large Ray Packets Results RT08, August ‘08 3 Algorithms for Scene Traversal Masked Traversal – Control Method Based on Wald 2001, Reshetov 2005 (MLRT) Only good for small packets Ranged Traversal – State-of-the-art Wald et al. 2007 Degrades performance for incoherent rays! Partition Traversal: New! Robust to incoherent rays and large packets RT08, August ‘08 Masked Traversal 4 3 2 1 0 RT08, August ‘08 Masked Traversal BVH Inner Cell 4 3 2 1 0 RT08, August ‘08 Masked Traversal Near BVH Leaf Cell 4 3 2 1 0 RT08, August ‘08 Masked Traversal Far BVH Leaf Cell 4 3 2 1 0 RT08, August ‘08 Masked Traversal 4 Alive 3 Alive 2 Alive 1 Alive 0 Alive 4 3 2 1 0 RT08, August ‘08 Masked Traversal 4 Alive 3 Alive 2 Alive 1 Alive 0 Alive 4 3 2 1 0 RT08, August ‘08 Masked Traversal 4 Alive 3 Alive 2 Alive 1 Alive 0 Alive 4 3 2 1 0 RT08, August ‘08 Masked Traversal 4 Alive 3 Alive 2 Alive 1 Alive 0 Alive 4 3 2 1 0 RT08, August ‘08 Masked Traversal 4 Alive 3 Alive 2 Alive 1 Alive 0 Alive 4 3 2 1 0 RT08, August ‘08 Masked Traversal 4 Alive 3 Alive 2 Alive 1 Alive 0 Dead 4 3 2 1 0 RT08, August ‘08 Masked Traversal 4 Alive 3 Alive 2 Alive 1 Dead 0 Dead 4 3 2 1 0 RT08, August ‘08 Masked Traversal 4 Alive 3 Alive 2 Alive 1 Dead 0 Dead 4 3 2 1 0 RT08, August ‘08 Masked Traversal 4 Alive 3 Alive 2 Alive 1 Dead 0 Dead 4 3 2 1 0 RT08, August ‘08 Masked Traversal 4 Dead 3 Alive 2 Alive 1 Dead 0 Dead 4 3 2 1 0 RT08, August ‘08 Masked Traversal 4 Dead 3 Alive 2 Alive 1 Dead 0 Dead 4 3 2 1 0 RT08, August ‘08 Masked Traversal 4 Dead 3 Alive 2 Alive 1 Dead 0 Dead 4 3 2 1 0 RT08, August ‘08 Masked Traversal 4 Dead 3 Alive 2 Alive 1 Dead 0 Dead 4 3 2 1 0 RT08, August ‘08 Masked Traversal 4 Dead 3 Alive 2 Alive 1 Dead 0 Dead 4 3 2 1 0 RT08, August ‘08 Masked Traversal 4 Dead 3 Alive 2 Alive 1 Dead 0 Dead 4 3 2 1 0 RT08, August ‘08 Masked Traversal 4 Dead 3 Alive 2 Alive 1 Dead 0 Dead 4 3 2 1 0 RT08, August ‘08 Masked Traversal 4 Dead 3 Alive 2 Alive 1 Dead 0 Dead 4 3 2 1 0 RT08, August ‘08 Masked Traversal 4 Dead 3 Alive 2 Alive 1 Dead 0 Dead 4 3 2 1 0 RT08, August ‘08 Masked Traversal 4 Dead 3 Alive 2 Alive 1 Dead 0 Dead 4 3 2 1 0 RT08, August ‘08 Masked Traversal 4 Dead 3 Alive 2 Alive 1 Dead 0 Dead 4 3 2 1 0 RT08, August ‘08 Masked Traversal 4 Alive 3 Alive 2 Alive 1 Alive 0 Alive 4 3 2 1 0 RT08, August ‘08 Masked Traversal 4 Alive 3 Alive 2 Alive 1 Alive 0 Alive 4 3 2 1 0 RT08, August ‘08 Masked Traversal 4 Alive 3 Alive 2 Alive 1 Alive 0 Dead 4 3 2 1 0 RT08, August ‘08 Masked Traversal 4 Alive 3 Alive 2 Alive 1 Dead 0 Dead 4 3 2 1 0 RT08, August ‘08 Masked Traversal 4 Alive 3 Alive 2 Alive 1 Dead 0 Dead 4 3 2 1 0 RT08, August ‘08 Masked Traversal 4 Alive 3 Dead 2 Alive 1 Dead 0 Dead 4 3 2 1 0 RT08, August ‘08 Masked Traversal Causes extra ray—cell tests 4 Dead 3 Dead 2 Alive 1 Dead 0 Dead 4 3 2 1 0 RT08, August ‘08 Ranged Traversal 4 3 2 1 0 RT08, August ‘08 Ranged Traversal 4 3 2 1 0 RT08, August ‘08 Ranged Traversal 4 3 2 1 0 RT08, August ‘08 Ranged Traversal 4 3 2 1 0 RT08, August ‘08 Ranged Traversal 4 3 2 1 0 RT08, August ‘08 Ranged Traversal 4 3 2 1 0 RT08, August ‘08 Ranged Traversal 4 3 2 1 0 RT08, August ‘08 Ranged Traversal 4 3 2 1 0 RT08, August ‘08 Ranged Traversal 4 3 2 1 0 RT08, August ‘08 Ranged Traversal 4 3 2 1 0 RT08, August ‘08 Ranged Traversal 4 3 2 1 0 RT08, August ‘08 Ranged Traversal 4 3 2 1 0 RT08, August ‘08 Ranged Traversal 4 3 2 1 0 RT08, August ‘08 Ranged Traversal 4 3 2 1 0 RT08, August ‘08 Ranged Traversal 4 3 2 1 0 RT08, August ‘08 Ranged Traversal 4 3 2 1 0 RT08, August ‘08 Ranged Traversal 4 3 2 1 0 RT08, August ‘08 Ranged Traversal 4 3 2 1 0 RT08, August ‘08 Ranged Traversal 4 3 2 1 0 RT08, August ‘08 Ranged Traversal 4 3 2 1 0 RT08, August ‘08 Ranged Traversal 3 4 2 1 0 RT08, August ‘08 Ranged Traversal 3 4 0 1 2 RT08, August ‘08 Ranged Traversal 3 4 0 1 2 RT08, August ‘08 Ranged Traversal 3 4 0 1 2 RT08, August ‘08 Ranged Traversal 3 4 0 1 2 RT08, August ‘08 Ranged Traversal 3 4 0 1 2 RT08, August ‘08 Ranged Traversal 3 4 0 1 2 RT08, August ‘08 Ranged Traversal 3 4 0 1 2 RT08, August ‘08 Ranged Traversal 3 4 0 1 2 RT08, August ‘08 Ranged Traversal 3 4 0 1 2 RT08, August ‘08 Ranged Traversal 3 4 0 1 2 RT08, August ‘08 Ranged Traversal 3 4 0 1 2 RT08, August ‘08 Ranged Traversal 3 4 0 1 2 RT08, August ‘08 Ranged Traversal 3 4 0 1 2 RT08, August ‘08 Ranged Traversal 3 4 0 1 2 RT08, August ‘08 Ranged Traversal 3 4 0 1 2 RT08, August ‘08 Ranged Traversal 3 4 0 1 2 RT08, August ‘08 Ranged Traversal 3 4 0 1 2 RT08, August ‘08 Ranged Traversal Reduces ray—cell tests Increases ray—triangle tests 3 4 0 1 2 RT08, August ‘08 Partition Traversal (New) 0 1 2 3 4 A 3 4 0 1 2 RT08, August ‘08 Partition Traversal (New) 0 1 2 3 4 A 3 4 0 1 2 RT08, August ‘08 Partition Traversal (New) 0 E B 1 2 3 4 A 3 4 0 1 2 RT08, August ‘08 Partition Traversal (New) 0 B E 1 2 3 4 A 3 4 0 1 2 RT08, August ‘08 Partition Traversal (New) 0 1 E B 2 3 4 A 3 4 0 1 2 RT08, August ‘08 Partition Traversal (New) 0 1 B E 2 3 4 A 3 4 0 1 2 RT08, August ‘08 Partition Traversal (New) 0 1 2 E B 3 4 A 3 4 0 1 2 RT08, August ‘08 Partition Traversal (New) 0 1 2 E 3 B 4 A 3 4 0 1 2 RT08, August ‘08 Partition Traversal (New) 0 1 4 E 3 2 B A 3 4 0 1 2 RT08, August ‘08 Partition Traversal (New) 0 1 4 3 E 2 B A 3 4 0 1 2 RT08, August ‘08 Partition Traversal (New) 0 1 4 3 2 A 3 4 0 1 2 RT08, August ‘08 Partition Traversal (New) 0 1 4 3 2 A 3 4 0 1 2 RT08, August ‘08 Partition Traversal (New) 0 E B 1 4 3 2 A 3 4 0 1 2 RT08, August ‘08 Partition Traversal (New) 0 B E 1 4 3 2 A 3 4 0 1 2 RT08, August ‘08 Partition Traversal (New) 0 1 E B 4 3 2 A 3 4 0 1 2 RT08, August ‘08 Partition Traversal (New) 0 1 E 4 3 2 B A 3 4 0 1 2 RT08, August ‘08 Partition Traversal (New) 0 4 E 1 3 2 B A 3 4 0 1 2 RT08, August ‘08 Partition Traversal (New) 0 4 1 3 2 E B A 3 4 0 1 2 RT08, August ‘08 Partition Traversal (New) 0 4 1 3 2 A 3 4 0 1 2 RT08, August ‘08 Partition Traversal (New) 0 4 1 3 2 A 3 4 0 1 2 RT08, August ‘08 Partition Traversal (New) 0 4 1 3 2 A 3 4 0 1 2 RT08, August ‘08 Partition Traversal (New) 0 4 1 3 2 A 3 4 0 1 2 RT08, August ‘08 Partition Traversal (New) 0 4 1 3 2 A 3 4 0 1 2 RT08, August ‘08 Partition Traversal (New) 0 4 1 3 2 A 3 4 0 1 2 RT08, August ‘08 Partition Traversal (New) 0 4 1 3 2 A 3 4 0 1 2 RT08, August ‘08 Partition Traversal (New) 0 E B 4 1 3 2 A 3 4 0 1 2 RT08, August ‘08 Partition Traversal (New) 0 B E 4 1 3 2 A 3 4 0 1 2 RT08, August ‘08 Partition Traversal (New) 0 4 E B 1 3 2 A 3 4 0 1 2 RT08, August ‘08 Partition Traversal (New) 0 4 E 1 3 2 B A 3 4 0 1 2 RT08, August ‘08 Partition Traversal (New) 0 4 1 3 2 A 3 4 0 1 2 RT08, August ‘08 Partition Traversal (New) 0 4 1 3 2 A 3 4 0 1 2 RT08, August ‘08 Partition Traversal (New) More ray—cell intersection tests 0 4 1 3 2 A 3 No unnecessary ray—triangle intersection tests 4 Robust to incoherent rays 0 1 2 RT08, August ‘08 Outline Motivation Frustum Culling for Secondary Rays Scene Traversal with Large Ray Packets Results RT08, August ‘08 3 Performance Variables Ray Packet Size Scene Complexity Ray Recursion Complexity RT08, August ‘08 3 Performance Variables Ray Packet Size 4x4 8x8 16x16 32x32 Scene Complexity Ray Recursion Complexity RT08, August ‘08 3 Performance Variables Ray Packet Size Scene Complexity ERW6 (804 Triangles) Toasters (11,141 Triangles) Rings Fairy (172,669 Triangles) (217,812 Triangles) Ray Recursion Complexity RT08, August ‘08 3 Performance Variables Ray Packet Size Scene Complexity Ray Recursion Complexity Primary Visibility Primary Visibility + Point-light Shadows Primary Visibility + 2-Deep Refractions Primary Visibility + 2-Bounce Reflections RT08, August ‘08 Traversal vs. Ray Packet Size Masked Traversal: performance degrades for > 4x4 packets Ranged Traversal: performance degrades for > 8x8 packets Fairy Scene 2-Bounce Reflections (Million CPU Cycles) Time Paritition Traversal: performance increases with packet size 1500 1000 Ranged Partition Masked 500 0 Ray Packet 4x4 Size 8x8 16x16 32x32 RT08, August ‘08 Traversal vs. Recursion Complexity Masked Traversal: Degrades with recursion complexity Ranged Traversal: Degrades with recursion complexity Fairy Scene 16x16 Packets (Million CPU Cycles) Time Partition Traversal: More robust to increasing recursion complexity 1200 Ranged Partition Masked 800 400 0 Recursion Primary Complexity Primary + Shadows Primary + 2-Deep Refractions Primary + 2-Bounce Reflections RT08, August ‘08 Traversal vs. Recursion Complexity Rings Scene 16x16 Packets (Million CPU Cycles) Time Difference between Partition and Ranged more pronounced on more complex scenes 4000 3000 Ranged Partition Masked 2x 2000 1000 0 Recursion Primary Complexity Primary + Shadows Primary + 2-Deep Refractions Primary + 2-Bounce Reflections RT08, August ‘08 Traversal vs. Scene Complexity Ranged Traversal: Degrades with scene complexity (Million CPU Cycles) Time Partition Traversal: More robust to increasing scene complexity 4000 3000 Ranged Partition Masked 2000 1000 0 Scene Complexity 2-Bounce Reflections 16x16 Packets ERW6 Toasters Fairy Rings RT08, August ‘08 Ranged vs. Partition Traversal Ranged Traversal Most ray—cell tests deep in BVH More extra ray—triangle tests for incoherent rays Partition Traversal Most ray—cell tests high in BVH No extra ray—triangle tests RT08, August ‘08 Traversal: Summary Use Ranged Traversal Primary rays and coherent point-light shadow rays Small to medium packets: <= 8x8 rays Use Partition Traversal Incoherent rays: deep reflections + refractions Large ray packets: > =16x16 rays RT08, August ‘08 Frustum Culling vs. Recursion Complexity Toasters Scene 16x16 Packets (Million CPU Cycles) Time Frustum culling provides modest benefits 400 300 No Culling With Culling 200 100 0 Recursion Primary Complexity Primary + Shadows Primary + 2-Deep Refractions Primary + 2-Bounce Reflections RT08, August ‘08 Frustum Culling: Summary Primary + Point-light Shadows Up to 2x performance benefit possible But more often ~1.5x or less Reflections + Refractions Expect 1.2x – 1.3x performance benefit RT08, August ‘08 Conclusion Use ranged and partition traversal in correct situation 16x16 packets: 3x – 6x benefit over 2x2 Whitted Ray Tracing is now interactive to real-time 11.8 FPS 6.7 FPS 8.5 FPS 4 FPS RT08, August ‘08 Real-Time Whitted Ray Tracing Primary Visibility Ranged Traversal Point-Light Ranged Traversal 1-Bounce Reflections Ranged Traversal RT08, August ‘08 Conclusion Primary Visibility Ranged Traversal 3-Bounce Reflections Partition Traversal RT08, August ‘08 Conclusion Primary Visibility Ranged Traversal Point-Light Shadows Partition Traversal 3-Deep Refractions Partition Traversal 1-Bounce Reflections Partition Traversal RT08, August ‘08 Acknowledgements Thanks to: Lab mates at Columbia University. Paid for by: NSF (grants CCF 03-05322, CCF 04-46916, CCF 0701775), a Sloan Research Fellowship, and an ONR Young Investigator Award N00014-17-1-0900. Intel fellowship to Ryan Overbeck and related equipment donations from Intel and NVIDIA. RT08, August ‘08 Questions? RT08, August ‘08