Week 13 - Monday.  What did we talk about last time?  Exam 2!  Before that…  Polygonal techniques ▪ Tessellation and triangulation  Triangle strips,

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.
COMP 175 | COMPUTER GRAPHICS Remco Chang1/6103b – Shapes Lecture 03b: Shapes COMP 175: Computer Graphics February 3, 2015.
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.
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.
Extended Gaussian Images
Here is where my object is Here is where my object is going to be Here is where I want my object to be.
CHAPTER 12 Height Maps, Hidden Surface Removal, Clipping and Level of Detail Algorithms © 2008 Cengage Learning EMEA.
Computer Graphics Viewing.
Advanced Computer Graphics Spring 2014
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.
By: Andrew Shatz & Michael Baker Chapter 15. Chapter 15 section 1 Key Terms: Skew Lines, Oblique Two lines are skew iff they are not parallel and do not.
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.
CSCE 590E Spring 2007 Basic Math By Jijun Tang. Applied Trigonometry Trigonometric functions  Defined using right triangle  x y h.
OBBTree: A Hierarchical Structure for Rapid Interference Detection Gottschalk, M. C. Lin and D. ManochaM. C. LinD. Manocha Department of Computer Science,
Apex Point Map for Constant-Time Bounding Plane Approximation Samuli Laine Tero Karras NVIDIA.
1Notes. 2 Time integration for particles  Back to the ODE problem, either  Accuracy, stability, and ease-of- implementation are main issues  Obviously.
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.
Chapter 15: Geometric Solids Brian BarrDan Logan.
CS 450: Computer Graphics REVIEW: OVERVIEW OF POLYGONS
Week 15 - Friday CS361.
CSE 381 – Advanced Game Programming Quickhull and GJK.
Collision handling: detection and response
CS 325 Introduction to Computer Graphics 04 / 26 / 2010 Instructor: Michael Eckmann.
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.
Section 8.4 Nack/Jones1 Section 8.4 Polyhedrons & Spheres.
Quaternions Paul Taylor Swizzle What is a swizzle?
CO1301: Games Concepts Dr Nick Mitchell (Room CM 226) Material originally prepared by Gareth Bellaby.
PRESENTED BY – GAURANGI TILAK SHASHANK AGARWAL Collision Detection.
1 KIPA Game Engine Seminars Jonathan Blow Ajou University December 6, 2002 Day 10.
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.
1 Dr. Scott Schaefer Intersecting Simple Surfaces.
3D Game Engine Design 1 3D Game Engine Design Ch D MAP LAB.
Chapter Area, Pythagorean Theorem, and Volume 14 Copyright © 2013, 2010, and 2007, Pearson Education, Inc.
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.
Week 13 - Wednesday CS361.
Week 15 - Friday CS361.
Collision Detection Spring 2004.
Parts of these slides are based on
Collision handling: detection and response
CMSC 635 Ray Tracing.
2.5. Basic Primitive Intersection
Computer Animation Algorithms and Techniques
Collision Detection.
CO Games Concepts Week 12 Collision Detection
David Johnson Cs6360 – Virtual Reality
GPAT – Chapter 7 Physics.
Presentation transcript:

Week 13 - Monday

 What did we talk about last time?  Exam 2!  Before that…  Polygonal techniques ▪ Tessellation and triangulation  Triangle strips, fans, and meshes  Simplification ▪ Static ▪ Dynamic ▪ View-dependent

 We need to test for various intersections for lots of reasons  What object is the mouse hovering over (or your gun pointing at)? (Called picking)  Do these two objects collide?  Does a ray hit a bounding box?  As with everything in real time graphics, it needs to be efficient

 It's a challenging (and computationally expensive) task to see if a ray intersects with, say, a demon model  Instead, models are often surrounded by bounding volumes that are easy to test intersection against  If a ray or another model (or another model's bounding volume) intersects with a bounding volume, we can compute a more exact intersection  If not, it doesn't matter

