Collision Detection and Response. Motivation OpenGL is a rendering system OpenGL is a rendering system OpenGL has no underlying knowledge of the objects.

Slides:



Advertisements
Similar presentations
Christian Lauterbach COMP 770, 2/16/2009. Overview  Acceleration structures  Spatial hierarchies  Object hierarchies  Interactive Ray Tracing techniques.
Advertisements

CS 352: Computer Graphics Chapter 7: The Rendering Pipeline.
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.
Here is where my object is Here is where my object is going to be Here is where I want my object to be.
CAP4730: Computational Structures in Computer Graphics Visible Surface Determination.
Computer Graphics Visible Surface Determination. Goal of Visible Surface Determination To draw only the surfaces (triangles) that are visible, given a.
Computational Geometry & Collision detection
Week 14 - Monday.  What did we talk about last time?  Bounding volume/bounding volume intersections.
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.
Chapter 6: Vertices to Fragments Part 2 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley Mohan Sridharan Based on Slides.
Vertices and Fragments I CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
Collision Detection CSE 191A: Seminar on Video Game Programming Lecture 3: Collision Detection UCSD, Spring, 2003 Instructor: Steve Rotenberg.
Tomas Mőller © 2000 Speeding up your game The scene graph Culling techniques Level-of-detail rendering (LODs) Collision detection Resources and pointers.
1 CSCE 441: Computer Graphics Hidden Surface Removal (Cont.) Jinxiang Chai.
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.
Collision Detection Michael Fuller. Overlap testing Most Common Technique Most Error Prone Test if two bodies overlap.
Collision Detection David Johnson Cs6360 – Virtual Reality.
Computer graphics & visualization Collision Detection – Narrow Phase.
1 Perception, Illusion and VR HNRS 299, Spring 2008 Lecture 19 Other Graphics Considerations Review.
Computational Geometry Convex Hulls Robust Geometric Primitives Degeneracy and Stability Nick Pilkington.
1 Perception and VR MONT 104S, Spring 2008 Lecture 22 Other Graphics Considerations Review.
Spatial Data Structures Jason Goffeney, 4/26/2006 from Real Time Rendering.
1 Speeding Up Ray Tracing Images from Virtual Light Field Project ©Slides Anthony Steed 1999 & Mel Slater 2004.
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,
Quaternions Paul Taylor Swizzle What is a swizzle?
Collision/Acceleration University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2013 Tamara Munzner.
PRESENTED BY – GAURANGI TILAK SHASHANK AGARWAL Collision Detection.
CIS 350 – I Game Programming Instructor: Rolf Lakaemper.
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.
Implementation II.
Histograms Lecture 14 Sec Tue, Sep 26, 2006.
Collision Detection And Response Jae Chun KyungSoo Im Chau Vo Hoang Vu.
Computer Game Design and Development
Interactive Graphics Lecture 10: Slide 1 Interactive Computer Graphics Lecture 10 Introduction to Surface Construction.
Presented by Paul Phipps
Computer Graphics I, Fall 2010 Implementation II.
Visible surface determination. Problem outline Given a set of 3D objects and a viewing specification, we wish to determine which lines or surfaces are.
David Luebke 3/5/2016 Advanced Computer Graphics Lecture 4: Faster Ray Tracing David Luebke
David Luebke3/12/2016 Advanced Computer Graphics Lecture 3: More Ray Tracing David Luebke
Lesson Plan: Drafting and Design J6-2. What is 3D solid modeling? How do 3D solid modeling programs work?
Computer Graphics Implementation II
Bounding Volume Hierarchies and Spatial Partitioning
Collision Detection Box-to-Box.
Core-Sets and Geometric Optimization problems.
Bounding Volume Hierarchies and Spatial Partitioning
Deformable Collision Detection
Parts of these slides are based on
Common Furniture Arrangement
Chapter 4.2 Collision Detection and Resolution
CMSC 635 Ray Tracing.
Implementation II Ed Angel Professor Emeritus of Computer Science
What you will learn today
Computer Animation Algorithms and Techniques
Introduction to Computer Graphics with WebGL
Collision Detection.
Deformable Collision Detection
Implementation II Ed Angel Professor Emeritus of Computer Science
Presentation transcript:

Collision Detection and Response

Motivation OpenGL is a rendering system OpenGL is a rendering system OpenGL has no underlying knowledge of the objects it draws OpenGL has no underlying knowledge of the objects it draws Collision Detection == Intersection Detection Collision Detection == Intersection Detection

