Week 13 - Friday.  What did we talk about last time?  Ray/sphere intersection  Ray/box intersection  Slabs method  Line segment/box overlap test.

Slides:



Advertisements
Similar presentations
Everything you ever wanted to know about collision detection
Advertisements

2.5. B ASIC P RIMITIVE I NTERSECTION Details of common forms of primitive intersection test.
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.
10/10/02 (c) 2002 University of Wisconsin, CS 559 Last Time Finished viewing: Now you know how to: –Define a region of space that you wish to view – the.
Here is where my object is Here is where my object is going to be Here is where I want my object to be.
Computational Geometry & Collision detection
Week 14 - Monday.  What did we talk about last time?  Bounding volume/bounding volume intersections.
Advanced Computer Graphics Spring 2014 K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology.
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.
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.
CS 376 Introduction to Computer Graphics 02 / 26 / 2007 Instructor: Michael Eckmann.
Apex Point Map for Constant-Time Bounding Plane Approximation Samuli Laine Tero Karras NVIDIA.
Fall 2006 revised1 Frustum Culling in OpenGL Ref: MarkMoley.com.
Collision Detection David Johnson Cs6360 – Virtual Reality.
Introduction to 3D Graphics John E. Laird. Basic Issues u Given a internal model of a 3D world, with textures and light sources how do you project it.
Computer graphics & visualization Collision Detection – Narrow Phase.
Cornell CS465 Fall 2004 Lecture 3© 2004 Steve Marschner 1 Ray Tracing CS 465 Lecture 3.
Week 13 - Wednesday CS361.
12/4/2001CS 638, Fall 2001 Today Using separating planes/axes for collision testing Collision detection packages.
Geometric Intuition Randy Gaul. Vectors, Points and Basis Matrices Rotation Matrices Dot product and how it’s useful Cross product and how it’s useful.
CS 325 Introduction to Computer Graphics 03 / 03 / 2010 Instructor: Michael Eckmann.
Week 15 - Friday CS361.
02/26/02 (c) 2002 University of Wisconsin, CS 559 Last Time Canonical view pipeline Orthographic projection –There was an error in the matrix for taking.
CS 325 Introduction to Computer Graphics 03 / 08 / 2010 Instructor: Michael Eckmann.
Week 5 - Wednesday.  What did we talk about last time?  Project 2  Normal transforms  Euler angles  Quaternions.
CS 325 Introduction to Computer Graphics 04 / 26 / 2010 Instructor: Michael Eckmann.
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,
CO1301: Games Concepts Dr Nick Mitchell (Room CM 226) Material originally prepared by Gareth Bellaby.
12/4/2001CS 638, Fall 2001 Today Managing large numbers of objects Some special cases.
CO1301: Games Concepts Dr Nick Mitchell (Room CM 226) Material originally prepared by Gareth Bellaby.
CIS 350 – I Game Programming Instructor: Rolf Lakaemper.
CS 450: COMPUTER GRAPHICS PROJECTIONS SPRING 2015 DR. MICHAEL J. REALE.
Advanced Computer Graphics Spring 2014 K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology.
Basic Perspective Projection Watt Section 5.2, some typos Define a focal distance, d, and shift the origin to be at that distance (note d is negative)
10/19/04© University of Wisconsin, CS559 Fall 2004 Last Time Clipping –Why we care –Sutherland-Hodgman –Cohen-Sutherland –Intuition for Liang-Barsky Homework.
Collision Detection And Response Jae Chun KyungSoo Im Chau Vo Hoang Vu.
Chapter 11 Collision Detection 가상현실 입문 그래픽스 연구실 민성환.
11/20/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Collision Detection Overview Player-Environment handling.
Advanced Computer Graphics Spring 2014 K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology.
Ray Tracing Fall, Introduction Simple idea  Forward Mapping  Natural phenomenon infinite number of rays from light source to object to viewer.
Advanced Computer Graphics Spring 2009
Bridges To Computing General Information: This document was created for use in the "Bridges to Computing" project of Brooklyn College. You are invited.
1 Sage Demo 4 Collisions SAGE Lecture Notes Ian Parberry University of North Texas.
Coordinate Systems Lecture 1 Fri, Sep 2, The Coordinate Systems The points we create are transformed through a series of coordinate systems before.
CS 551/651: Advanced Computer Graphics
Discrete Math Section 12.5 Apply vectors in three dimensions Given points A(x 1,y 1,z 1 ) and B(x 2,y 2,z 2 ) Vector = Absolute value of = √((x 2 – x 1.
Fundamentals of Computer Animation Collision Detection and Response.
Week 13 - Wednesday CS361.
Frustum Culling in OpenGL
3D Game Development and Computer Animation Collision Detection
Advanced Computer Graphics Spring 2016
Collision Detection Spring 2004.
Parts of these slides are based on
What you will learn today
Computer Animation Algorithms and Techniques
Collision Detection.
CO Games Concepts Week 12 Collision Detection
Game Programming Algorithms and Techniques
David Johnson Cs6360 – Virtual Reality
GPAT – Chapter 7 Physics.
Presentation transcript:

Week 13 - Friday

 What did we talk about last time?  Ray/sphere intersection  Ray/box intersection  Slabs method  Line segment/box overlap test  Ray/triangle intersection  Ray/polygon intersection

 Simplest idea: Plug all the vertices of the box into the plane equation n x + d = 0  If you get positive and negative values, then the box is above and below the plane, intersection!  There are more efficient ways that can be done by projecting the box onto the plane

 Seeing if bounding volumes collide is a fundamental part of most collision detection algorithms  Does this ship hit that asteroid?  Bounding volumes are often arranged in hierarchies of bounding volumes  Bounding volumes allow for easy reject cases

 Sphere/sphere is the easiest  Is the distance between their centers bigger than the sum of their radii?  If yes, they are disjoint  If no, they overlap c1c1 c2c2 r1r1 r2r2

 Remember that an AABB is defined by two points, a min and a max  We go through each axis (x, y, and z) and first check to see if we can reject based on distance on that axis being too large  If not, we add the squared axis's distance to the total  If you want to do a sphere/OBB intersection, transform the sphere's center into the axes of the OBB and then the OBB will be an AABB

intersect( c, r, A ) { d = 0 for i in x,y,z if( (e = c i – a i min ) < 0 ) if( e < -r ) return DISJOINT d = d + e 2 else if ( (e = c i – a i max ) > 0 ) if( e > r ) return DISJOINT d = d + e 2 if ( d > r 2 ) return DISJOINT return OVERLAP } intersect( c, r, A ) { d = 0 for i in x,y,z if( (e = c i – a i min ) < 0 ) if( e < -r ) return DISJOINT d = d + e 2 else if ( (e = c i – a i max ) > 0 ) if( e > r ) return DISJOINT d = d + e 2 if ( d > r 2 ) return DISJOINT return OVERLAP }

 We test each dimension to see if the min of one box is greater than the max of the other or vice versa  If that's ever true, they're disjoint  If it's never true, they overlap intersect(A, B ) { for i in x,y,z if(a i min > b i max or b i min > a i max ) return DISJOINT return OVERLAP } intersect(A, B ) { for i in x,y,z if(a i min > b i max or b i min > a i max ) return DISJOINT return OVERLAP }

 An AABB is a special case of a 6-DOP  Use the same test for an AABB, looking at the mins and maxes of each slab  Because the axes of a k-DOP are not necessarily orthogonal, this test is inexact (unlike for the AABB)  It is conservative: Some disjoint k-DOPs will report that they overlap, but overlapping k-DOPs will never report disjoint intersect(A, B ) { for i in 1 … k/2 if(d i A,min > d i B,max or d i B,min > d i A,max ) return DISJOINT return OVERLAP } intersect(A, B ) { for i in 1 … k/2 if(d i A,min > d i B,max or d i B,min > d i A,max ) return DISJOINT return OVERLAP }

 Again, an OBB is surprisingly complex  The fastest way found involves the separating axis test  There are 15 different axes you've got to test for overlap before you can be sure that the boxes overlap  When all the math is worked out, the test is quite fast

 Because anything visible on the screen will be in the view frustum, we can save time by ignoring objects that are not  Remember that the frustum is defined by 6 planes: near, far, left, right, top and bottom  When test the frustum against bounding volumes, we will want three answers: outside, inside, and intersect

 To test frustum intersection, it is necessary to know the plane equations for each of the six frustum planes  If the view matrix is V and the projection matrix is P, the final transform is M = PV  If m i means the i th row of M, the equations for each plane are as follows:  -(m 3 + m 0 ) (x, y, z, 1) = 0(left)  -(m 3 – m 0 ) (x, y, z, 1) = 0(right)  -(m 3 + m 1 ) (x, y, z, 1) = 0(bottom)  -(m 3 – m 1 ) (x, y, z, 1) = 0(top)  -(m 3 + m 2 ) (x, y, z, 1) = 0(near)  -(m 3 – m 2 ) (x, y, z, 1) = 0(far)

 We take the center of the sphere p and plug it into each of the plane equations, getting signed distance values  Note that the normals of the planes point outwards  If the distance to any given plane is greater than radius r, the sphere is outside the frustum  If the distances to all six planes are less than –r, the sphere is inside  Otherwise, the sphere intersects  This test is conservative: Reports some outside spheres as intersections

 We skipped over the section that says how to test a plane for intersection with a box, but it's a simple calculation  To do frustum/AABB intersection, we test the AABB against every plane of the frustum  If the box is outside any plane, we return outside  If the box is not outside any plane but intersects some plane, we return intersects  Otherwise, we return inside

 We will only look at the 2D problem, but the book has discussion of 3D lines as well  For a 2D vector (x, y), we define its perp dot product (x, y)  = (-y, x)  Thus, we can work through the equations of a line (only the path to the value of s is shown)  r 1 (s) = r 2 (t)  o 1 + sd 1 = o 2 + td 2  sd 1 d 2  = (o 2 – o 1 ) d 2   s = ((o 2 – o 1 ) d 2  ) / (d 1 d 2  )

 Collision detection

 Keep working on Project 4  Start Assignment 5  Read Chapter 17