Collision Detection.

Slides:



Advertisements
Similar presentations
Introduction to Algorithms
Advertisements

Christian Lauterbach COMP 770, 2/16/2009. Overview  Acceleration structures  Spatial hierarchies  Object hierarchies  Interactive Ray Tracing techniques.
Computational Geometry
Intersection Testing Chapter 13 Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology.
2.3. B OUNDING V OLUMES Bounding volumes of use for collision detection.
Chapter 4.2 Collision Detection and Resolution. 2 Collision Detection Complicated for two reasons 1. Geometry is typically very complex, potentially requiring.
Collision Detection CSCE /60 What is Collision Detection?  Given two geometric objects, determine if they overlap.  Typically, at least one of.
Collision Detection and Resolution Zhi Yuan Course: Introduction to Game Development 11/28/
Computer graphics & visualization Collisions. computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization.
Geometry Primer Lines and rays Planes Spheres Frustums Triangles Polygon Polyhedron.
Ray Tracing CMSC 635. Basic idea How many intersections?  Pixels  ~10 3 to ~10 7  Rays per Pixel  1 to ~10  Primitives  ~10 to ~10 7  Every ray.
Week 14 - Monday.  What did we talk about last time?  Bounding volume/bounding volume intersections.
CS447/ Realistic Rendering -- Solids Modeling -- Introduction to 2D and 3D Computer Graphics.
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics1 Basic 3D collision detection We want to know if objects have touched Objects are considered to.
Collision Detection CSE 191A: Seminar on Video Game Programming Lecture 3: Collision Detection UCSD, Spring, 2003 Instructor: Steve Rotenberg.
Chapter 4.2 Collision Detection and Resolution. 2 Collision Detection Complicated for two reasons 1. Geometry is typically very complex, potentially requiring.
Bounding Volume Hierarchy “Efficient Distance Computation Between Non-Convex Objects” Sean Quinlan Stanford, 1994 Presented by Mathieu Brédif.
UNC Chapel Hill M. C. Lin References Collision Detection between Geometric Models: A Survey, by M. Lin and S. Gottschalk, Proc. of IMA Conference on Mathematics.
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Continuous Collision Detection David Knott COMP 259 class presentation.
OBBTree: A Hierarchical Structure for Rapid Interference Detection Gottschalk, M. C. Lin and D. ManochaM. C. LinD. Manocha Department of Computer Science,
1 Advanced Scene Management System. 2 A tree-based or graph-based representation is good for 3D data management A tree-based or graph-based representation.
Collision Detection Michael Fuller. Overlap testing Most Common Technique Most Error Prone Test if two bodies overlap.
Efficient Distance Computation between Non-Convex Objects By Sean Quinlan Presented by Sean Augenstein and Nicolas Lee.
Collision Detection David Johnson Cs6360 – Virtual Reality.
Computer graphics & visualization Collision Detection – Narrow Phase.
Week 13 - Wednesday CS361.
12/4/2001CS 638, Fall 2001 Today Using separating planes/axes for collision testing Collision detection packages.
INTERACTION TECHNIQUES Collision Detection and Other Interactions Collision Detection and Other Interactions.
Spatial Data Structures Jason Goffeney, 4/26/2006 from Real Time Rendering.
CSE 381 – Advanced Game Programming Quickhull and GJK.
Week 13 - Friday.  What did we talk about last time?  Ray/sphere intersection  Ray/box intersection  Slabs method  Line segment/box overlap test.
Computer Animation Rick Parent Computer Animation Algorithms and Techniques Collisions & Contact.
Week 13 - Monday.  What did we talk about last time?  Exam 2!  Before that…  Polygonal techniques ▪ Tessellation and triangulation  Triangle strips,
Collision/Acceleration University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2013 Tamara Munzner.
12/4/2001CS 638, Fall 2001 Today Managing large numbers of objects Some special cases.
PRESENTED BY – GAURANGI TILAK SHASHANK AGARWAL Collision Detection.
Collaborative Visual Computing Lab Department of Computer Science University of Cape Town Graphics Topics in VR By Shaun Nirenstein.
1 KIPA Game Engine Seminars Jonathan Blow Ajou University December 6, 2002 Day 10.
CIS 350 – I Game Programming Instructor: Rolf Lakaemper.
Collision Detection Kaboo m!. The Plan ● What is collision detection? ● Why is collision detection important? ● Classification of collision detection.
Chapter 11 Collision Detection 가상현실 입문 그래픽스 연구실 민성환.
Computational Geometry: Intersection Search Joseph S. B. Mitchell Stony Brook University.
11/20/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Collision Detection Overview Player-Environment handling.
Presented by Paul Phipps
UNC Chapel Hill M. C. Lin Geometric Data Structures Reading: Chapter 10 of the Textbook Driving Applications –Windowing Queries Related Application –Query.
Week 13 - Wednesday CS361.
Bounding Volume Hierarchies and Spatial Partitioning
Computational Geometry
CS679 - Fall Copyright Univ. of Wisconsin
Distance Computation “Efficient Distance Computation Between Non-Convex Objects” Sean Quinlan Stanford, 1994 Presentation by Julie Letchner.
Collision Detection Spring 2004.
Bounding Volume Hierarchies and Spatial Partitioning
CMPS 3130/6130 Computational Geometry Spring 2017
Deformable Collision Detection
Modeliranje kompleksnih modelov
Parts of these slides are based on
References Additional lecture notes for 2/18/02.
Orthogonal Range Searching and Kd-Trees
Chapter 4.2 Collision Detection and Resolution
Implementation II Ed Angel Professor Emeritus of Computer Science
I. The Problem of Molding
References Collision Detection between Geometric Models: A Survey, by M. Lin and S. Gottschalk, Proc. of IMA Conference on Mathematics of Surfaces 1998.
INTERACTION TECHNIQUES
Computer Animation Algorithms and Techniques
Deformable Collision Detection
BVH Student: Jack Chang.
David Johnson Cs6360 – Virtual Reality
Modeliranje kompleksnih modelov
Implementation II Ed Angel Professor Emeritus of Computer Science
GPAT – Chapter 7 Physics.
Presentation transcript:

