Collision/Acceleration University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2013 Tamara Munzner.

Slides:



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

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.
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.
CSE 380 – Computer Game Programming Collision Detection & Response Erin Catto’s Box2D.
CSE 381 – Advanced Game Programming Scene Management
Week 14 - Monday.  What did we talk about last time?  Bounding volume/bounding volume intersections.
University of British Columbia CPSC 314 Computer Graphics May-June 2005 Tamara Munzner Picking, Collision Week.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Collision Detection Week.
Collision Detection CSE 191A: Seminar on Video Game Programming Lecture 3: Collision Detection UCSD, Spring, 2003 Instructor: Steve Rotenberg.
1cs533d-winter-2005 Notes  More optional reading on web 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.
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.
Oct 26, Fall 2006IAT 4101 Collision Detection. Oct 26, Fall 2006IAT 4102 Collision Detection  Essential for many games –Shooting –Kicking, punching,
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.
Oct 3, Fall 2005Game Design1 Collision Detection.
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.
Collision Detection CSE169: Computer Animation Instructor: Steve Rotenberg UCSD, Winter 2004.
Collision Detection Michael Fuller. Overlap testing Most Common Technique Most Error Prone Test if two bodies overlap.
1Notes. 2 Time integration for particles  Back to the ODE problem, either  Accuracy, stability, and ease-of- implementation are main issues  Obviously.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Picking II, Collision.
Collision Detection David Johnson Cs6360 – Virtual Reality.
10/11/2001CS 638, Fall 2001 Today Kd-trees BSP Trees.
10/02/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Octrees.
12/4/2001CS 638, Fall 2001 Today Using separating planes/axes for collision testing Collision detection packages.
Computer Graphics 2 Lecture x: Acceleration Techniques for Ray-Tracing Benjamin Mora 1 University of Wales Swansea Dr. Benjamin Mora.
Spatial Data Structures Jason Goffeney, 4/26/2006 from Real Time Rendering.
Collision and Animation Systems in Games Jani Kajala Lead Programmer / Chief Technology Officer, Pixelgene Ltd (0)
10/09/2001CS 638, Fall 2001 Today Spatial Data Structures –Why care? –Octrees/Quadtrees –Kd-trees.
CSE 381 – Advanced Game Programming Quickhull and GJK.
Computer Animation Rick Parent Computer Animation Algorithms and Techniques Collisions & Contact.
Real-Time Rendering SPEEDING UP RENDERING Lecture 04 Marina Gavrilova.
Week 13 - Monday.  What did we talk about last time?  Exam 2!  Before that…  Polygonal techniques ▪ Tessellation and triangulation  Triangle strips,
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.
CIS 350 – I Game Programming Instructor: Rolf Lakaemper.
David Luebke11/26/2015 CS 551 / 645: Introductory Computer Graphics David Luebke
Chapter 11 Collision Detection 가상현실 입문 그래픽스 연구실 민성환.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2010 Tamara Munzner Procedural II, Collision.
11/20/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Collision Detection Overview Player-Environment handling.
Ray Tracing Fall, Introduction Simple idea  Forward Mapping  Natural phenomenon infinite number of rays from light source to object to viewer.
Ray Tracing II. HW1 Part A due October 10 Camera module Object module –Read from a file –Sphere and Light only Ray tracer module: –No shading. No reflection.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Collision II, Antialiasing.
Presented by Paul Phipps
Ray Tracing Optimizations
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
1 Advanced Scene Management. 2 This is a game-type-oriented issue Bounding Volume Hierarchies (BVHs) Binary space partition trees (BSP Trees) “Quake”
1 Geometry for Game. Geometry Geometry –Position / vertex normals / vertex colors / texture coordinates Topology Topology –Primitive »Lines / triangles.
Bounding Volume Hierarchies and Spatial Partitioning
CS679 - Fall Copyright Univ. of Wisconsin
Procedural, Collision University of British Columbia
Collision Detection Spring 2004.
Bounding Volume Hierarchies and Spatial Partitioning
Deformable Collision Detection
Parts of these slides are based on
Chapter 4.2 Collision Detection and Resolution
Computer Animation Algorithms and Techniques
Collision Detection.
Deformable Collision Detection
David Johnson Cs6360 – Virtual Reality
Presentation transcript:

Collision/Acceleration University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2013 Tamara Munzner

2 Reading for This Module FCG Sect 12.3 Spatial Data Structures

3 Collision/Acceleration

