CIS 350 – I Game Programming Instructor: Rolf Lakaemper.

Slides:



Advertisements
Similar presentations
2.5. B ASIC P RIMITIVE I NTERSECTION Details of common forms of primitive intersection test.
Advertisements

Christian Lauterbach COMP 770, 2/16/2009. Overview  Acceleration structures  Spatial hierarchies  Object hierarchies  Interactive Ray Tracing techniques.
Intersection Testing Chapter 13 Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology.
CSE 681 Bounding Volumes. CSE 681 Bounding Volumes Use simple volume enclose object(s) tradeoff for rays where there is extra intersection test for object.
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.
Here is where my object is Here is where my object is going to be Here is where I want my object to be.
I. The Problem of Molding Does a given object have a mold from which it can be removed? object not removable mold 1 object removable Assumptions The object.
Computational Geometry & Collision detection
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.
Tomas Mőller © 2000 Speeding up your game The scene graph Culling techniques Level-of-detail rendering (LODs) Collision detection Resources and pointers.
1 Geometry A line in 3D space is represented by  S is a point on the line, and V is the direction along which the line runs  Any point P on the line.
OBBTree: A Hierarchical Structure for Rapid Interference Detection Gottschalk, M. C. Lin and D. ManochaM. C. LinD. Manocha Department of Computer Science,
Bounding Volume Hierarchies and Spatial Partitioning Kenneth E. Hoff III COMP-236 lecture Spring 2000.
Apex Point Map for Constant-Time Bounding Plane Approximation Samuli Laine Tero Karras NVIDIA.
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.
Efficient Distance Computation between Non-Convex Objects By Sean Quinlan Presented by Sean Augenstein and Nicolas Lee.
Collision Detection David Johnson Cs6360 – Virtual Reality.
Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)
Week 13 - Wednesday CS361.
12/4/2001CS 638, Fall 2001 Today Using separating planes/axes for collision testing Collision detection packages.
CIS 350 – I Game Programming Instructor: Rolf Lakaemper.
CS 450: Computer Graphics REVIEW: OVERVIEW OF POLYGONS
Spatial Data Structures Jason Goffeney, 4/26/2006 from Real Time Rendering.
CSE 381 – Advanced Game Programming Quickhull and GJK.
Collision handling: detection and response
Week 13 - Friday.  What did we talk about last time?  Ray/sphere intersection  Ray/box intersection  Slabs method  Line segment/box overlap test.
Week 13 - Monday.  What did we talk about last time?  Exam 2!  Before that…  Polygonal techniques ▪ Tessellation and triangulation  Triangle strips,
Quaternions Paul Taylor Swizzle What is a swizzle?
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.
1Computer Graphics Implementation II Lecture 16 John Shearer Culture Lab – space 2
Implementation II Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
Advanced Computer Graphics Spring 2014 K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology.
Chapter 11 Collision Detection 가상현실 입문 그래픽스 연구실 민성환.
Computational Geometry: Intersection Search Joseph S. B. Mitchell Stony Brook University.
Advanced Computer Graphics Spring 2014 K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology.
Advanced Computer Graphics Spring 2009
Presented by Paul Phipps
Computer Graphics I, Fall 2010 Implementation II.
David Luebke 3/5/2016 Advanced Computer Graphics Lecture 4: Faster Ray Tracing David Luebke
Bounding Volume Hierarchies and Spatial Partitioning
Computational Geometry
Collision Detection Spring 2004.
Bounding Volume Hierarchies and Spatial Partitioning
Modeliranje kompleksnih modelov
Parts of these slides are based on
Chapter 4.2 Collision Detection and Resolution
Collision handling: detection and response
Implementation II Ed Angel Professor Emeritus of Computer Science
2.5. Basic Primitive Intersection
I. The Problem of Molding
Computer Animation Algorithms and Techniques
Collision Detection.
David Johnson Cs6360 – Virtual Reality
Modeliranje kompleksnih modelov
Implementation II Ed Angel Professor Emeritus of Computer Science
GPAT – Chapter 7 Physics.
Presentation transcript:

CIS 350 – I Game Programming Instructor: Rolf Lakaemper

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

What ? The problem: The search for intersecting planes of different 3D 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 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 of.

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

Bounding Volumes 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.

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) Oriented Bounding Boxes (OBB) Spheres k-Discrete Oriented Polytopes (k DOP) AABB OBB Sphere k-DOP

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 Axes Aligned Bounding Box (AABB) Collision test: project BBs onto coordinate axes. If they overlap on each axis, the objects collide.

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. 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).

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 test Not invariant to rotation

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/2 directions

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

How to Compute and Store k-DOPs: k-directions k-directions B i define halfplanes (they are the normals to the halfplanes), the intersection of these halfplanes defines the k-DOP bounding volume. Halfplane H i = {x | B i x – d i <= 0} Bounding Volumes

3D Example: UNREAL-Engine

Bounding Volumes 2D Example for halfplanes defining a k-DOP Normal vector B i

Bounding Volumes Again: halfplane H i = {x | B i x – d i <= 0} If the directions B i are predefined, only the distances d i must be stored to specify the halfplane H i. This is one scalar value per direction. If the directions are NOT predefined, B i and d i must be stored (3D case: 4 values)

Bounding Volumes How to compute d i : Hessian Normal Form ( Bx – d = 0 with d = Bp) with unit vector of a plane automatically gives distance d if a single point p on the plane is known.

Bounding Volumes Compute distances of all vertices to plane Bx = 0, i.e. multiply (dot product) each vertex with the unit normal vector B Bx = 0 Unit vector B

Bounding Volumes d i is the minimum distance of the object to the plane Bx = 0 Bx = 0 didi

Bounding Volumes Collision Given: k non kollinear directions B i and V = set of vertices of object. Compute d i = min{B i v| v in V } and D i = max{B i v| v in V}. d i and D i define an interval on the axis given by B i. This is the interval needed for the collision detection !

Bounding Volumes Collision B1 Plane defined by B1Interval [d1, D1] defined by B1 d1 D1

Bounding Volumes Part 2: Collision on different scales: Hierarchies

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

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: AABB – tree OBB – tree Sphere – tree kDOP – tree

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

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

Hierarchies

Recursive Collision Detection ) Returns TRUE if BBs overlap. How could this be improved to give a precise overlap test ?

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

Hierarchies Bottom up: Start with BV for each primitive Merge

Hierarchies Example for top down using OBBs :

Hierarchies Comparison AABB / OBB

Multiple Objects Part 3: Collision between Multiple Objects

Virtual environment usually consists of more than 2 objects. Pairwise detailed collision between all objects is too slow. Solution again: 1. Exclude non colliding objects 2. Check collision between remaining objects

Multiple Objects Methods to exclude non colliding objects: 1.Grid Method Or 2. Sort and Sweep (AABB)

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

Multiple Objects 2D example

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)

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

Multiple Objects S3 S1 E3 S2 E1 E s3 e3 e1 s1 s2 e2 e1s2e3s1s3 S1 S2 E1 S3 E2 E3 XY OVERLAP 1,2

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.