Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 11 Collision Detection 가상현실 입문 2002.6.5 그래픽스 연구실 민성환.

Similar presentations


Presentation on theme: "Chapter 11 Collision Detection 가상현실 입문 2002.6.5 그래픽스 연구실 민성환."— Presentation transcript:

1 Chapter 11 Collision Detection 가상현실 입문 2002.6.5 그래픽스 연구실 민성환

2 2 Collision Detection (CD)  A fundamental and important ingredient in many computer graphics and virtual reality applications  Can be divided into three major parts  Collision detection  Detects whether two objects collide  Collision determination  Finds the actual intersections between a pair objects  Collision response  Determines what actions should be taken in response

3 3 Content  In section 11.1  We discuss simple and fast CD techniques  Main idea is to approximate a complex object using a set of lines  In section 11.2  Hierarchical bounding volume collision detection algorithm  In section 11.3 and 11.4  Two particular implementations  In section 11.5  A Multiple objects CD system

4 4 CD System  There are desirable for most CD system  Achieve interactive rates  Handle polygon soup ( general polygon models with no restrictions)  Can undergo rigid-body motion  Provide efficient bounding volume(BV) fitting  A restriction  The methods are static, meaning the collision detection only occurs at discrete times

5 5 Naive approach  A scenario may contain tens or hundreds of moving objects  If the scenario contains n moving objects and m static objects, then a naïve method would perform Object tests for each frame  The naive approach quickly becomes expensive as m and n rise

6 6 CD with Rays  A fast technique which works very well under certain circumstance  We can approximate a moving object with a set of rays  Imagine that a car drives upward on an incline road  In the case of the car, we can put one ray at each of the four wheels  The rays are then intersection-tested against the environment –If the distance from a ray origin to the environment is zero  wheel is exactly on the ground –If the distance is greater than zero  no contact with the environment –A negative distance means that the wheel has merged “into” the environment  The application can use these distance for computing a collision response –A negative distance  move the car upward –A positive distance  move the car downward

7 7 CD with Rays (cont.)  To speed up  Can use the same technique we always use to speed thing up in CG  a hierarchical representation  Environment can be represented by a BSP tree

8 8 General Hierarchical CD  Hierarchy Building  There are three ways to build a hierarchy  Bottom-up method  Incremental tree-insertion method  Top-down approach method

9 9 Hierarchy Building (1/3)  Bottom-up method  Starts by combining a number of primitives and finding a BV for them  Then this BV is grouped with one or more BVs constructed a similar way,thus yielding a new, larger parent BV  Repeated until only one BV exists, which then becomes the root

10 10 Hierarchy Building (2/3)  Incremental tree-insertion method  Starts with an empty tree  Then all other primitives and their BVs are added one at a time  To make an efficient tree, an insertion point in the tree must be found  This point should be selected so that the total tree volume increase is minimized

11 11 Hierarchy Building (3/3)  Top-down approach  Starts by finding a BV for all primitives of the model  root  Then a divide and conquer strategy is applied  BV is first split into k  For each such part, all included primitives are found, and then a BV is created in the same manner as for the root  A potential advantage is that a hierarchy can be created lazily  This means that we only construct the hierarchy for those parts of the scene where it is actually needed

