cs 6958 lecture 8 triangles bvh
play

CS 6958 LECTURE 8 TRIANGLES, BVH February 3, 2014 Last Time 2 - PowerPoint PPT Presentation

CS 6958 LECTURE 8 TRIANGLES, BVH February 3, 2014 Last Time 2 derived ray-triangle intersection clarification: ray tracing inherently abstract in terms of object specification we can use any object once we define an algorithm


  1. CS 6958 LECTURE 8 TRIANGLES, BVH February 3, 2014

  2. Last Time 2  derived ray-triangle intersection  clarification:  ray tracing inherently abstract in terms of object specification  we can use any object once we define an algorithm for intersecting it with a ray (and computing localized normal direction)

  3. Ray Tracing Algorithm 3 foreach frame foreach pixel foreach sample generate ray intersect ray with objects shade intersection point

  4. Ray Tracing Algorithm 4 foreach frame foreach pixel foreach sample generate ray intersect ray with objects shade intersection point foreach object t_new = object.intersect(ray) t_closest = min(t_closest, t_new)

  5. Ray Tracing Algorithm 5 /// Abstract Primitive class defining properties which are required for our ray tracer. /// For now, it specifies just ray-object intersection routine, but can be extended to /// support shadow rays, bounding volumes, etc class Primitive { public: virtual bool Intersect(const Ray &ray) const = 0; } /// Sphere primitive class Sphere : public Primitive { bool Intersect(const Ray &ray) const; } // Triangle primitive class Triangle : public Primitive { bool Intersect(const Ray &ray) const; }

  6. Ray Tracing Algorithm 6 /// Abstract Primitive class defining properties which are required for our ray tracer. /// For now, it specifies just ray-object intersection routine, but can be extended to /// support shadow rays, bounding volumes, etc class Primitive { Others: public: • Torus virtual bool Intersect(const Ray &ray) const = 0; • Cone / Cylinder } • Box / Rectangle • Extrusions /// Sphere primitive • Surfaces of revolution class Sphere : public Primitive { • Metaballs bool Intersect(const Ray &ray) const; • Iso-surface } • Spline surfaces • Subdivision surfaces // Triangle primitive class Triangle : public Primitive { bool Intersect(const Ray &ray) const; }

  7. Ray Tracing Algorithm 7 /// Abstract Primitive class defining properties which are required for our ray tracer. /// For now, it specifies just ray-object intersection routine, but can be extended to /// support shadow rays, bounding volumes, etc class Primitive { Others: public: • Torus virtual bool Intersect(const Ray &ray) const = 0; Note! We can’t use inheritance, hence we • Cone / Cylinder } are restricted to a single primitive • Box / Rectangle • Extrusions /// Sphere primitive • Surfaces of revolution class Sphere : public Primitive { • Metaballs bool Intersect(const Ray &ray) const; • Iso-surface } • Spline surfaces • Subdivision surfaces // Triangle primitive class Triangle : public Primitive { bool Intersect(const Ray &ray) const; }

  8. Making Ray Tracing Faster 8  faster rays  packets (less overhead per ray, cache coherence)  CPU optimizations  fewer rays  adaptive super-sampling (less samples)  faster ray-primitive intersection tests  fewer ray-primitive intersection tests  acceleration structures

  9. Which Operation Most Costly? 9 foreach frame foreach pixel foreach sample generate ray intersect ray with objects shade intersection point

  10. Acceleration Structures 10 foreach frame foreach pixel foreach sample generate ray traverse ray through acceleration structure shade intersection point  change O(n) to O(log n), n – objects in scene  intersecting ray with structure primitive must be cheap

  11. Acceleration Structures 11

  12. Acceleration Structures 12  Grid

  13. Acceleration Structures 13  Grid  Octree

  14. Acceleration Structures 14  Grid  Octree

  15. Acceleration Structures 15  Grid  Octree  KD tree (K-dimensional)

  16. Acceleration Structures 16  Grid  Octree  KD tree (K-dimensional)

  17. Acceleration Structures 17  Grid  Octree  KD tree (K-dimensional)  BSP tree (Binary Space Partitioning)

  18. Acceleration Structures 18  Grid  Octree  KD tree (K-dimensional)  BSP tree (Binary Space Partitioning)  BVH (Boundary Volume Hierarchy)

  19. Acceleration Structures 19  Grid  Octree  KD tree (K-dimensional)  BSP tree (Binary Space Partitioning)  BVH (Boundary Volume Hierarchy)

  20. Acceleration Structures 20  Grid  Octree  KD tree (K-dimensional)  BSP tree (Binary Space Partitioning)  BVH (Boundary Volume Hierarchy)

  21. Acceleration Structures 21  Grid  Octree  KD tree (K-dimensional)  BSP tree (Binary Space Partitioning)  BVH (Boundary Volume Hierarchy)

  22. BVH Traversal - Idea 22

  23. BVH Traversal - Idea 23

  24. BVH Traversal - Idea 24

  25. BVH Traversal - Idea 25

  26. BVH Traversal - Idea 26

  27. BVH Traversal - Idea 27

  28. BVH Traversal - Idea 28

  29. BVH Traversal - Idea 29

  30. BVH Traversal - Idea 30

  31. BVH Traversal - Pseudocode 31  description is recursive, but  TPs have small stack memory, so manage it ourselves  code will run faster int stack[32]; // holds node IDs to traverse int sp = 0; // stack pointer into the above

  32. BVH Traversal - Pseudocode 32 current_node = root while(true) { if( ray intersects current_node ) { if( current_node._is_interior() ) { stack._push( current_node._right_child_id() ) current_node = current_node._left_child_id() continue } else intersect all triangles in leaf } if( stack._is_empty() ) break current_node = stack._pop() }

  33. BVH Traversal - Optimizations 33  traverse closer child first  don’t traverse subtree if closer hit found

  34. Axis Aligned Bounding Box 34  Let’s try to derive an intersection test  Box representation?

  35. End 35

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend