1 / 109

Acceleration

Acceleration. Digital Image Synthesis Yung-Yu Chuang 10/8/2009. with slides by Mario Costa Sousa, Gordon Stoll and Pat Hanrahan. Classes. Primitive (in core/primitive.*) GeometricPrimitive InstancePrimitive Aggregate Two types of accelerators are provided (in accelerators/*.cpp)

fitzpatrick
Download Presentation

Acceleration

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Acceleration Digital Image Synthesis Yung-Yu Chuang 10/8/2009 with slides by Mario Costa Sousa, Gordon Stoll and Pat Hanrahan

  2. Classes • Primitive (in core/primitive.*) • GeometricPrimitive • InstancePrimitive • Aggregate • Two types of accelerators are provided (in accelerators/*.cpp) • GridAccel • KdTreeAccel

  3. Hierarchy Primitive Instance Primitive Aggregate Geometric Primitive T Material Shape

  4. Primitive class Primitive : public ReferenceCounted { <Primitive interface> } class InstancePrimitive : public Primitive { … Reference<Primitive> instance; }

  5. Interface BBox WorldBound(); bool CanIntersect(); bool Intersect(const Ray &r, Intersection *in); bool IntersectP(const Ray &r); void Refine(vector<Reference<Primitive>> &refined); void FullyRefine(vector<Reference<Primitive>> &refined); AreaLight *GetAreaLight(); BSDF *GetBSDF(const DifferentialGeometry &dg, const Transform &WorldToObject); geometry // updatemaxt material

  6. Intersection • primitive stores the actual intersecting primitive, hence Primitive->GetAreaLight and GetBSDF can only be called for GeometricPrimitive struct Intersection { <Intersection interface> DifferentialGeometry dg; const Primitive *primitive; Transform WorldToObject; }; More information than DifferentialGeometry; also contains material information

  7. GeometricPrimitive • represents a single shape • holds a reference to a Shape and its Material,and a pointer to an AreaLight Reference<Shape> shape; Reference<Material> material; // BRDF AreaLight *areaLight; // emittance • Most operations are forwarded to shape

  8. Object instancing 61 unique plant models, 1.1M triangles, 300MB 4000 individual plants, 19.5M triangles

  9. InstancePrimitive Reference<Primitive> instance; Transform InstanceToWorld, WorldToInstance; Ray ray = WorldToInstance(r); if (!instance->Intersect(ray, isect)) return false; r.maxt = ray.maxt; isect->WorldToObject = isect->WorldToObject *WorldToInstance;

  10. Aggregates • Acceleration is a heart component of a ray tracer because ray/scene intersection accounts for the majority of execution time • Goal: reduce the number of ray/primitive intersections by quick simultaneous rejection of groups of primitives and the fact that nearby intersections are likely to be found first • Two main approaches: spatial subdivision, object subdivision • No clear winner

  11. Acceleration techniques

  12. Bounding volume hierarchy

  13. Find bounding box of objects Bounding volume hierarchy

  14. Find bounding box of objects Split objects into two groups Bounding volume hierarchy

  15. Find bounding box of objects Split objects into two groups Recurse Bounding volume hierarchy

  16. Find bounding box of objects Split objects into two groups Recurse Bounding volume hierarchy

  17. Find bounding box of objects Split objects into two groups Recurse Bounding volume hierarchy

  18. Find bounding box of objects Split objects into two groups Recurse Bounding volume hierarchy

  19. At midpoint Sort, and put half of the objects on each side Use modeling hierarchy Where to split?

  20. If hit parent, then check all children BVH traversal

  21. Don't return intersection immediately because the other subvolumes may have a closer intersection BVH traversal

  22. Bounding volume hierarchy

  23. Bounding volume hierarchy

  24. Quadtree (2D) Octree (3D) Space subdivisionapproaches Unifrom grid

  25. KD tree Space subdivisionapproaches BSP tree

  26. Uniform grid

  27. Preprocess scene Find bounding box Uniform grid

  28. Preprocess scene Find bounding box Determine grid resolution Uniform grid

  29. Preprocess scene Find bounding box Determine grid resolution Place object in cell if its bounding box overlaps the cell Uniform grid

  30. Preprocess scene Find bounding box Determine grid resolution Place object in cell if its bounding box overlaps the cell Check that object overlaps cell (expensive!) Uniform grid

  31. Preprocess scene Traverse grid 3D line = 3D-DDA (Digital Differential Analyzer) Uniform grid traversal naive DDA

  32. octree Octree

  33. K-d tree A A Leaf nodes correspond to unique regions in space

  34. K-d tree A B A Leaf nodes correspond to unique regions in space

  35. K-d tree A B B A Leaf nodes correspond to unique regions in space

  36. K-d tree A C B B A

  37. K-d tree A C B C B A

  38. K-d tree A C D B C B A

  39. K-d tree A C D B C B D A

  40. K-d tree A D B B C C D A Leaf nodes correspond to unique regions in space

  41. K-d tree traversal A D B B C C D A Leaf nodes correspond to unique regions in space

  42. BSP tree 6 5 9 7 10 8 1 11 2 4 3

  43. BSP tree 6 5 1 outside ones inside ones 9 7 10 8 1 11 2 4 3

  44. BSP tree 6 5 1 5 6 7 8 9 10 11 2 3 4 9 7 10 8 1 11 2 4 3

  45. BSP tree 6 1 5 5 9b 9 6 7 9a 10 11a 8 9b 11b 7 10 11b 8 9a 1 11 11a 2 4 3

  46. BSP tree 6 5 1 9b 9 5 2 7 10 11b 8 8 3 6 9a 1 11 9b 7 4 11a 2 4 9a 11b 3 10 11a

  47. BSP tree traversal 6 5 1 9b 9 5 2 7 11b 10 11b 8 8 3 6 9a 9a 1 11 9b 7 4 11a 2 4 9a 11b point 3 10 11a

  48. BSP tree traversal 6 5 1 9b 9 5 2 7 11b 10 11b 8 8 3 6 9a 9a 1 11 9b 7 4 11a 2 4 9a 11b point 3 10 11a

  49. BSP tree traversal 6 5 1 9b 9 5 2 7 11b 10 11b 8 8 3 6 9a 9a 1 11 9b 7 4 11a 2 4 9a 11b point 3 10 11a

  50. Ray-Box intersections • Both GridAccel and KdTreeAccel require it • Quick rejection, use enter and exit point to traverse the hierarchy • AABB is the intersection of three slabs

More Related