Motivation Collision Detection Collision Detection Identifying the intersection of 3D models Identifying the intersection of 3D models Collision Response Collision Response Calculating the appropriate post collision response of the 3D models Calculating the appropriate post collision response of the 3D models Assumptions Assumptions Closed 3D polygonal objects Closed 3D polygonal objects

Overall Approach Where is collision detection and response in code? Where is collision detection and response in code? In animation function In animation function Usually in Idle or Display Usually in Idle or Display Update object positions Update object positions If (CollisionDetection()) If (CollisionDetection()) Collision Response() Collision Response() Draw Objects Draw Objects

Collision Detection Basic Collision Detection function Basic Collision Detection function for (i=0;i<num_of_objects-1;i++) for (i=0;i<num_of_objects-1;i++) for (j=i+1;j<num_of_objects;j++) for (j=i+1;j<num_of_objects;j++) X=TestIntersection(Object I, Object j) X=TestIntersection(Object I, Object j) If (x==1) return 1; If (x==1) return 1;

Collision Detection Packages SWIFT++ SWIFT Works on ‘polygon soup’ Works on ‘polygon soup’

Why is collision detection difficult? Too many calculations Too many calculations Reduce # of calculations Reduce # of calculations Accuracy Accuracy Accept approximations Accept approximations Lots of poor cases Lots of poor cases Guarantee detection? Guarantee detection? Accuracy requirements? Accuracy requirements? ex.shtml ex.shtml

Reduce Calculations Reduce object complexity Reduce object complexity Test with only other objects that might be within collision spaces Test with only other objects that might be within collision spaces Spatial divisions Spatial divisions Pre-process vs. runtime Pre-process vs. runtime

Approximate Object Shape For many applications, it is not necessary to get absolute collision detection accuracy For many applications, it is not necessary to get absolute collision detection accuracy How can we approximate the shape? How can we approximate the shape?

Bounding Boxes Calculate a 3D box that bounds the object Calculate a 3D box that bounds the object In the collision detection test, use the 3D box to test for collision in place of the full model In the collision detection test, use the 3D box to test for collision in place of the full model Two types Two types Axis Aligned Axis Aligned Bounding boxes are aligned w/ the world coordinate axes Bounding boxes are aligned w/ the world coordinate axes Object Aligned Object Aligned Bounding boxes are aligned w/ the object coordinate axes Bounding boxes are aligned w/ the object coordinate axes

Axis Aligned Bounding Boxes How do we calculate a AABB? How do we calculate a AABB? Take max and min for each dimension Take max and min for each dimension Pros Pros Very fast Very fast Works for many situations Works for many situations Cons Cons Collision detection accuracy reduced for many cases Collision detection accuracy reduced for many cases

Axis Aligned Bounding Boxes How do we calculate intersections? How do we calculate intersections? Calculate overlap for the min-max range for each dimension Calculate overlap for the min-max range for each dimension Pros Pros Very fast Very fast Works for many situations Works for many situations Cons Cons Collision detection accuracy reduced for many cases Collision detection accuracy reduced for many cases

Object-Aligned Bounding Boxes Calculate BB based on object’s primary dimensions Calculate BB based on object’s primary dimensions Object’s dimensions could be encoded in model or calculated real-time Object’s dimensions could be encoded in model or calculated real-time Apply M matrix to bounding box coordinates Apply M matrix to bounding box coordinates

Other bounding shapes Boxes Boxes Cubes Cubes Cylinders Cylinders Polygons Polygons User-defined shapes User-defined shapes Should be easy to calculate and test Should be easy to calculate and test

Bounding Box Approach Test collisions with BB Test collisions with BB Can either report collision Can either report collision Or then calculate more accurate collision Or then calculate more accurate collision Benefits of this include more accurate response Benefits of this include more accurate response

Poor cases Thin objects Thin objects

Poor cases Numerical Precision Numerical Precision

Collision Response Assuming rigid bodies Assuming rigid bodies Idea is to “rewind time” and to point of collision and calculate resulting location Idea is to “rewind time” and to point of collision and calculate resulting location

Why is collision response difficult? Resolving interpenetration is difficult Resolving interpenetration is difficult Multiple objects Multiple objects

Numerical Imprecision Vibrations Vibrations Solutions? Minimum delta Solutions? Minimum delta