Introduction To Collision Detection Parts of these slides

  • Slides: 35
Download presentation
Introduction To Collision Detection Parts of these slides are based on www 2. informatik.

Introduction To Collision Detection Parts of these slides are based on www 2. informatik. uni-wuerzburg. de/ mitarbeiter/holger/lehre/osss 02/schmidt/vortrag. pdf by Jakob Schmidt

What ? The problem: The search for intersecting planes of different 3 D models

What ? The problem: The search for intersecting planes of different 3 D models in a scene. Collision Detection is an important problem in fields like computer animation, virtual reality and game programming.

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

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

Intro This introduction will deal with the basic problem: IF two (stationary) objects intersect.

Intro This introduction will deal with the basic problem: IF two (stationary) objects intersect.

Intro The simple solution: Pairwise collision check of all polygons the objects are made

Intro The simple solution: Pairwise collision check of all polygons the objects are made of.

Intro Problem: • complexity O(n²) • not acceptable for reasonable number n of polygons

Intro Problem: • complexity O(n²) • not acceptable for reasonable number n of polygons • not applicable for realtime application

Bounding Volumes Solution: Bounding Volumes Reduce complexity of collision computation by substitution of the

Bounding Volumes Solution: 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

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.

Bounding Volumes How to choose BVs ? • Object approximation behavior (‘Fill efficiency’) •

Bounding Volumes How to choose BVs ? • Object approximation behavior (‘Fill efficiency’) • Computational simplicity • Behavior on (non linear !) transformation (incl. deformation) • Memory efficiency

Bounding Volumes Different BVs used in game programming: • Axes Aligned Bounding Boxes (AABB)

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

Bounding Volumes Axes Aligned Bounding Box (AABB) • Align axes to the coordinate system

Bounding Volumes Axes Aligned Bounding Box (AABB) • Align axes to the coordinate system • Simple to create • Computationally efficient • Unsatisfying fill efficiency • Not invariant to basic transformations, e. g. rotation

Bounding Volumes Oriented Bounding Box (OBB) Align box to object such that it fits

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

Bounding Volumes The overlap test is based on the Separating Axes Theorem (S. Gottschalk.

Bounding Volumes The overlap test is based on the Separating Axes Theorem (S. Gottschalk. Separating axis theorem. Technical Report TR 96 -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 Separating Axes Theorem Axes

Bounding Volumes Separating Axes Theorem Axes

Bounding Volumes Check for overlap on every single Axis (project polygon to axis). Two

Bounding Volumes Check for overlap on every single Axis (project polygon to axis). Two polygons intersect, if their projections overlap on EVERY axis.

Bounding Volumes Overlap check on single axis: Sort and Sweep (Example for xy-axis aligned

Bounding Volumes Overlap check on single axis: Sort and Sweep (Example for xy-axis aligned boxes) sort 1 2 3 On the y-axis, all boxes overlap

Bounding Volumes Overlap check on single axis: Sort and Sweep 1 2 3 sort

Bounding Volumes Overlap check on single axis: Sort and Sweep 1 2 3 sort On the x-axis, boxes 2 -3 and 3 -1 overlap

Bounding Volumes Combine overlap check of single axes: x 1 2 3 y 1

Bounding Volumes Combine overlap check of single axes: x 1 2 3 y 1 2 3 = 1 2 3

Bounding Volumes Sphere • Relatively complex to compute • Bad fill efficiency • Simple

Bounding Volumes Sphere • Relatively complex to compute • Bad fill efficiency • Simple overlap test • invariant to rotation

Bounding Volumes K-DOP • Easy to compute • Good fill efficiency • Simple overlap

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

Bounding Volumes k-DOP is considered to be a trade off between AABBs and OBBs.

Bounding Volumes k-DOP is considered to be a trade off between AABBs and OBBs. Its collision check is a general version of the AABB collision check, having k directions

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

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

Bounding Volumes How to Compute and Store k-DOPs: k-directions Bi define planes (Bi is

Bounding Volumes How to Compute and Store k-DOPs: k-directions Bi define planes (Bi is the normal to plane i) , the intersection of these planes defines the k-DOP bounding volume. Plane Pi = {x | Bi x – di <= 0} (-> Hesse Normal Form)

Bounding Volumes 3 D Example: UNREAL-Engine

Bounding Volumes 3 D Example: UNREAL-Engine

Bounding Volumes 2 D Example for planes defining a k. DOP Normal vector Bi

Bounding Volumes 2 D Example for planes defining a k. DOP Normal vector Bi

Bounding Volumes Collision on different scales: Hierarchies

Bounding Volumes Collision on different scales: Hierarchies

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

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

Hierarchies

Hierarchies

Hierarchies Use the hierarchy from coarse to fine resolution to exclude non intersecting objects

Hierarchies Use the hierarchy from coarse to fine resolution to exclude non intersecting objects

Hierarchies The hierarchy is stored in a tree, named by the underlying BV scheme:

Hierarchies The hierarchy is stored in a tree, named by the underlying BV scheme: AABB – tree OBB – tree Sphere – tree k. DOP – tree

Hierarchies Sphere Trees are used for example in “Gran Tourismo”

Hierarchies Sphere Trees are used for example in “Gran Tourismo”

Hierarchies Simple example: • Binary tree • Each node contains all primitives of its

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

Hierarchies

Hierarchies

Hierarchies

Hierarchies

Hierarchies Comparison AABB / OBB

Hierarchies Comparison AABB / OBB