Presentation is loading. Please wait.

Presentation is loading. Please wait.

Week 14 - Monday.  What did we talk about last time?  Bounding volume/bounding volume intersections.

Similar presentations


Presentation on theme: "Week 14 - Monday.  What did we talk about last time?  Bounding volume/bounding volume intersections."— Presentation transcript:

1 Week 14 - Monday

2  What did we talk about last time?  Bounding volume/bounding volume intersections

3

4

5

6

7

8  There are three important pieces to collision handling:  Collision detection ▪ Did these objects collide?  Collision determination ▪ When and where did these objects collide exactly?  Collision response ▪ What happens as a result of the collision?

9  Achieve interactive rates with complex models when those models are near and far from each other  Handle polygon soups (no guarantees about convexity or adjacency)  Assume that models can undergo rigid body transformations  Use efficient bounding volumes

10  Rather than try to test complex models for collision with an environment, we can use representative rays instead  Perhaps one ray for each wheel of a car  A positive ray distance means space between the objects  A negative ray distance means collision  A zero ray distance means the objects are merely touching  It's essentially a ray tracing problem

11  Binary space partitioning trees (BSP trees) are a common way of dividing space hierarchically  For axis-aligned BSPs, one axis is chosen and a perpendicular plane is generated to divide the box  This process is repeatedly recursively until some criteria (like 3 or fewer objects per division) is reached  BSPs can also be split by choosing polygons to divide the world (usually done so as to make a perfectly balanced tree)  BSPs are good for static scenes (moving objects can cause huge portions of the tree to be recreated)

12  We look at a movement of a time step going from point p 0 to p 1  We then just need to see if the line connecting those points intersects any objects (easy to do in a BSP)  We have to temporarily alter each plane's location based on the size of the bounding volume (e.g. move the plane closer by a value of r to test against a sphere with radius r)  Note: characters in games are often represented with cylinders

13  We can build hierarchies using one of the three following approaches:  Bottom-up: Find nearby BVs and combine them, doing so recursively  Incremental tree-insertion: Start with an empty tree and add BVs according to what is going to add the least total volume to the tree  Top-down (most common): Find a BV for the entire model, then divide the BV into k or fewer parts, recursively ▪ Finding a good split point is key

14  Hierarchies are generally made for static scenes  Then we test against them for collisions with dynamic objects  What about when there are multiple moving objects that might interact with each other?  We work in two phases  Broad phase collision detection  Exact collision detection among candidates

15  Assume everything has an AABB or a bounding sphere  Assume temporal coherence (stuff doesn't move that much over a small amount of time)  On one dimension, we can sort the endpoints of the AABBs  We can quickly throw out objects that cannot possibly intersect  Bubble sort or insertion sort to the rescue!  We could sort everything in O(n log n) every time  Because of temporal coherence, not many end points change order and adaptive sorts work in around O(n)

16  Another possibility is keeping large grid cells that keep track of which objects or BVs are inside them  Objects that do not share grid cells do not need to be checked for collision  Finding the right grid cell size can be difficult  Spatial hashing can be used as well (mapping to a hash table based on location)

17  Here is an outline of a frame in a typical two- phase CD system

18  For games and other time critical problems, it may be necessary to restrict the amount of time available for CD to a fixed value (or whatever is left of the allotted time after rendering)  When we don't know if we are going to have time to visit the entire tree hierarchy, we may want to visit the tree breadth-first

19  Collision response means whatever action is done to prevent abnormal object interpenetration  Usually a bounce or something like that  It is important to find the exact time of the collision (might be in the middle of a frame) to get the correct bounce  Let velocity v = v n + v p where v n is the velocity parallel to the normal of the surface  For a perfectly elastic bounce, the new velocity is  v' = v p – v n  In real collisions, some energy is lost, described by the coefficient of restitution k, making  v' = v p – kv n

20  Dealing with spheres is the simplest because their point of intersection is easy to calculate  First, compute collision vector (line between sphere centers)  Divide sphere velocities into two parts:  Perpendicular to collision  Parallel to collision  Only the perpendicular velocity changes

21

22

23  Non-photorealistic rendering

24  Finish Assignment 5  Due on Friday  Keep working on Project 4  Due next Friday  Read Chapter 11


Download ppt "Week 14 - Monday.  What did we talk about last time?  Bounding volume/bounding volume intersections."

Similar presentations


Ads by Google