Ray Tracing Acceleration Techniques Approaches Faster Intersection N

  • Slides: 24
Download presentation
Ray Tracing Acceleration Techniques Approaches Faster Intersection N Uniform grids Spatial hierarchies k-d, oct-tree,

Ray Tracing Acceleration Techniques Approaches Faster Intersection N Uniform grids Spatial hierarchies k-d, oct-tree, bsp hierarchical grids Hierarchical bounding volumes (HBV) CS 348 B Lecture 3 Fewer Rays Generalized Rays 1 Tighter bounds Faster intersector Early ray termination Adaptive sampling Beam tracing Cone tracing Pencil tracing Pat Hanrahan, Spring 2005

Primitives pbrt primitive base class n Shape n Material and emission (area light) Primitives

Primitives pbrt primitive base class n Shape n Material and emission (area light) Primitives n Basic geometric primitive n Primitive instance n n Transformation and pointer to basic primitive Aggregate (collection) n Treat collections just like basic primitives n Incorporate acceleration structures into collections n May nest accelerators of different types n Types: grid. cpp and kdtree. cpp CS 348 B Lecture 3 Pat Hanrahan, Spring 2005

Uniform Grids Preprocess scene 1. Find bounding box CS 348 B Lecture 3 Pat

Uniform Grids Preprocess scene 1. Find bounding box CS 348 B Lecture 3 Pat Hanrahan, Spring 2005

Uniform Grids Preprocess scene 1. Find bounding box 2. Determine resolution CS 348 B

Uniform Grids Preprocess scene 1. Find bounding box 2. Determine resolution CS 348 B Lecture 3 Pat Hanrahan, Spring 2005

Uniform Grids Preprocess scene 1. Find bounding box 2. Determine resolution 2. Place object

Uniform Grids Preprocess scene 1. Find bounding box 2. Determine resolution 2. Place object in cell, if object overlaps cell CS 348 B Lecture 3 Pat Hanrahan, Spring 2005

Uniform Grids Preprocess scene 1. Find bounding box 2. Determine resolution 3. Place object

Uniform Grids Preprocess scene 1. Find bounding box 2. Determine resolution 3. Place object in cell, if object overlaps cell 4. Check that object intersects cell CS 348 B Lecture 3 Pat Hanrahan, Spring 2005

Uniform Grids Preprocess scene Traverse grid 3 D line – 3 D-DDA 6 -connected

Uniform Grids Preprocess scene Traverse grid 3 D line – 3 D-DDA 6 -connected line Section 4. 3 CS 348 B Lecture 3 Pat Hanrahan, Spring 2005

Caveat: Overlap Optimize for objects that overlap multiple cells Traverse until tmin(cell) > tmax(ray)

Caveat: Overlap Optimize for objects that overlap multiple cells Traverse until tmin(cell) > tmax(ray) Problem: Redundant intersection tests: Solution: Mailboxes n Assign each ray an increasing number n Primitive intersection cache (mailbox) n Store last ray number tested in mailbox n Only intersect if ray number is greater CS 348 B Lecture 3 Pat Hanrahan, Spring 2005

Spatial Hierarchies A A Letters correspond to planes (A) Point Location by recursive search

Spatial Hierarchies A A Letters correspond to planes (A) Point Location by recursive search CS 348 B Lecture 3 Pat Hanrahan, Spring 2005

Spatial Hierarchies A B B A Letters correspond to planes (A, B) Point Location

Spatial Hierarchies A B B A Letters correspond to planes (A, B) Point Location by recursive search CS 348 B Lecture 3 Pat Hanrahan, Spring 2005

Spatial Hierarchies A D B B C C D A Letters correspond to planes

Spatial Hierarchies A D B B C C D A Letters correspond to planes (A, B, C, D) Point Location by recursive search CS 348 B Lecture 3 Pat Hanrahan, Spring 2005

Variations kd-tree CS 348 B Lecture 3 oct-tree bsp-tree Pat Hanrahan, Spring 2005

Variations kd-tree CS 348 B Lecture 3 oct-tree bsp-tree Pat Hanrahan, Spring 2005

