
1
Jernej Barbic
University of Southern California
CSCI 420 Computer Graphics
Lecture 17
Spatial Data Structures
Hierarchical Bounding Volumes
Regular Grids
Octrees
BSP Trees
[Ch. 10.12]
2
Ray Tracing Acceleration
• Faster intersections
– Faster ray-object intersections
• Object bounding volume
• Efficient intersectors
– Fewer ray-object intersections
• Hierarchical bounding volumes (boxes, spheres)
• Spatial data structures
• Directional techniques
• Fewer rays
– Adaptive tree-depth control
– Stochastic sampling
• Generalized rays (beams, cones)
3
Spatial Data Structures
• Data structures to store geometric information
• Sample applications
– Collision detection
– Location queries
– Chemical simulations
– Rendering
• Spatial data structures for ray tracing
– Object-centric data structures (bounding volumes)
– Space subdivision (grids, octrees, BSP trees)
– Speed-up of 10x, 100x, or more
4
Bounding Volumes
• Wrap complex objects in simple ones
• Does ray intersect bounding box?
– No: does not intersect enclosed objects
– Yes: calculate intersection with enclosed objects
• Common types:
Axis-aligned
Bounding
Box (AABB)
Oriented
Bounding
Box (OBB)
Sphere Convex Hull
6-dop
5
Selection of Bounding Volumes
• Effectiveness depends on:
– Probability that ray hits bounding volume, but not
enclosed objects (tight fit is better)
– Expense to calculate intersections with bounding
volume and enclosed objects
• Amortize calculation of bounding volumes
• Use heuristics
good
bad
6
Hierarchical Bounding Volumes
• With simple bounding volumes, ray casting still
requires O(n) intersection tests
• Idea: use tree data structure
– Larger bounding volumes contain smaller ones etc.
– Sometimes naturally available (e.g. human figure)
– Sometimes difficult to compute
• Often reduces complexity to O(log(n))