Speaker: Christiaan Gribble, SURVICE Engineering
We will discuss multi-hit ray traversal, a class of ray traversal algorithms that finds one or more, and possibly all, primitives intersected by a ray and ordered by point of intersection. After a brief review the multi-hit problem, we will discuss the implementation of high-performance multi-hit ray traversal in Embree (Intel's high-performance ray-tracing kernels) and in OSPRay (Intel's ray-based rendering engine for high fidelity visualization) using the Intel® SPMD Program Compiler. We then demonstrate our implementation with two key applications: (1) a fast and accurate rendering of transparent objects for high-fidelity visualization, and (2) a physics-based simulation in which the interesting phenomena are governed by equations similar to the Beer-Lambert Law.
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
Realizing milti-hit-ray
1. Realizing Multi-Hit Ray Tracing
in Embree & OSPRay
Christiaan Gribble
SURVICE Engineering
Intel HPC Developer Conference
12 November 2016
2. Take-home messages
• Multi-hit ray traversal
Enables a new class of ray-based rendering &
simulation applications
• Embree permits efficient implementation
• OSPRay permits easy integration
2 C. Gribble, Realizing Multi-Hit Ray Tracing in Embree & OSPRay
3. Take-home messages
• Multi-hit ray traversal
• Embree permits efficient implementation
Intersection filter functions enable user-level implementation
of state-of-the-art multi-hit ray traversal techniques
• OSPRay permits easy integration
3 C. Gribble, Realizing Multi-Hit Ray Tracing in Embree & OSPRay
4. Take-home messages
• Multi-hit ray traversal
• Embree permits efficient implementation
• OSPRay permits easy integration
Supports scalable, high performance visual analysis tools
across optical & non-optical domains
4 C. Gribble, Realizing Multi-Hit Ray Tracing in Embree & OSPRay
5. Acknowledgements
• SURVICE
• Joe Rosenthal
• Mark Butkiewicz
• Intel
• Jeff Amstutz
• Ingo Wald
• Jim Jeffers
5 C. Gribble, Realizing Multi-Hit Ray Tracing in Embree & OSPRay
13. Non-optical rendering Interval computation
Interval computation
13 C. Gribble, Realizing Multi-Hit Ray Tracing in Embree & OSPRay
14. Interval computation
• Difficult or impossible
• Epsilon hacks
• Missed/repeated intersections
• Performance impacts
14 C. Gribble, Realizing Multi-Hit Ray Tracing in Embree & OSPRay
15. Interval computation
• Difficult or impossible
• Performance impacts
• Traversal restart
• Operational overhead
15 C. Gribble, Realizing Multi-Hit Ray Tracing in Embree & OSPRay
16. Interval computation
• Difficult or impossible
• Performance impacts
Is there a better solution?
16 C. Gribble, Realizing Multi-Hit Ray Tracing in Embree & OSPRay
17. Multi-hit ray traversal
• Which primitives are intersected?
• One or more, & possibly all
• Ordered by t-value along ray
• Possible applications
• GNK14
• AGGW15
• Gri16, GWA16
17 C. Gribble, Realizing Multi-Hit Ray Tracing in Embree & OSPRay
18. Multi-hit ray traversal
• Which primitives are intersected?
• Possible applications
• Transparent rendering
• Alpha textures
• GNK14
• AGGW15
• Gri16, GWA16
18 C. Gribble, Realizing Multi-Hit Ray Tracing in Embree & OSPRay
19. Multi-hit ray traversal
• Which primitives are intersected?
• Possible applications
• GNK14
• Spatial partitioning
• Two algorithms: naive, buffered
• AGGW15
• Gri16, GWA16
19 C. Gribble, Realizing Multi-Hit Ray Tracing in Embree & OSPRay
20. Multi-hit ray traversal
• Which primitives are intersected?
• Possible applications
• GNK14
• AGGW15
• Object partitioning
• User-level implementation mechanisms
• Gri16, GWA16
20 C. Gribble, Realizing Multi-Hit Ray Tracing in Embree & OSPRay
21. Multi-hit ray traversal
• Which primitives are intersected?
• Possible applications
• GNK14
• AGGW15
• Gri16, GWA16
• Enable early-exit in BVH
• Implement in Embree & OSPRay
21 C. Gribble, Realizing Multi-Hit Ray Tracing in Embree & OSPRay
23. Mechanisms
• Direct implementation
• Kernels specific to multi-hit
• Runs counter to our goal
• Intersection callbacks
• Traversal callbacks
• Reference implementation
23 C. Gribble, Realizing Multi-Hit Ray Tracing in Embree & OSPRay
24. Mechanisms
• Direct implementation
• Intersection callbacks
• Invoked on valid ray/primitive intersection
• User accepts/rejects hit
• Traversal callbacks
• Reference implementation
24 C. Gribble, Realizing Multi-Hit Ray Tracing in Embree & OSPRay
25. Mechanisms
• Direct implementation
• Intersection callbacks
• Traversal callbacks
• Invoked on ray/node interaction
• Two variants: every-node, leaf-node
• Reference implementation
25 C. Gribble, Realizing Multi-Hit Ray Tracing in Embree & OSPRay
26. Mechanisms
• Direct implementation
• Intersection callbacks
• Traversal callbacks
• Reference implementation
• Supports callback mechanisms
• Opts for clarity & simplicity
26 C. Gribble, Realizing Multi-Hit Ray Tracing in Embree & OSPRay
http://www.rtvtk.org/~cgribble/research/mhBVH/
27. Embree implementation
• Intersection filters
• Compatible with mainline developments
• v2.10.0+ – enables node-culling
• Assumptions
• Full source code available
27 C. Gribble, Realizing Multi-Hit Ray Tracing in Embree & OSPRay
28. Embree implementation
• Intersection filters
• Assumptions
• Nquery known a priori
• Preallocated hit data buffer
• Initial value beyond range
• Full source code available
28 C. Gribble, Realizing Multi-Hit Ray Tracing in Embree & OSPRay
29. Embree implementation
• Intersection filters
• Assumptions
• Full source code available
• Apache License, v2.0
• Public git repository
29 C. Gribble, Realizing Multi-Hit Ray Tracing in Embree & OSPRay
http://www.rtvtk.org/~cgribble/research/ospMultiHit/
30. Scalar implementation
static void collectIntersectionsFilter(void* /* unused */,
RTCRay& _ray)
{
0 // Find index at which to store candidate intersection
1 uint idx = Nquery;
2 while (idx > 0 && ray.tfar < hits[idx-1].tval)
3 {
4 hits[idx] = hits[idx-1];
5 --idx;
6 }
30 C. Gribble, Realizing Multi-Hit Ray Tracing in Embree & OSPRay
31. Scalar implementation
7 // Store intersection, possibly beyond index of the
8 // N ≤ Nquery closest intersections (i.e., at
9 // idx = Nquery)
10 HitData& hit = hits[idx];
11 hit.geomID = ray.geomID;
12 hit.primID = ray.primID;
13 hit.tval = ray.tfar;
14 hit.Ng = ray.Ng;
15
16 // Update number of intersections identified so far
17 ray.nhits += (ray.nhits < Nquery ? 1 : 0);
31 C. Gribble, Realizing Multi-Hit Ray Tracing in Embree & OSPRay
32. Scalar implementation
17 if (ray.nhits < Nquery)
18 {
19 // Reject intersection to continue traversal with
20 // incoming ray interval, as in previous work
21 // [Amstutz et al. 2015]
22 ray.geomID = RTC_INVALID_GEOMETRY_ID;
23 return;
24 }
32 C. Gribble, Realizing Multi-Hit Ray Tracing in Embree & OSPRay
33. Scalar implementation
25 // Induce node culling
26 // Trick: set ray.tfar to farthest value among the
27 // N = Nquery intersections identified so far
28 // and (implicitly) accept intersection with
29 // modified ray interval
30 ray.tfar = hits[Nquery-1].tval;
31 }
33 C. Gribble, Realizing Multi-Hit Ray Tracing in Embree & OSPRay
35. Performance – tests
• Find-first-intersection
• First-hit v. multi-hit variants
• Isolates multi-hit overhead
• Find-all-intersections
• Find-some-intersections
35 C. Gribble, Realizing Multi-Hit Ray Tracing in Embree & OSPRay
36. Performance – tests
• Find-first-intersection
• Find-all-intersections
• Naive v. node culling multi-hit
• Bounds performance expectations
• Find-some-intersections
36 C. Gribble, Realizing Multi-Hit Ray Tracing in Embree & OSPRay
37. Performance – tests
• Find-first-intersection
• Find-all-intersections
• Find-some-intersections
• Naive v. node culling multi-hit
• Demonstrates in situ performance
37 C. Gribble, Realizing Multi-Hit Ray Tracing in Embree & OSPRay
38. Performance – scenes
sibe
80K tris
fair
174K tris
conf
282K tris
truck
426K tris
tank
1.0M tris
hball
2.8M tris
sanm
10.5M tris
pplant
12.7M tris
38 C. Gribble, Realizing Multi-Hit Ray Tracing in Embree & OSPRay
39. Performance – truck scene
0.0
20.0
40.0
60.0
80.0
100.0
120.0
140.0
10%1 30% 70% all
Mhps
+4.60x
+1.64x
+1.08x 0.96x 0.97x
naive culling
39 C. Gribble, Realizing Multi-Hit Ray Tracing in Embree & OSPRay
40. Performance – truck scene
0.0
20.0
40.0
60.0
80.0
100.0
120.0
140.0
10%1 30% 70% all
Mhps
+4.60x
+1.64x
+1.08x 0.96x 0.97x
naive culling
40 C. Gribble, Realizing Multi-Hit Ray Tracing in Embree & OSPRay
41. Performance – truck scene
0.0
20.0
40.0
60.0
80.0
100.0
120.0
140.0
10%1 30% 70% all
Mhps
+4.60x
+1.64x
+1.08x 0.96x 0.97x
naive culling
41 C. Gribble, Realizing Multi-Hit Ray Tracing in Embree & OSPRay
42. Limitations
• Number of hits specified a priori
• Too few – incorrect
• Too many – wasteful
• C++ templates?
• Ordered BVH traversal [WAB16]
• Spatial partitioning [GNK14]
42 C. Gribble, Realizing Multi-Hit Ray Tracing in Embree & OSPRay
43. Limitations
• Number of hits specified a priori
• Ordered BVH traversal [WAB16]
• Enables early-exit
• No dynamic allocation
• Requires new traversal kernels
• Spatial partitioning [GNK14]
43 C. Gribble, Realizing Multi-Hit Ray Tracing in Embree & OSPRay
44. Limitations
• Number of hits specified a priori
• Ordered BVH traversal [WAB16]
• Spatial partitioning [GNK14]
• Enables early-exit
• No dynamic allocation
• Requires user-defined geometry
44 C. Gribble, Realizing Multi-Hit Ray Tracing in Embree & OSPRay
47. Take-home messages
• Multi-hit ray traversal
Enables a new class of ray-based rendering &
simulation applications
• Embree permits efficient implementation
• OSPRay permits easy integration
47 C. Gribble, Realizing Multi-Hit Ray Tracing in Embree & OSPRay
48. Take-home messages
• Multi-hit ray traversal
• Embree permits efficient implementation
Intersection filter functions enable user-level implementation
of state-of-the-art multi-hit ray traversal techniques
• OSPRay permits easy integration
48 C. Gribble, Realizing Multi-Hit Ray Tracing in Embree & OSPRay
49. Take-home messages
• Multi-hit ray traversal
• Embree permits efficient implementation
• OSPRay permits easy integration
Supports scalable, high performance visual analysis tools
across optical & non-optical applications
49 C. Gribble, Realizing Multi-Hit Ray Tracing in Embree & OSPRay
50. Key references
[AGGW15] Amstutz, J., Gribble, C., Gunther, J., & Wald, I. (2015) An evaluation of multi-hit
ray traversal in a BVH using existing first-hit/any-hit kernels. Journal
of Computer Graphics Techniques, 4(4):72—90.
[GNK14] Gribble, C., Naveros, A., & Kerzner, E. (2014) Multi-hit ray traversal. Journal of
Computer Graphics Techniques, 3(1):1—17.
[Gri16] Gribble, C. (2016) Node culling multi-hit BVH traversal. Eurographics Symposium
on Rendering. doi:10.2312/sre.20161213
[GWA16] Gribble, C., Wald, I., & Amstutz, J. (2016) Implementing node culling multi-hit
BVH traversal in Embree. Journal of Computer Graphics Techniques,
5(4):29—35.
50 C. Gribble, Realizing Multi-Hit Ray Tracing in Embree & OSPRay
51. Contact information
Address
Applied Technology Operation
SURVICE Engineering
4695 Millennium Drive
Belcamp, MD 21017
E-mail
christiaan.gribble@survice.com
Web
http://www.survice.com/employees/~cgribble/
51 C. Gribble, Realizing Multi-Hit Ray Tracing in Embree & OSPRay