4 Collision Detection do objects collide/intersect? static, dynamic picking is simple special case of general collision detection problem check if ray cast from cursor position collides with any object in scene simple shooting projectile arrives instantly, zero travel time better: projectile and target move over time see if collides with object during trajectory

5 Collision Detection Applications determining if player hit wall/floor/obstacle terrain following (floor), maze games (walls) stop them walking through it determining if projectile has hit target determining if player has hit target punch/kick (desired), car crash (not desired) detecting points at which behavior should change car in the air returning to the ground cleaning up animation making sure a motion-captured character’s feet do not pass through the floor simulating motion physics, or cloth, or something else

6 From Simple to Complex boundary check perimeter of world vs. viewpoint or objects 2D/3D absolute coordinates for bounds simple point in space for viewpoint/objects set of fixed barriers walls in maze game 2D/3D absolute coordinate system set of moveable objects one object against set of items missile vs. several tanks multiple objects against each other punching game: arms and legs of players room of bouncing balls

7 Naive General Collision Detection for each object i containing polygons p test for intersection with object j containing polygons q for polyhedral objects, test if object i penetrates surface of j test if vertices of i straddle polygon q of j if straddle, then test intersection of polygon q with polygon p of object i very expensive! O(n 2 )

8 Fundamental Design Principles fast simple tests first, eliminate many potential collisions test bounding volumes before testing individual triangles exploit locality, eliminate many potential collisions use cell structures to avoid considering distant objects use as much information as possible about geometry spheres have special properties that speed collision testing exploit coherence between successive tests things don’t typically change much between two frames

9 Example: Player-Wall Collisions first person games must prevent the player from walking through walls and other obstacles most general case: player and walls are polygonal meshes each frame, player moves along path not known in advance assume piecewise linear: straight steps on each frame assume player’s motion could be fast

10 Stupid Algorithm on each step, do a general mesh-to-mesh intersection test to find out if the player intersects the wall if they do, refuse to allow the player to move problems with this approach? how can we improve: in response? in speed?

11 Collision Response frustrating to just stop for player motions, often best thing to do is move player tangentially to obstacle do recursively to ensure all collisions caught find time and place of collision adjust velocity of player repeat with new velocity, start time, start position (reduced time interval) handling multiple contacts at same time find a direction that is tangential to all contacts

12 Accelerating Collision Detection two kinds of approaches (many others also) collision proxies / bounding volumes spatial data structures to localize used for both 2D and 3D used to accelerate many things, not just collision detection raytracing culling geometry before using standard rendering pipeline

13 Collision Proxies proxy: something that takes place of real object cheaper than general mesh-mesh intersections collision proxy (bounding volume) is piece of geometry used to represent complex object for purposes of finding collision if proxy collides, object is said to collide collision points mapped back onto original object good proxy: cheap to compute collisions for, tight fit to the real geometry common proxies: sphere, cylinder, box, ellipsoid consider: fat player, thin player, rocket, car …

14 Trade-off in Choosing Proxies increasing complexity & tightness of fit decreasing cost of (overlap tests + proxy update) AABB OBB Sphere Convex Hull 6-dop AABB: axis aligned bounding box OBB: oriented bounding box, arbitrary alignment k-dops – shapes bounded by planes at fixed orientations discrete orientation polytope

15 Pair Reduction want proxy for any moving object requiring collision detection before pair of objects tested in any detail, quickly test if proxies intersect when lots of moving objects, even this quick bounding sphere test can take too long: N 2 times if there are N objects reducing this N 2 problem is called pair reduction pair testing isn’t a big issue until N>50 or so…

16 Spatial Data Structures can only hit something that is close spatial data structures tell you what is close to object uniform grid, octrees, kd-trees, BSP trees bounding volume hierarchies OBB trees for player-wall problem, typically use same spatial data structure as for rendering BSP trees most common

17 Uniform Grids axis-aligned divide space uniformly

18 Quadtrees/Octrees axis-aligned subdivide until no points in cell

19 KD Trees axis-aligned subdivide in alternating dimensions

20 BSP Trees planes at arbitrary orientation

21 Bounding Volume Hierarchies

22 OBB Trees

23 Related Reading Real-Time Rendering Tomas Moller and Eric Haines on reserve in CICSR reading room

24 Acknowledgement slides borrow heavily from Stephen Chenney, (UWisc CS679) slides borrow lightly from Steve Rotenberg, (UCSD CSE169)