1 / 42

Simulation and Animation

Simulation and Animation. Collisions. Collisions. Detection. Broad Phase. Bounding Volumes. Key idea: Surround the object with a (simpler) bounding object (the bounding volume). If something does not collide with the bounding volume, it does not collide with the object inside.

odessa
Download Presentation

Simulation and Animation

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. Simulation and Animation Collisions

  2. Collisions

  3. Detection

  4. Broad Phase

  5. Bounding Volumes • Key idea: • Surround the object with a (simpler) bounding object (the bounding volume). • If something does not collide with the bounding volume, it does not collide with the object inside. • Often, to intersect two objects, first intersect their bounding volumes

  6. Choosing a Bounding Volume • Lots of choices, each with tradeoffs • Tighter fitting is better • More likely to eliminate “false” intersections

  7. Choosing a Bounding Volume • Lots of choices, each with tradeoffs • Tighter fitting is better • Simpler shape is better • Makes it faster to compute with

  8. Choosing a Bounding Volume • Lots of choices, each with tradeoffs • Tighter fitting is better • Simpler shape is better • Rotation Invariant is better • Easier to update as object moves

  9. Choosing a Bounding Volume • Lots of choices, each with tradeoffs • Tighter fitting is better • Simpler shape is better • Rotation Invariant is better • Convex is usually better • Gives simpler shape, easier computation

  10. Bounding Volumes: Sphere • Rotationally invariant • Usually • Usually fast to compute with • Store: center point and radius • Center point: object’s centerof mass • Radius: distance of farthest point on object from centerof mass. • Often not very tight fit

  11. Axis Aligned Bounding Box (AABB) • Very fast to compute with • Store: max and min along x,y,z axes. • Look at all points and record max, min • Moderately tight fit • Must update after rotation, unlessa loose box that encompasses thebounding sphere

  12. Common Bounding Volumes: k-dops • k-discrete oriented polytopes • Same idea as AABBs, but use more axes. • Store: max and min along fixed set of axes. • Need to project points onto other axes. • Tighter fit than AABB, but also a bit more work.

  13. Choosing axes for k-dops • Common axes: consider axes coming out from center of a cube: • Through faces: 6-dop • same as AABB • Faces and vertices: 14-dop • Faces and edge centers: 18-dop • Faces, vertices, and edge centers; 26-dop • More than that not really helpful • Empirical results show 14 or 18-dop performs best.

  14. Oriented Bounding Box (OBB) • Store rectangular parallelepiped oriented to best fit the object • Store: • Center • Orthonormal set of axes • Extent along each axis • Tight fit, but takes work to get good initial fit • OBB rotates with object, therefore onlyrotation of axes is needed for update • Computation is slower than for AABBs,but not as bad as it might seem

  15. Convex Hull • Very tight fit (tightest convex bounding volume) • Slow to compute with • Store: set of polygons forming convex hull • Can rotate CH along with object. • Can be efficient for someapplications

  16. Testing for Collision • Will depend on type of objects and bounding volumes. • Specialized algorithms for each: • Sphere/sphere • AABB/AABB • OBB/OBB • Ray/sphere • Triangle/Triangle

  17. Collision Test Example: Sphere-Sphere • Find distance between centers of spheres • Compare to sum of sphere radii • If distance is less, they collide • For efficiency, check squared distance vs. square of sum of radii d r2 r1

  18. Collision Test Example: AABB vs. AABB • Project AABBs onto axes • i.e. look at extents • If overlapping on all axes, the boxes overlap. • Same idea for k-dops.

  19. Collision Test Example: OBB vs. OBB • Similar to overlap test for k-dops • How do we find axes to test for overlap?

  20. Separating Axis Theorem • Two convex shapes do not overlap if and only if there exists an axis such that the projections of the two shapes do not overlap

  21. Enumerating Separating Axes • 2D: check axis aligned with normal of each face • 3D: check axis aligned with normals of each face and cross product of each pair of edges

  22. Enumerating Separating Axes • 2D: check axis aligned with normal of each face • 3D: check axis aligned with normals of each face and cross product of each pair of edges

  23. Enumerating Separating Axes • 2D: check axis aligned with normal of each face • 3D: check axis aligned with normals of each face and cross product of each pair of edges

  24. Bounding Volumes Hierarchies

  25. Intersecting Bounding Volume Hierarcies • For object-object collision detection • Keep a queue of potentially intersecting BVs • Initialize with main BV for each object • Repeatedly pull next potential pair off queue and test for intersection. • If that pair intersects, put pairs of children into queue. • If no child for both BVs, test triangles inside • Stop when we either run out of pairs (thus no intersection) or we find an intersecting pair of triangles

  26. BVH Collision Test example

  27. B-Volume Examples

  28. Space partitioning Whyspacepartitioning? The bestobjectistheonethatisnot goingtobeprocessed! • Processing means • Determiningthespatialrelationshipsbetweenobjects • Do objectsintersect – collisiondetection • Naive approachhascomplexity O(n2) (n polygons in thescene) • Can also be: Rendering • Are objectswithinthevisiblespace – visibilityculling • Are objectsoccluded – occlusionculling

  29. Spatial hierarchies • Hierarchiesofspacepartitions • (Regular Grid) • Quadtree, Octree • BSP-Trees (BSP = Binary Space Partitioning) • KD-Trees • Assignmentofobjectstopartitions • Collisiondetectionthenbecomes 1) determine in whichpartitiontheobjectis 2) testonlyobjects in the same partition • Goodforstaticscenes, otherwisethehierarchyhastobere-build

  30. Regular Grid • Span course grid over the domain • Find cells in which the objects reside • Test if one cells contains more than one object • Not really a hierarchy (one level)

  31. Spatial hierarchies • Octrees • Recursiveregularsubdivisionofspaceinto 8 subspaces • Onenodeissplitinto 8 childnodes Adaptive quadtree Balancedoctree - grid

  32. Examples

  33. Spatial hierarchies • Bsp-Trees • Computational representation of space • Search structure and representation of geometry • Generalization of binary search trees for dim>1 • Search complexity to find spatial relationships between n polygons within O(n log n) • Recursive space partitioning by means of arbitrarily positioned partitioning planes

  34. Spatial hierarchies • Bsp-Trees (Binary Space Partitioning) • Every cellis a convexpolyhedron P1 A B P2 P3 C B D A P2 D P3 C P1

  35. Spatial hierarchies • Bsp-Treeexample • Inter-objectpartitioning • Binary treeoflines in 2D A A B C B D C D Partitioning Tree

  36. Spatial hierarchies • Characteristics of Bsp-Trees • Transformation of object = transformation of tree • Intra-object relationships remain static for solid objects • Merging with other trees easy to do • Objects in one halfspace cannot intersect objects in the corresponding other halfspace • Accelerates intersection test between objects

  37. Spatial hierarchies • Constructing Bsp-Trees • Elementary operation is recursive subdivision • Split convex region into two convex subregions • Use hyperplanes as cutting primitives Hyperplane R- R R+

  38. Spatial hierarchies • Bsp-Treeconstruction • Different orderingsoffacestouseas hyperplanes result in different trees • Greedyapproach (decisionsforeachstepbased on whatseems optimal) not alwaysapplicable • GoodBsp-Treerepresentsthe model assequenceofapproximations • Pruningyields different resolutionsofthe model

  39. Spatial hierarchies • Bsp-Treeconstruction • Bsp-Treesonlyperformgoodifgeometricfeaturesarelocal • Is truemostofthe time • Then, a significantsubsetofspacecanbeeliminated • Low cost (shortpaths) forreachinghighprobabilityregions • SimilartoHuffmancoding • Probabilityfor ´in a region´ is proportional tothesizeoftheregion • p+ = vol(tree.posSubspace) / vol(tree) • p- = vol(tree.negSubspace) / vol(tree)

  40. Spatial hierarchies • Collisontestforparticles in BSP-tree • Test, in whichnodetheparticleislocated • Traverse treeuntilleafs • Collision, ifat least onefilledleafishit

  41. Spatial hierarchies • Collisiontestforparticles in BSP-tree • Clip pathlinebetween 2 particlelocationsatseparating planes • Test all in-between time steps • Collision will bedetectedindependentofsizeof time step t0 + t t0 + t t0 t0 Collision not detected collision detected

  42. Spatial hierarchies • Collision test for particles with extend • Offset on surfaces (level planes) • Different offsets for different moving objects • Construction of different BSP-trees Problem: Distance too large

More Related