1 / 29

Collision Detection and Acceleration

Collision Detection and Acceleration. Rama Hoetzlein, 2008 Lecture Notes Cornell University. What is Collision Detection?. What if we have lots of objects?. What are some solutions?. 1. Spatial partitioning. Spatial partitioning. Cells. A. B. C. D. 1.

anakin
Télécharger la présentation

Collision Detection and 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. Collision Detection and Acceleration Rama Hoetzlein, 2008Lecture NotesCornell University

  2. What is Collision Detection?...

  3. What if we have lots of objects? What are some solutions?

  4. 1. Spatial partitioning

  5. Spatial partitioning Cells A B C D 1 • Each grid cell can contain multiple objects- How do we map position to cell number? 2 E F 3 .. n

  6. 2. Octree partitioning - Insertion and retrieval are O( log n )- What are some limitations?

  7. 3. Bounding Volumes

  8. Bounding Volumes – 3D Sphere OBB AABB • Bounding Volume (BV) – a volume that encloses a set of objects • The idea is to use a much similar geometric shape for quick tests (frustum culling for example) • Easy to compute, as tight as possible • AABB, Sphere – easy to compute, but poor fit

  9. Conservative Bounds • tight → avoid false positives • fast to intersect axis-aligned bounding box(AABB) non-aligned oriented bounding box (OBB) bounding sphere arbitrary convex region (bounding half-spaces)

  10. AABB Ray Intersection • Many acceleration structures can be used for both collision detection & raytracing • For all 3 axes, calculate the intersection distances t1 and t2 • tnear= max (t1x, t1y, t1z)tfar= min (t2x, t2y, t2z) • If tnear> tfar, box is missed • If tfar< tnclip, box is behind • If box survived tests, report intersection at tnear t2x tfar y=Y2 t2y tnear t1x y=Y1 t1y x=X2 x=X1

  11. Bounding Volume Hierarchies • Use hierarchicy of scene to create a tree of bounding volumes.- Volumes can overlap Parent volume Child volume

  12. 4. Binary Space Partition (BSP-Tree) • Main purpose – depth sorting • Consisting of a dividing plane, and a BSP tree on each side of the dividing plane (note the recursive definition) • The back to front traversal order can be decided right away according to where the eye is

  13. Binary Space Partition... cont’d. • Two possible implementations: Axis-Aligned BSP Polygon-Aligned BSP Divide space along world axis. Divide space along scene planes. Intersecting?

  14. 0 1a 1b B A C 2 D E BSP Trees - Axis-Aligned (k-d tree) • Starting with an AABB • Recursively subdivide into small boxes • One possible strategy: cycle through the axes (also called k-d trees) D E B 2 1b 1a A C 0 Q: Objects intersect the boundaries?

  15. BSP Trees - Polygon-Aligned - Recursively divide space along polygons in the scene- Each leaf is a convex, enclosed space- Fast traversal, but slow to create.. So, create only once.

  16. BSP Trees - Polygon-Aligned • Combined with raycasting- First real-time 3D first person No slanted walls = 2D BSP

  17. 5. Axis-Aligned Sorting What is the total run time?

  18. .. Spatial paritioning demo..

  19. Narrow phase Example from Computer Games... What is broad phase here?What is narrow phase?

  20. Narrow Phase: Alpha-channel Masks (for images) Benefits?

  21. Narrow Phase: Vector sprites (2D)

  22. Narrow Phase: Polyhedral mesh intersection (3D) • Hard problem - Near constant time methods exist. • What is the result? Simplify. Don’t need full intersections.

  23. Narrow Phase: Cell occupancy Special case: Objects exactly fill a grid cell..

  24. Applications?

  25. Applications of Mesh Intersections: 1. Raytracing - Ray-mesh intersection 2. Machine industry - CSG, Computational Solid Geometry Tool part subtracts from solid part 3. Boolean Shapes - Modeling by add / subtract / intersect 4. Games - Real-time rigid body collisions 5. Medical - When does instrument (scalpel, etc.) intersect with body anatomy.

More Related