Collision Detection

The problem can be defined as Intro The problem can be defined as if, where and when two objects intersect.

Collision Detection Collision detection, as used in the games community, usually means intersection detection of any form Intersection detection is the general problem: find out if two geometric entities intersect – typically a static problem Subtle point: Collision detection is about the algorithms for finding collisions in time as much as space

Classification of Collision Detection Type of objects convexity/concavity rigid/deformable polygons/curves 1-Dimensional/2D/3D/N-D static/dynamic Time of collision discrete/continuous exact/approximate Motion of objects linear/non-linear predictable/dynamic bounded/unbounded angular motion Other factors realtime/off-line number of objects allowable error margin frame vs. path

Choosing an Algorithm The geometry of the colliding objects is the primary factor in choosing a collision detection algorithm “Object” could be a point, or line segment Object could be specific shape: a sphere, a triangle, a cube, … Objects can be concave/convex, solid/hollow, deformable/rigid, manifold/non- manifold

Collision Detection in the Video Game Package For pair (j, k) of Sprites: if the boundingBox(j) does not intersect boundingBox(k), return no intersection let m be the intersection of j and k if m is empty, return no intersection otherwise, return intersection This algorithm uses a simple test for intersection when possible (intersection of bounding boxes), and a more exact test when the bounding box fails to determine intersection.

Collision Detection in the Video Game Package What this collision detection is not good at doing: determining path intersections (important for fast moving objects or low model frame rates) determining time/location of first intersection predicting intersections handling a large number of Sprites

Part 1: Bounding Volumes Reduce complexity of collision computation by substitution of the (complex) original object with a simpler object containing the original one.

Bounding Volumes The original objects can only intersect if the simpler ones do. Or better: if the simpler objects do NOT intersect, the original objects won’t either.

Different BVs used in game programming: Bounding Volumes Different BVs used in game programming: Axes Aligned Bounding Boxes (AABB) Oriented Bounding Boxes (OBB) Spheres k-Discrete Oriented Polytopes (k DOP) Sphere OBB k-DOP AABB

Oriented Bounding Box (OBB) Bounding Volumes Oriented Bounding Box (OBB) Align box to object such that it fits optimally in terms of fill efficiency Computationally expensive Invariant to rotation Complex intersection check

Separating Axes Theorem Bounding Volumes The overlap test is based on the Separating Axes Theorem (S. Gottschalk. Separating axis theorem. Technical Report TR96-024,Department of Computer Science, UNC Chapel Hill, 1996) Two convex polytopes are disjoint iff there exists a separating axis orthogonal to a face of either polytope or orthogonal to an edge from each polytope.

Bounding Volumes Each box has 3 unique face orientations, and 3 unique edge directions. This leads to 15 potential separating axes to test (3 faces from one box, 3 faces from the other box, and 9 pairwise combinations of edges).

Not invariant to rotation Bounding Volumes K-DOP Easy to compute Good fill efficiency Simple overlap test Not invariant to rotation

k-DOPs are used e.g. in the game Bounding Volumes k-DOPs are used e.g. in the game ‘Cell Damage’ (XBOX, Pseudo Interactive, 2002)

Part 2: Collision on different scales: Bounding Volumes Part 2: Collision on different scales: Hierarchies

Hierarchies Idea: To achieve higher exactness in collision detection, build a multiscale BV representation of the object

Hierarchies

Each node contains all primitives of its subtree Hierarchies Simple example: Binary tree Each node contains all primitives of its subtree Leaves contain single primitive

Hierarchies

Hierarchies

Hierarchies

How to create a hierarchy tree Hierarchies How to create a hierarchy tree Top down: Use single BV covering whole object Split BV Continue recursively until each BV contains a single primitive

Start with BV for each primitive Hierarchies Bottom up: Start with BV for each primitive Merge

Example for top down using OBBs : Hierarchies Example for top down using OBBs :

Hierarchies Comparison AABB / OBB

Part 3: Collision between Multiple Objects Part 3: Collision between Multiple Objects

Grid Method: Create 3d grid volume overlay Multiple Objects Grid Method: Create 3d grid volume overlay Only check collision between objects sharing at least one cell

Multiple Objects 2D example

Sort and Sweep Create single AABB for each object Multiple Objects Sort and Sweep Create single AABB for each object Project BVs onto coordinate axes Create a sorted list of start and endpoints for each coordinate axis, hence store the intervals created by each object (Cont’d)

If startpoint of object i is hit, insert i into ‘active list’ Multiple Objects Traverse each list If startpoint of object i is hit, insert i into ‘active list’ If endpoint of object i is hit, remove i from ‘active list’ If 2 objects i1,i2 are active at the same time they overlap in the dimension processed Objects overlapping in all single dimensions overlap in world

S3 S1 E3 S2 E1 E2 S1 S2 E1 S3 E2 E3 Multiple Objects X Y 3 1 2 OVERLAP 1,2 s1 s2 e1 s3 e2 e3

Note: sort and sweep for a single step is relatively expensive. Multiple Objects Note: sort and sweep for a single step is relatively expensive. Since not all objects are transformed for the next frame, the list is not created newly for each frame, but updated.