Download presentation
Presentation is loading. Please wait.
Published byJocelyn Charity Haynes Modified over 9 years ago
1
Ray Tracing Acceleration (5)
2
Ray Tracing Acceleration Techniques Too Slow! Uniform grids Spatial hierarchies K-D Octtree BSP Hierarchical grids Hierarchical bounding volumes (HBV) Tighter bounds Faster intersector Early ray termination Adaptive sampling Beam tracing Cone tracing Pencil tracing Faster intersection N1 Fewer raysGeneralized rays
3
Roadmap (LRT book, ch 4 – Intersection Acceleration) Approaches To Reducing Intersections –Ray-Box Intersections –Regular Grid –Hierarchical bounding volumes –BSP trees and friends –Meta-Hierarchies –Refinements to basic approaches Hierarchical Grid Accelerator –Creation –Traversal Kd Tree –Tree Representation –Tree construction –Traversal Further Reading
4
Grids 3-D array of cells Each cell contains list of all objects it intersects Ray intersected with all objects in a given cell’s list Cells visited in Bresenham order
5
Bounding Volume Hierarchies
6
Hierarchical Bounding Volumes (HBV) Trees of bounding volumes are constructed in a similar way to spatial hierarchy HBV does not partition space: the bounding volumes can overlap each other. HBV can be created from existing model hierarchy or by running a clustering algorithm.
7
Bounding Volume Ray-bunny intersection takes 70K ray-triangle intersections even if ray misses the bunny Place a sphere around bunny –Ray A misses sphere so ray A misses bunny without checking 70K ray-triangle intersections –Ray B intersects sphere but still misses bunny after checking 70K intersections –Ray C intersects sphere and intersects bunny Can also use axis-aligned bounding box –Easier to create for triangle mesh A B C
8
Bounding Volume Hierarchy Associate bounding volume with each node of scene graph If ray misses a node’s bounding volume, then no need to check any node beneath it If ray hits a node’s BV, then replace it with its children’s BV’s (or geometry) Breadth first search of tree –Maintain heap ordered by ray- BV intersection t-values –Explore children of node w/least pos. ray-BV t-value A B C Bunny BV Body BV Head BV L.EarFaceR.Ear BV
9
Choosing Bounding Volumes
10
Hierarchical Bounding Volumes
11
Heuristics for an Effective Bounding Hierarchy
12
Bounding Volume Hierarchy
13
Find bounding box of objects
14
Bounding Volume Hierarchy Find bounding box of objects Split objects into two groups
15
Bounding Volume Hierarchy Find bounding box of objects Split objects into two groups Recurse
16
Bounding Volume Hierarchy Find bounding box of objects Split objects into two groups Recurse
17
Bounding Volume Hierarchy Find bounding box of objects Split objects into two groups Recurse
18
Bounding Volume Hierarchy Find bounding box of objects Split objects into two groups Recurse
19
Where to split objects? At midpoint OR Sort, and put half of the objects on each side OR Use modeling hierarchy
20
Intersection with BVH Check subvolume with closer intersection first
21
Intersection with BVH Don't return intersection immediately if the other subvolume may have a closer intersection
22
Hierarchical Bounding Volumes Create tree of bounding volumes Children are contained within parent Creation preprocess –From model hierarchy –Automatic clustering Search intersect(node,ray,hits) { if( intersectp(node->bound,ray) if( leaf(node) ) intersect(node->prims,ray,hits) else for each child intersect(child,ray,hits) }
23
Bounding Volume Hierarchy Discussion Advantages –easy to construct –easy to traverse –binary Disadvantages –may be difficult to choose a good split for a node –poor split may result in minimal spatial pruning
24
Ray Tracing Acceleration Techniques Too Slow! Uniform grids Spatial hierarchies K-D Octtree BSP Hierarchical grids Hierarchical bounding volumes (HBV) Tighter bounds Faster intersector Early ray termination Adaptive sampling Beam tracing Cone tracing Pencil tracing Faster intersection N1 Fewer raysGeneralized rays
25
Uniform Spatial Partition
26
Spatial Partition Structures
27
Pitfalls!
28
3-d Trees (K-d Trees)
29
Octrees
31
BSP Trees
32
Ray Tracing BSP Trees
33
Wrap-up Uniform Grids, Spatial Hierarchies, Hierarchical Grids, HBVs Question: Which one of the above is best? Answer: I don’t know. Here all techniques are heuristics.
34
Wrap-up Vlastimil Havran’s Best E.ciency Scheme Project at http://sgi.felk.cvut.cz/BES/ compares different accelerators. Basically every one of them works better in some cases and worse in some other cases. Worst case for ”Uniform Grid” is sparse scenes, –for example, a very complicated bunny model put at the center of a huge stadium.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.