12 12 Collision Testing between Hierarchies  Pseudocode  A and B are tow nodes in the model hierarchies FindFirstHitCD(A,B) returns ({TRUE,FALSE}); if (not overlap(A BV,B BV ) return FALSE; else if (isLeaf(A)) if (isLeaf(B)) for each triangle pair T A  A C and T V  B C if (overlap(T A,T B )) return TRUE; else for each child C B  B C FindFirstHitCD(A,C B ) else for each child C A  A C FindFirstHitCD(C A,B) return FALSE

13 13 Cost Function  It used to evaluate the performance of CD algorithms n v : number of BV/BV overlap tests c v : cost for a BV/BV overlap test n p : number of primitive pairs tested for overlap c p : cost for testing whether two primitives overlap n u : number of BVs updated due to the model’s motion c u : cost for updating a BV

14 14 OBB Tree  OBB Tree: A Hierarchical Structure for Rapid Interference Detection  At SIGGRAPH 96, Gottschalk et al.  Oriented bounding box  AABB and sphere provide quite poor fits in general ( contain a lot of empty space)  Authors developed a new method for determining whether two OBBs overlap

15 15 Hierarchy Building  A basic data structure is a binary tree  Internal node holding an OBB  External node (leaf) hoding only one triangle  Top-down approach  A tight-fitting OBB  Can be found by computing an orientation of the triangles of the convex hull  Quickhull algorithm

16 16 OBB  Denotation  N triangles defined as Δp k q k r k, where p k, q k, and r k are the vertices of triangle k, 0 <= k < n  The area of triangle k as a k  Total area of the convex hull  Centroid of triangles i is m i =(p i +q i +r i )/3  The centroid of the whole convex hull

17 17 OBB (cont.)  With the use of definitions, we will present a formula that computes a 3X3 covariance matrix  After computing C  The eigenvectors are computed and normalized (direction vectors of OBB)  Find the center and the half-lengths of the OBB  Determine the size and position of the box

18 18 Split  After we have computed an OBB  The volume and the triangles should be split  Gottschalk et al. use a strategy  Takes the longest axis of the box  Splits it into two parts of the same length

19 19 Handling Rigid-Body Motions  In the OBBTree hierarchy  Each OBB is stored together with a rigid-body transformation( a rotation matrix R and a translation vector t) matrix M A  This matrix holds the relative orientation and position of the OBB with respect to its parent  Assume that we start to test two OBBs, A and B  The Idea is then to transform B into A’s coordinate system  T AB is decomposed as below  A and B overlap, A’s child called C  Transform B into A’s coordinate and then transform that into the coordinate system of C

20 20 K-DOPTree  K-DOP  BV/BV overlap test is faster than the OBB  Directions of the planes of the k-DOP are fixed  A tighter fit  As k grows, the k-DOP tends to resemble the convex hull  Tested in order to find a good compromise between the BV tightness and BV/BV overlap cost  6-DOPs(AABBs), 14-DOPs, 18-DOPs, 26-DOPs  K=18 gave the best execution times for several different scenarios

21 21 Hierarchy Building  K-DOPTree  Also uses a binary tree  The leaves may contain an arbitrary number of triangles  Top-down approach  To splitting the k-DOP into two subvolumes  Four methods have been investigated for selection of one of the main axes, x,y,z –Min Sum : selects the axis that minimizes the sum of the subvolumes –Min Max : selects the axis that minimizes the larger of the two subvolumes –Splatter : computes the variances of the projections of the centroids of the triangles (largest variance) –Longest Side : selects the axis along which the BV is longest

22 22 Updating the k-DOPTree  Orientations of the planes of the k-DOPs are fixed  A rigid-body motion of an object makes the hierarchy invalid  It must be rebuilt or updated  Klosowski et al. proposed two ways of updating  Approximation method  Avoid recomputing a new k-DOP  Vertex locations at the corners of the original k-DOP are transformed and used  Hill climbing  Require additional storage  At each frame, local updates are made to a new best-fit k-DOP for the geometry

23 23 A Multiple Objects  A Multiple Objects CD System  Require collision detection between possibly hundreds of pairs of objects  Describe a two-level collision detection system  The first level of this system reports potential collisions among all the objects in environment  Second level performs exact collision detection (previous section)

24 24 The First-Level CD  A simple approach  Use an AABB  Instead of cubes, spheres can be used  Sweep-and-Prune  Exploit the temporal coherence  If two AABBs overlap  Three one-dimensional intervals in each main axis direction must also overlap

25 25 Summary  The outline of the collision detection system  First, using the sweep-and-prune algorithm  Second, the object pairs are sent to exact CD algorithms  Finally, the results are forwarded and taken care of by the application (Collision response can be taken) Simulation Pruning Multi- Body Pair Exact Collision Detection (OBBTree&k- DOPTree) Collision Response Object transformation Overlapping pairs Colliding pair


Download ppt "Chapter 11 Collision Detection 가상현실 입문 2002.6.5 그래픽스 연구실 민성환."

Similar presentations


Ads by Google