Computer graphics & visualization Collisions. computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization.

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.
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/
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 381 – Advanced Game Programming Scene Management
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.
Collision Detection CSE 191A: Seminar on Video Game Programming Lecture 3: Collision Detection UCSD, Spring, 2003 Instructor: Steve Rotenberg.
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.
OBBTree: A Hierarchical Structure for Rapid Interference Detection Gottschalk, M. C. Lin and D. ManochaM. C. LinD. Manocha Department of Computer Science,
UNC Chapel Hill M. C. Lin Overview of Last Lecture About Final Course Project –presentation, demo, write-up More geometric data structures –Binary Space.
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.
10/11/2001CS 638, Fall 2001 Today Kd-trees BSP Trees.
10/02/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Octrees.
Computer graphics & visualization Collision Detection – Narrow Phase.
Week 13 - Wednesday CS361.
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.
Data Structures for Computer Graphics Point Based Representations and Data Structures Lectured by Vlastimil Havran.
Spatial Data Structures Jason Goffeney, 4/26/2006 from Real Time Rendering.
10/09/2001CS 638, Fall 2001 Today Spatial Data Structures –Why care? –Octrees/Quadtrees –Kd-trees.
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.
On a Few Ray Tracing like Algorithms and Structures. -Ravi Prakash Kammaje -Swansea University.
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,
CS-378: Game Technology Lecture #10: Spatial Data Structures Prof. Okan Arikan University of Texas, Austin Thanks to James O’Brien, Steve Chenney, Zoran.
Collision/Acceleration University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2013 Tamara Munzner.
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.
Real-time Graphics for VR Chapter 23. What is it about? In this part of the course we will look at how to render images given the constrains of VR: –we.
1 KIPA Game Engine Seminars Jonathan Blow Ajou University December 6, 2002 Day 10.
CIS 350 – I Game Programming Instructor: Rolf Lakaemper.
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.
Presented by Paul Phipps
3D Object Representations 2011, Fall. Introduction What is CG?  Imaging : Representing 2D images  Modeling : Representing 3D objects  Rendering : Constructing.
1 CSCE 441: Computer Graphics Hidden Surface Removal Jinxiang Chai.
Ray Tracing Optimizations
David Luebke 3/5/2016 Advanced Computer Graphics Lecture 4: Faster Ray Tracing David Luebke
Ray Tracing Acceleration (5). Ray Tracing Acceleration Techniques Too Slow! Uniform grids Spatial hierarchies K-D Octtree BSP Hierarchical grids Hierarchical.
3D Object Representations 2009, Fall. Introduction What is CG?  Imaging : Representing 2D images  Modeling : Representing 3D objects  Rendering : Constructing.
Ray Tracing Acceleration (3)
Hierarchical Data Structure in Game Programming Yanci Zhang Game Programming Practice.
CS552: Computer Graphics Lecture 28: Solid Modeling.
Bounding Volume Hierarchies and Spatial Partitioning
Collision Detection Spring 2004.
Bounding Volume Hierarchies and Spatial Partitioning
Deformable Collision Detection
Modeliranje kompleksnih modelov
3D Object Representations
Parts of these slides are based on
CS679 - Fall Copyright Univ. of Wisconsin
Computer Animation Algorithms and Techniques
Collision Detection.
Deformable Collision Detection
BVH Student: Jack Chang.
David Johnson Cs6360 – Virtual Reality
Modeliranje kompleksnih modelov
Presentation transcript:

computer graphics & visualization Collisions

computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group Collisions Avoidance Detection

computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group Detection Broad Phase Narrow Phase Detection

computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group Broad Phase Bounding Volume (Hierarchies) Space Partitioning Schemes

computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group Bounding Volumes Key idea: – Surround the object with a (simpler) bounding object (the bounding volume). – If something does not collide with the bounding volume, it does not collide with the object inside. – Often, to intersect two objects, first intersect their bounding volumes

computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group Choosing a Bounding Volume Lots of choices, each with tradeoffs Tighter fitting is better – More likely to eliminate “false” intersections

computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group Choosing a Bounding Volume Lots of choices, each with tradeoffs Tighter fitting is better Simpler shape is better – Makes it faster to compute with

computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group Choosing a Bounding Volume Lots of choices, each with tradeoffs Tighter fitting is better Simpler shape is better Rotation Invariant is better – Easier to update as object moves

computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group Choosing a Bounding Volume Lots of choices, each with tradeoffs Tighter fitting is better Simpler shape is better Rotation Invariant is better Convex is usually better – Gives simpler shape, easier computation

computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group Bounding Volumes: Sphere Rotationally invariant – Usually Usually fast to compute with Store: center point and radius – Center point: object’s center of mass – Radius: distance of farthest point on object from center of mass. Often not very tight fit 10/59

computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group Axis Aligned Bounding Box (AABB) Very fast to compute with Store: max and min along x,y,z axes. – Look at all points and record max, min Moderately tight fit Must update after rotation, unless a loose box that encompasses the bounding sphere 11/59

computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group Common Bounding Volumes: k-dops k-discrete oriented polytopes Same idea as AABBs, but use more axes. Store: max and min along fixed set of axes. – Need to project points onto other axes. Tighter fit than AABB, but also a bit more work. 12/59

computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group 13/59 Choosing axes for k-dops Common axes: consider axes coming out from center of a cube: Through faces: 6-dop – same as AABB Faces and vertices: 14-dop Faces and edge centers: 18-dop Faces, vertices, and edge centers; 26- dop More than that not really helpful Empirical results show 14 or 18-dop performs best.

computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group Oriented Bounding Box (OBB) Store rectangular parallelepiped oriented to best fit the object Store: – Center – Orthonormal set of axes – Extent along each axis Tight fit, but takes work to get good initial fit OBB rotates with object, therefore only rotation of axes is needed for update Computation is slower than for AABBs, but not as bad as it might seem 14/59

computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group Convex Hull Very tight fit (tightest convex bounding volume) Slow to compute with Store: set of polygons forming convex hull Can rotate CH along with object. Can be efficient for some applications 15/59

computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group Testing for Collision Will depend on type of objects and bounding volumes. Specialized algorithms for each: – Sphere/sphere – AABB/AABB – OBB/OBB – Ray/sphere – Triangle/Triangle

computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group 17/59 Collision Test Example: Sphere-Sphere Find distance between centers of spheres Compare to sum of sphere radii – If distance is less, they collide For efficiency, check squared distance vs. square of sum of radii d r2r2r2r2 r1r1r1r1

computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group Collision Test Example: AABB vs. AABB Project AABBs onto axes – i.e. look at extents If overlapping on all axes, the boxes overlap. Same idea for k-dops.

computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group Collision Test Example: OBB vs. OBB Similar to overlap test for k-dops How do we find axes to test for overlap?

computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group Separating Axis Theorem Two convex shapes do not overlap if and only if there exists an axis such that the projections of the two shapes do not overlap

computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group Enumerating Separating Axes 2D: check axis aligned with normal of each face 3D: check axis aligned with normals of each face and cross product of each pair of edges

computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group Enumerating Separating Axes 2D: check axis aligned with normal of each face 3D: check axis aligned with normals of each face and cross product of each pair of edges

computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group Enumerating Separating Axes 2D: check axis aligned with normal of each face 3D: check axis aligned with normals of each face and cross product of each pair of edges

computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group Bounding Volumes Hierarchies

computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group 25/59 Intersecting Bounding Volume Hierarcies For object-object collision detection Keep a queue of potentially intersecting BVs – Initialize with main BV for each object Repeatedly pull next potential pair off queue and test for intersection. – If that pair intersects, put pairs of children into queue. – If no child for both BVs, test triangles inside Stop when we either run out of pairs (thus no intersection) or we find an intersecting pair of triangles

computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group BVH Collision Test example

computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group B-Volume Examples

computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group Space partitioning Why space partitioning? The best object is the one that is not going to be processed! – Processing means Determining the spatial relationships between objects – Do objects intersect – collision detection – Naive approach has complexity O(n 2 ) (n polygons in the scene) Can also be: Rendering – Are objects within the visible space – visibility culling – Are objects occluded – occlusion culling

computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group Spatial hierarchies Hierarchies of space partitions – (Regular Grid) – Quadtree, Octree – BSP-Trees (BSP = Binary Space Partitioning) – KD-Trees Assignment of objects to partitions Collision detection then becomes 1) determine in which partition the object is 2) test only objects in the same partition Good for static scenes, otherwise the hierarchy has to be re-build

computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group Regular Grid Span course grid over the domain Find cells in which the objects reside Test if one cells contains more than one object Not really a hierarchy (one level)

computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group Spatial hierarchies Octrees – Recursive regular subdivision of space into 8 subspaces One node is split into 8 child nodes Balanced octree - grid Adaptive quadtree

computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group Examples

computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group Spatial hierarchies Bsp-Trees – Computational representation of space Search structure and representation of geometry – Generalization of binary search trees for dim>1 – Search complexity to find spatial relationships between n polygons within O(n log n) – Recursive space partitioning by means of arbitrarily positioned partitioning planes

computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group Spatial hierarchies Bsp-Trees (Binary Space Partitioning) – Every cell is a convex polyhedron A C D B P1P1P1P1 P2P2P2P2 P3P3P3P3 P2P2P2P2 P1P1P1P1 P3P3P3P3 A CBD

computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group Spatial hierarchies Bsp-Tree example – Inter-object partitioning – Binary tree of lines in 2D A BC D A B C D Partitioning Tree

computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group Spatial hierarchies Characteristics of Bsp-Trees – Transformation of object = transformation of tree – Intra-object relationships remain static for solid objects – Merging with other trees easy to do – Objects in one halfspace cannot intersect objects in the corresponding other halfspace Accelerates intersection test between objects

computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group Spatial hierarchies Constructing Bsp-Trees – Elementary operation is recursive subdivision Split convex region into two convex subregions Use hyperplanes as cutting primitives R+ R- Hyperplane R

computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group Spatial hierarchies Bsp-Tree construction – Different orderings of faces to use as hyperplanes result in different trees Greedy approach (decisions for each step based on what seems optimal) not always applicable – Good Bsp-Tree represents the model as sequence of approximations Pruning yields different resolutions of the model

computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group Spatial hierarchies Bsp-Tree construction – Bsp-Trees only perform good if geometric features are local Is true most of the time Then, a significant subset of space can be eliminated – Low cost (short paths) for reaching high probability regions Similar to Huffman coding – Probability for ´in a region´ is proportional to the size of the region p+ = vol(tree.posSubspace) / vol(tree) p- = vol(tree.negSubspace) / vol(tree)

computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group Spatial hierarchies Collison test for particles in BSP-tree – Test, in which node the particle is located – Traverse tree until leafs – Collision, if at least one filled leaf is hit

computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group Spatial hierarchies Collision test for particles in BSP-tree – Clip path line between 2 particle locations at separating planes – Test all in-between time steps – Collision will be detected independent of size of time step t0t0 t 0 +  t t0t0 collision detected Collision not detected

computer graphics & visualization Simulation and Animation – SS07 Jens Krüger – Computer Graphics and Visualization Group Spatial hierarchies Collision test for particles with extend – Offset on surfaces (level planes) – Different offsets for different moving objects – Construction of different BSP-trees Problem: Distance too large