Download presentation

Presentation is loading. Please wait.

Published byAlfonso Tunstill Modified over 3 years ago

1
computer graphics & visualization Collisions

2
computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group Collisions Avoidance Detection

3
computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group Detection Broad Phase Narrow Phase Detection

4
computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group Broad Phase Bounding Volume (Hierarchies) Space Partitioning Schemes

5
computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group 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
computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group Choosing a Bounding Volume Lots of choices, each with tradeoffs Tighter fitting is better – More likely to eliminate “false” intersections

7
computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group 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
computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group 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
computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group 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
computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group Bounding Volumes: Sphere Rotationally invariant – Usually Usually fast to compute with Store: center point and radius – Center point: object’s center of mass – Radius: distance of farthest point on object from center of mass. Often not very tight fit 10/59

11
computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group 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, unless a loose box that encompasses the bounding sphere 11/59

12
computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group 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. 12/59

13
computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group 13/59 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
computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group 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 only rotation of axes is needed for update Computation is slower than for AABBs, but not as bad as it might seem 14/59

15
computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group 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 some applications 15/59

16
computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group 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
computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group 17/59 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 r2r2r2r2 r1r1r1r1

18
computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group 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
computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group Collision Test Example: OBB vs. OBB Similar to overlap test for k-dops How do we find axes to test for overlap?

20
computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group 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
computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group 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
computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group 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
computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group 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
computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group Bounding Volumes Hierarchies

25
computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group 25/59 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
computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group BVH Collision Test example

27
computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group B-Volume Examples

28
computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group Space partitioning Why space partitioning? The best object is the one that is not going to be processed! – Processing means Determining the spatial relationships between objects – Do objects intersect – collision detection – Naive approach has complexity O(n 2 ) (n polygons in the scene) Can also be: Rendering – Are objects within the visible space – visibility culling – Are objects occluded – occlusion culling

29
computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group Spatial hierarchies Hierarchies of space partitions – (Regular Grid) – Quadtree, Octree – BSP-Trees (BSP = Binary Space Partitioning) – KD-Trees Assignment of objects to partitions Collision detection then becomes 1) determine in which partition the object is 2) test only objects in the same partition Good for static scenes, otherwise the hierarchy has to be re-build

30
computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group 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
computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group Spatial hierarchies Octrees – Recursive regular subdivision of space into 8 subspaces One node is split into 8 child nodes Balanced octree - grid Adaptive quadtree

32
computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group Examples

33
computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group 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
computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group Spatial hierarchies Bsp-Trees (Binary Space Partitioning) – Every cell is a convex polyhedron A C D B P1P1P1P1 P2P2P2P2 P3P3P3P3 P2P2P2P2 P1P1P1P1 P3P3P3P3 A CBD

35
computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group Spatial hierarchies Bsp-Tree example – Inter-object partitioning – Binary tree of lines in 2D A BC D A B C D Partitioning Tree

36
computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group 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
computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group Spatial hierarchies Constructing Bsp-Trees – Elementary operation is recursive subdivision Split convex region into two convex subregions Use hyperplanes as cutting primitives R+ R- Hyperplane R

38
computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group Spatial hierarchies Bsp-Tree construction – Different orderings of faces to use as hyperplanes result in different trees Greedy approach (decisions for each step based on what seems optimal) not always applicable – Good Bsp-Tree represents the model as sequence of approximations Pruning yields different resolutions of the model

39
computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group Spatial hierarchies Bsp-Tree construction – Bsp-Trees only perform good if geometric features are local Is true most of the time Then, a significant subset of space can be eliminated – Low cost (short paths) for reaching high probability regions Similar to Huffman coding – Probability for ´in a region´ is proportional to the size of the region p+ = vol(tree.posSubspace) / vol(tree) p- = vol(tree.negSubspace) / vol(tree)

40
computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group Spatial hierarchies Collison test for particles in BSP-tree – Test, in which node the particle is located – Traverse tree until leafs – Collision, if at least one filled leaf is hit

41
computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group Spatial hierarchies Collision test for particles in BSP-tree – Clip path line between 2 particle locations at separating planes – Test all in-between time steps – Collision will be detected independent of size of time step t0t0 t 0 + t t0t0 collision detected Collision not detected

42
computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group 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

Similar presentations

OK

1Computer Graphics Implementation II Lecture 16 John Shearer Culture Lab – space 2

1Computer Graphics Implementation II Lecture 16 John Shearer Culture Lab – space 2

© 2018 SlidePlayer.com Inc.

All rights reserved.

To ensure the functioning of the site, we use **cookies**. We share information about your activities on the site with our partners and Google partners: social networks and companies engaged in advertising and web analytics. For more information, see the Privacy Policy and Google Privacy & Terms.
Your consent to our cookies if you continue to use this website.

Ads by Google

Ppt on male reproductive system Ppt on share market basics Ppt on chapter 3 drainage hose Ppt on digital media broadcasting projects Ppt on online job portal project By appt only movie free Ppt on bmc remedy software Ppt on operating system and its functions Ppt on way to success Ppt on ancient number system for class 9