22
1 KIPA Game Engine Seminars Jonathan Blow Ajou University December 6, 2002 Day 10

KIPA Game Engine Seminars

  • Upload
    dewei

  • View
    55

  • Download
    0

Embed Size (px)

DESCRIPTION

KIPA Game Engine Seminars. Day 10. Jonathan Blow Ajou University December 6, 2002. Collision Detection Methods. Early today I’ll overview some of the simpler methods and talk about real-world issues about integrating them in games bounding spheres, boxes, bsp - PowerPoint PPT Presentation

Citation preview

1

KIPA Game Engine Seminars

Jonathan BlowAjou University

December 6, 2002

Day 10

2

Collision Detection Methods

• Early today I’ll overview some of the simpler methods and talk about real-world issues about integrating them in games– bounding spheres, boxes, bsp– find time of collision, prevent tunneling

• Later we’ll go to some of the more advanced collision detection schemes– GJK algorithm– Lin/Canny Closest Features

3

Bounding Spheres

• Simplest, fastest bounding volume• Least information to store• Isotropic

– Means it may be a poor fit• Better fit: perhaps use the centroid, not the

origin (or find the two furthest points)– But this takes more information per sphere

4

Bounding Boxes:Axis Aligned

• Don’t take much information to store• May be a poor fit for “diagonal” data• Easy to test them against each other for

intersection• Abbreviated “AABB”

– (“Axis-Aligned Bounding Box”)

5

Bounding Boxes:Oriented

• Better fit than AABB– But a little more complicated to compute

• More complicated intersection detection– See Gottschalk’s 1998 paper

• I will include this in the course notes

• Unclear in the end whether it’s better than AABB or spheres– Probably depends on the nature of your data

• Abbreviated “OBB”– (“Oriented Bounding Box”)

• Software toolkit “RAPID”

6

Bounding Volume Hierarchies

• Method of saving computation time– It costs memory, though

• Form volumes around pieces of a mesh so that you can “early-reject”

7

BSP Tree

• Can be viewed as a hierarchical bounding volume system

• The split planes are spheres with infinite radius

• So an individual sphere has poor spatial locality, but the hierarchy makes up for that

8

BSP Tree

• What might a BSP tree be like that didn’t use planes as its splitting surface?– Spheres of finite radius?– Other curved surfaces?

9

Animated Meshes

• How are we to adapt hierarchical bounding volumes to animated meshes?– Fully recompute every time– Try to do an incremental update, but quality

will decay• Always slow!

10

Animated Mesh Example

• In Barbaric Smackdown I made a set of spheres that track the skeleton (not the mesh)

• The spheres animate with the mesh, and we collide against the spheres

• This is faster than colliding against the mesh

• Also faster than building spheres from the mesh vertices each frame

11

Intersection Primitives

• Box/box, sphere/sphere, etc• What kind of information do they return?• What kind of information do we get from a

triangle vs. triangle intersection routine?

12

Finding the time of intersection

• Necessary for good physics?• How do you do it given a triangle/triangle

intersection style primitive?– Move through time in very small samples and

interpolate?– Binary search through time

13

Preventing “tunneling”

• When long frame times happen, objects might pass through each other

• What do we do here?– Raycasting solution– Analytic method?

14

Closed-form intersection testfor spheres

• Without acceleration• With acceleration (constant over time

period)

15

Separating Axis Theorem

• Convex objects and separating planes• But we want non-convex objects!

– Model them as unions of convex objects and do separate collision tests

• Still very difficult (Maya is not a solid modeling program)– BSP the thing?

• This can be harder than you would think• Also it produces a lot of pieces

– Try to re-join the pieces?

16

Algorithms that help usestimate collision times

• Maybe tell us how much two entities are colliding, so that we can better guide our search for the collision time

• Example of two spheres, or sphere vs plane

17

GJK Collision DetectionAlgorithm

• “Gilbert-Johnson-Keerthi”• Operates on convex solids

– Again, that’s a problem!• Uses Minkowski sums

18

Minkowski Sum / Minkowski Difference

• (examples on whiteboard)

19

Lin-Canny Closest Feature Tracking

• Tells you the closest “features” between two objects– A feature can be a point, line segment, or face

• Relies on frame coherence• (example on whiteboard)

20

Hierarchical Bounding VolumeQuantization/Packing

• Sphere tree, bounding box tree– Exploit multiscale nature of hierarchy

• BSP Tree– Exploit recurrence of plane equations

21

AI, A* search,and “speculative collision

detection”

• (discussion)

22

Higher-Level Scene Management

• Indoor shooter level– BSP– Portals

• Terrain• Flight / Space Sim / Heavily occupied

environment