Bounding Sphere  Easy to do intersection tests with  Poor fit for many rectangular objects  More costly intersection tests  Better fit for rectangular objects  No computational savings at all  Perfect fit for cow Bounding BoxBounding Cow

 A ray r(t) is defined by an origin point o and a direction vector d  d is usually normalized  Negative t values are behind the starting point of the ray and usually don't count  If d is normalized, positive t values give the distance of the point from o  It is also common to store l, the maximum distance along the ray we want to look

 An implicit surface is one described by a vector equation where any point on the surface has a value of 0  f(p) = f(p x, p y, p z ) = 0  Implicit sphere: f(p) = p x 2 + p y 2 + p z 2 - r 2 = 0  An explicit surface is one parameterized by two parameters   Explicit sphere:

 An axis-aligned bounding box (AABB) (also known as a rectangular box) is a box whose faces have normals pointing the same way as the x, y, and z axes  It's a non-rotated box in 3 space  It can be defined with two points (lower corner and upper corner)

 An oriented bounding box (OBB) is an AABB that has been arbitrarily rotated  It can be described by  A center point b c  Three normalized vectors b u, b v, and b w giving the side directions of the box  And half-lengths (from center to wall) h u B, h v B, and h w B

 A k discrete oriented polytope (k-DOP) has k/2 normalized normals n i  For each n i, there are two values d i min and d i max which defines a slab S i that is the volume between the two planes  The k-DOP is the intersections of all the slabs

 For two arbitary, convex, disjoint polyhedra A and B, there exists a separating axis where the projections of the polyhedra are also disjoint  Furthermore, there is an axis that is orthogonal to (making the separating plane parallel to) 1. A face of A or 2. A face of B or 3. An edge from each polyhedron (take the cross product)  This definition of polyhedra is general enough to include triangles and line segments

 An AABB is the easiest  Take the minimum and maximum points in each axis and, BOOM, you've got an AABB  A k-DOP is not much harder  Take the minimum and maximum values in each of the k/2 axes and use those to define the slabs  You have to have axes in mind ahead of time

 Not as simple as you might think  One approach:  Make an AABB and use the center and diagonal of the corners to make your sphere  Or:  Make the AABB and do another pass through the vertices, taking the one furthest from the center as the radius  There are other more complicated ideas

 The relative probability that a random point is inside an object is proportional to the object's volume  However, the relative probability that a random ray intersects an object is proportional to its surface area

 Messiest yet!  Find the convex hull of the object  Find the centroid of the entire convex hull  Compute a matrix using math from the book  The eigenvectors of the matrix are the direction vectors of the box  Use them to find the extreme points for each axis  There are other approaches

 Perform computations early that could easily get a reject or accept  If possible, reuse results from previous tests  If you are using multiple tests, experiment with the order in which you apply them  Postpone expensive calculations (trig, square roots, and divisions) until you absolutely need them  Reduce the problem to a lower dimension whenever possible  If one ray or object is being tested against many others, try to compute whatever you can for that one item a single time  Expensive intersection tests should always come after some simpler BV test  Use empirical timing data to see what really works best  Write robust code, particularly with respect to floating point issues

 We can write the implicit sphere equation as f(p) = ||p – c|| – r = 0  p is any point on the surface  c is the center  r is the radius  By substituting in r(t) for p, we can eventually get the equation t 2 + 2tb + c = 0, where b = d (o – c) and c = (o – c) (o – c) – r 2  If the discriminant is negative, the ray does not hit the sphere, otherwise, we can compute the location(s) where it does

 Looking at it geometrically, we can optimize the test  Find the vector from the ray origin to the center of the sphere l = c – 0  Find the squared length l 2 = l l  If l 2 < r 2, then o is in the sphere, intersect!  If not, project l onto d: s = l d  If s < 0, then the ray points away from the sphere, reject  Otherwise, use the Pythagorean theorem to find the squared distance from the sphere center to the projection: m 2 = l 2 – s 2  If m 2 > r 2, the ray will miss, otherwise it hits

 There are a few basic primitives that SharpDX uses for intersection testing  Plane  Defined by a normal and a distance from the origin along that normal  Or you can make one with three points  Ray  Defined by a starting point and a direction vector  Vector3  Used (unsurprisingly) for points

 BoundingBox  Axis aligned bounding box  Defined by two points  BoundingSphere  Defined by a center point and a radius  BoundingFrustum  Defined by a matrix (view x projection)

 More intersection test methods  Ray/box intersection  Line segment/box overlap  Ray/triangle intersection  Plane/box intersection

 Keep working on Project 4  Keep reading Chapter 16