Ray Traversal Algorithms Recursive inorder traversal [Kaplan, Arvo, Jansen] Intersect(L, tmin, tmax) Intersect(L, tmin,

Ray Traversal Algorithms Recursive inorder traversal [Kaplan, Arvo, Jansen] Intersect(L, tmin, tmax) Intersect(L, tmin, t*) Intersect(R, tmin, tmax) Intersect(R, t*, tmax) CS 348 B Lecture 3 Pat Hanrahan, Spring 2005

Build Hierarchy Top-Down ? CS 348 B Lecture 3 Choose splitting plane • Midpoint

Build Hierarchy Top-Down ? CS 348 B Lecture 3 Choose splitting plane • Midpoint • Median cut • Surface area heuristic Pat Hanrahan, Spring 2005

Surface Area and Rays Number of rays in a given direction that hit an

Surface Area and Rays Number of rays in a given direction that hit an object is proportional to its projected area The total number of rays hitting an object is Crofton’s Theorem: For a convex body For example: sphere CS 348 B Lecture 3 Pat Hanrahan, Spring 2005

Surface Area and Rays The probability of a ray hitting a convex shape that

Surface Area and Rays The probability of a ray hitting a convex shape that is completely inside a convex cell equals CS 348 B Lecture 3 Pat Hanrahan, Spring 2005

Surface Area Heuristic Intersection time Traversal time a CS 348 B Lecture 3 b

Surface Area Heuristic Intersection time Traversal time a CS 348 B Lecture 3 b Pat Hanrahan, Spring 2005

Surface Area Heuristic 2 n splits a CS 348 B Lecture 3 b Pat

Surface Area Heuristic 2 n splits a CS 348 B Lecture 3 b Pat Hanrahan, Spring 2005

Comparison V. Havran, Best Efficiency Scheme Project http: //sgi. felk. cvut. cz/BES/ CS 348

Comparison V. Havran, Best Efficiency Scheme Project http: //sgi. felk. cvut. cz/BES/ CS 348 B Lecture 3 Pat Hanrahan, Spring 2005

Comparison CS 348 B Lecture 3 Pat Hanrahan, Spring 2005

Comparison CS 348 B Lecture 3 Pat Hanrahan, Spring 2005

Univ. Saarland RTRT Engine Ray-casts per second = FPS @ 1 K × 1

Univ. Saarland RTRT Engine Ray-casts per second = FPS @ 1 K × 1 K RT&Shading Scene ERW 6 (static) ERW 6 (dynamic) Conf (static) Conf (dynamic) Soda Hall SSE No SSE no shd. 7. 1 4. 8 4. 55 simple shd. 2. 3 1. 97 1. 93 simple shd. 1. 37 1. 06 1. 2 2. 94 4. 12 1. 6 1. 8 0. 82 1. 055 Pentium-IV 2. 5 GHz laptop Kd-tree with surface-area heuristic [Havran] Wald et al. 2003 [http: //www. mpi-sb. mpg. de/~wald/] CS 348 B Lecture 3 Pat Hanrahan, Spring 2005

Interactive Ray Tracing Highly optimized software ray tracers n Use vector instructions; Cache optimized

Interactive Ray Tracing Highly optimized software ray tracers n Use vector instructions; Cache optimized n Clusters and shared memory MPs Ray tracing hardware n AR 250/350 ray tracing processor www. art-render. com n Saar. COR Ray tracing on programmable GPUs CS 348 B Lecture 3 Pat Hanrahan, Spring 2005

Theoretical Nugget 1 Computational geometry of ray shooting 1. Triangles (Pellegrini) n Time: n

Theoretical Nugget 1 Computational geometry of ray shooting 1. Triangles (Pellegrini) n Time: n Space: 2. Sphere (Guibas and Pellegrini) n Time: n Space: CS 348 B Lecture 3 Pat Hanrahan, Spring 2005

Theoretical Nugget 2 Optical computer = Turing machine Reif, Tygar, Yoshida y = y+1

Theoretical Nugget 2 Optical computer = Turing machine Reif, Tygar, Yoshida y = y+1 Determining if a ray starting at y 0 arrives y = -2*y at yn is undecidable if( y>0 ) CS 348 B Lecture 3 Pat Hanrahan, Spring 2005