Hybrid Ray Tracing of Massive Models Christian Lauterbach
Hybrid Ray Tracing of Massive Models Christian Lauterbach Dinesh Manocha UNC Chapel Hill 10/12/2009
Motivation: Ray Tracing As a visualization method General and robust solution for light transport �Transparency, refraction, reflection �Lighting: shadows, indirect lighting, … Performance logarithmic with model complexity 2
This talk Memory issues for ray tracing of massive models Hybrid rendering approaches 3
Problem: Memory overhead Any object can be accessed by ray at any time Need to store acceleration structure Access pattern Low locality High number of cache misses 3 orders of magnitude ~ disk vs. memory speed 4
Massive models: Reduce. M Goals: Compact representation for hierarchy and geometry Low rendering performance overhead 5
Reduce. M idea Triangle strips for ray tracing Two-level hierarchy: … High-level hierarchy (BVH, kd-tree, …) … … Compact combined representation for hierarchy and geometry 6
Reduce. M Main features: Compact Reduce. M representation Fast traversal and intersection of strips Construction of triangle strips optimized for ray tracing 7
Representation Based on triangle strips Encode hierarchy on top as efficiently as possible 7 6 4 5 2 1 3 8
Representation Key idea: Can represent hierarchy via order of vertices 7 6 4 5 2 1 3 9
Representation Overall: Store vertices in order that defines hierarchy Store local indices to define strip Sufficient both for triangle intersection and hierarchy traversal Overhead for hierarchy Local vertex indices Some vertices stored twice (about 1. 5 -3%) 10
Traversal and intersection Ported ray packet techniques to Reduce. M New possibilities: Larger packet size for high-level hierarchy Share edge results for triangle intersection Intersection of single ray with multiple edges �Up to 90% higher ray tracing performance [Lauterbach et al. 07] 11
Construction Many algorithms for triangle strip generation for GPU rasterization Different criteria for ray tracing Length compression ratio Spatial coherence ray tracing performance 12
Construction overview Graph Adjacency Graph + Hierarchy Partitioning Sequences Ordering Triangle strips Strip output [1, 3, 2, 4, 6] [6, 4, 7, 9, 8] 13
Construction algorithm Our approach: Strip generation using surface area heuristic information Partitioning: generate ideal hierarchy Graph + Hierarchy Partitioning Ordering: Ordering Use hierarchy as reference to evaluate possible triangle sequences Iteratively try to combine sequences 14
Results Tested on set of massive models All benchmarks are fully in-core [Lauterbach et al. 07, Lauterbach et al. 08] St. Matthew (372 M) Build time: 1 h 36 m Powerplant (12. 7 M) Build time: 5 m Double Eagle (82 M) Build time: 33 m Boeing 777 (360 M) Build time: 1 h 50 m 15
Key results Memory footprint Reduced by up to 80% compared to standard kd- tree or BVH Rendering performance Optimized strips: up to 58% higher compared to rasterization strips Overall performance comparable to kd-tree �Higher for some large models Single ray performance up to 90% higher 16
Results Logarithmic performance maintained 6 Time for rendering 5 4 3 2 1 0 0 20 40 60 80 100 120 Model complexity : Millions of triangles 140 17
Comparison Most similar to compressed BVH approaches [Mahovsky 05, Cline et al. 06] Higher compression of hierarchy But: Does not change geometry footprint Rendering times 40 -60% with best compression �Worst for single rays 18
State-of-the-art Basic visualization: fast enough E. g. visibility, shading, hard shadows One or several rays / pixel Decent lighting: barely interactive (~1 -5 fps) E. g. soft shadows, simple ambient occlusion <= 16 rays / pixel High-quality: non-interactive (<< 1 fps) E. g. indirect lighting, “good” lighting, anti-aliasing Tens to hundreds of rays / pixel 19
GPU Rendering Fast visibility Levels-of-detail, mesh layouts, compression, out- of-core rendering, … High quality Cheap antialiasing, shading, … 20
Hybrid rendering One solution until hardware nirvana Use GPU rendering where it makes sense Use ray tracing otherwise Try to reduce ray workload 21
Future architectures Graphics pipelines are getting more flexible GPUs �Direct. X 11 compute shaders �More configurable stages Intel Larrabee �Software pipeline 22
Hybrid ray tracing Already widely used in GPU ray tracing Rasterize visibility, add reflection, refraction and shadows with ray tracing [Reiter-Horn et al. 07] Counter-argument When ray tracing 100+ rays/pixel, why care about one more for visibility? 23
Selective ray tracing Motivation: GPU ray tracing feasible, but still orders of magnitude slower than rasterization Want to use ray tracing for ‘interesting’ effects Accurate hard/soft shadows Ambient occlusion Indirect lighting, … But: Hardware not yet fast enough to trace enough rays 24
GPU algorithms Hard shadows (from [Lloyd 08]) Soft shadows (from [Laine et al. 05]) Ambient occlusion (from [Bavoil et al. 08]) Problems: Hard-to-control errors Not robust Not scalable 25
Selective ray tracing Idea: Use ray tracing only to correct localized errors in GPU rendering algorithms Example: Shadow mapping Artifacts marked Final result 26
Overview Hierarchy Geometry Open ray buffer Frame buffer(s) unshaded Traced ray results FB shaded with ray results FB with pixels marked Accuracy detection Ray generation and compaction Ray tracing Shading Main applications: Hard shadows Soft shadows Ambient occlusion 27
Massive model rendering To use ray tracing, need to store geometry and hierarchy on GPU Problem: even less memory than CPUs Reduce. M for GPU ray tracing With minor modifications can also use directly use strip representation in GPU rendering 28
Shadow mapping algorithm Renders scene from light into depth map During rendering, reproject each pixel to light’s view and test whether occluded using map Main source of error is mismatched sampling rate of shadow map Result Jagged shadow boundaries Missed shadows 29
Shadow mapping Normal shadow mapping Edge detection + conservative rendering 30
Soft shadows Also identify and ray trace penumbra regions Our solution: Project area light onto each shadow map pixel Mark all pixels in that projected region 31
Ambient occlusion R Screen-space ambient occlusion Reconstruct local geometry from depth buffer neighborhood: x R 32
Ambient occlusion Problems: Information in depth buffer insufficient a) c) x Actual geometry b) d) x x Result: missing shadows or view-dependent changes in occlusion 33
Ambient occlusion Error detection: Find discontinuities in neighborhood If found, revert to ray tracing Can partially ray trace E. g. discontinuity in one quadrant? Still use screen -space solution for others 34
Shadow results Rendering of complex models with accurate shadows on current GPU E. g. Powerplant Performance: ~3 -5 times faster than full ray tracing ~2 -3 times slower than original algorithm Accuracy Virtually identical to ray traced solution 35
Shadow results Hard shadows, real-time capture Soft shadows, ~2 fps 36
Challenges Integrate with GPU rendering Levels-of-detail Shared representations for rendering Ray organization 37
Future work GPU rendering as dense visibility sampling Can use for more general purposes? Hybrid rendering representations How to modify future rendering pipelines? 38
Next up: 30 min. break Then: Sung-Eui Yoon: Data Management 39
- Slides: 39