Collision Detection based on Spatial Partitioning

Similar documents
Simulation in Computer Graphics Space Subdivision. Matthias Teschner

CPSC / Sonny Chan - University of Calgary. Collision Detection II

Intersection Acceleration

Collision Detection. These slides are mainly from Ming Lin s course notes at UNC Chapel Hill

Collision Detection with Bounding Volume Hierarchies

Collision Detection. Motivation - Dynamic Simulation ETH Zurich. Motivation - Path Planning ETH Zurich. Motivation - Biomedical Simulation ETH Zurich

Spatial Data Structures

Collision Detection II. These slides are mainly from Ming Lin s course notes at UNC Chapel Hill

Spatial Data Structures

Homework 1: Implicit Surfaces, Collision Detection, & Volumetric Data Structures. Loop Subdivision. Loop Subdivision. Questions/Comments?

Computer Graphics Ray Casting. Matthias Teschner

Bounding Volume Hierarchies

Acceleration Data Structures

Overview. Collision Detection. A Simple Collision Detection Algorithm. Collision Detection in a Dynamic Environment. Query Types.

Collision and Proximity Queries

Spatial Data Structures

Page 1. Area-Subdivision Algorithms z-buffer Algorithm List Priority Algorithms BSP (Binary Space Partitioning Tree) Scan-line Algorithms

Spatial Data Structures

Spatial Data Structures

Scene Management. Video Game Technologies 11498: MSc in Computer Science and Engineering 11156: MSc in Game Design and Development

Real-Time Collision Detection for Dynamic Virtual Environments

Announcements. Written Assignment2 is out, due March 8 Graded Programming Assignment2 next Tuesday

Algorithms for GIS:! Quadtrees

Ray Tracing Acceleration Data Structures

BALANCED SPATIAL SUBDIVISION METHOD FOR CONTINUOUS COLLISION DETECTION

Overview. Collision detection. Collision detection. Brute force collision detection. Brute force collision detection. Motivation

Lecture 25 of 41. Spatial Sorting: Binary Space Partitioning Quadtrees & Octrees

9. Visible-Surface Detection Methods

Solid Modeling. Thomas Funkhouser Princeton University C0S 426, Fall Represent solid interiors of objects

VIII. Visibility algorithms (II)

Ray Tracing: Intersection

improving raytracing speed

Collision Detection. Pu Jiantao.

Simulation in Computer Graphics. Deformable Objects. Matthias Teschner. Computer Science Department University of Freiburg

CS 563 Advanced Topics in Computer Graphics Culling and Acceleration Techniques Part 1 by Mark Vessella

Chapter 11 Global Illumination. Part 1 Ray Tracing. Reading: Angel s Interactive Computer Graphics (6 th ed.) Sections 11.1, 11.2, 11.

Lesson 05. Mid Phase. Collision Detection

Geometric Representations. Stelian Coros

Collision handling: detection and response

CMSC 425: Lecture 10 Geometric Data Structures for Games: Index Structures Tuesday, Feb 26, 2013

Ray Tracing III. Wen-Chieh (Steve) Lin National Chiao-Tung University

Consistent Penetration Depth Estimation for Deformable Collision Response

Ray Tracing. Cornell CS4620/5620 Fall 2012 Lecture Kavita Bala 1 (with previous instructors James/Marschner)

Deformable Proximity Queries and their Application in Mobile Manipulation Planning

Advanced 3D-Data Structures

Spatial Data Structures and Speed-Up Techniques. Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology

A Survey on Collision Detection Techniques for Virtual Environments

MSBVH: An Efficient Acceleration Data Structure for Ray Traced Motion Blur

Speeding up your game

Computer Graphics. Bing-Yu Chen National Taiwan University The University of Tokyo

Topics. Ray Tracing II. Intersecting transformed objects. Transforming objects

Principles of Computer Game Design and Implementation. Revision Lecture

CAB: Fast Update of OBB Trees for Collision Detection between Articulated Bodies

Speeding Up Ray Tracing. Optimisations. Ray Tracing Acceleration

Using Bounding Volume Hierarchies Efficient Collision Detection for Several Hundreds of Objects

Accelerating Geometric Queries. Computer Graphics CMU /15-662, Fall 2016

CS535 Fall Department of Computer Science Purdue University

Topics. Ray Tracing II. Transforming objects. Intersecting transformed objects

Dynamic Spatial Partitioning for Real-Time Visibility Determination. Joshua Shagam Computer Science

Exact distance computation for deformable objects

Lecture 11: Ray tracing (cont.)

CSG obj. oper3. obj1 obj2 obj3. obj5. obj4

11 - Spatial Data Structures

Computer Graphics. Bing-Yu Chen National Taiwan University

Motivation. Freeform Shape Representations for Efficient Geometry Processing. Operations on Geometric Objects. Functional Representations

Implicit Surfaces & Solid Representations COS 426

Recall: Inside Triangle Test

Space-based Partitioning Data Structures and their Algorithms. Jon Leonard

Collision Detection. Jane Li Assistant Professor Mechanical Engineering & Robotics Engineering

Identifying those parts of a scene that are visible from a chosen viewing position, and only process (scan convert) those parts

Ray Tracing with Spatial Hierarchies. Jeff Mahovsky & Brian Wyvill CSC 305

Ray Tracing Acceleration. CS 4620 Lecture 20

MODELING AND HIERARCHY

CPSC GLOBAL ILLUMINATION

On the data structures and algorithms for contact detection in granular media (DEM) V. Ogarko, May 2010, P2C course

Spatial Data Structures. Steve Rotenberg CSE168: Rendering Algorithms UCSD, Spring 2017

Solid Modelling. Graphics Systems / Computer Graphics and Interfaces COLLEGE OF ENGINEERING UNIVERSITY OF PORTO

Data Structures and Algorithms

DiFi: Distance Fields - Fast Computation Using Graphics Hardware

More Hidden Surface Removal

Computer Graphics II

TDA362/DIT223 Computer Graphics EXAM (Same exam for both CTH- and GU students)

Ray Tracing Acceleration. CS 4620 Lecture 22

An iterative, octree-based algorithm for distance computation between polyhedra with complex surfaces 1

INFOGR Computer Graphics. J. Bikker - April-July Lecture 11: Acceleration. Welcome!

Comparing Sphere-Tree Generators and Hierarchy Updates for Deformable Objects Collision Detection

Accelerated Raytracing

Motivation. Culling Don t draw what you can t see! What can t we see? Low-level Culling

Spatial Data Structures for Computer Graphics

A specialised collision detector for grape vines

DISTRIBUTED AND COLLABORATIVE SYNTHETIC ENVIRONMENTS

Fast Proximity Computation among Deformable Models Using Discrete Voronoi Diagrams

MUTI-LEVEL SB COLLIDE: COLLISION AND SELF-COLLISION IN SOFT BODIES

Deformable Distance Fields for Simulation of Non- Penetrating Flexible Bodies

Animating cuts with on-the-fly re-meshing

Anti-aliased and accelerated ray tracing. University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell

Logistics. CS 586/480 Computer Graphics II. Questions from Last Week? Slide Credits

Fast continuous collision detection among deformable Models using graphics processors CS-525 Presentation Presented by Harish

CS580: Ray Tracing. Sung-Eui Yoon ( 윤성의 ) Course URL:

COMP 175: Computer Graphics April 11, 2018

Transcription:

Simulation in Computer Graphics Collision Detection based on Spatial Partitioning Matthias Teschner Computer Science Department University of Freiburg

Outline introduction uniform grid Octree and k-d tree BSP tree University of Freiburg Computer Science Department Computer Graphics - 2

Model Partitioning (1) Bounding volumes (2) Bounding volume tree Sphere Axis-Aligned Bounding Box (AABB) Object-Oriented Bounding Box (OBB) Discrete-Orientation Polytope (k-dop) (3) Collision detection test University of Freiburg Computer Science Department Computer Graphics - 3

Model vs. Space Partitioning model partitioning space partitioning University of Freiburg Computer Science Department Computer Graphics - 4

Motivation restrict pairwise object tests to objects that are located in the same region of space only objects or object primitives in the same region of space can overlap efficient broad-phase approach for larger numbers of objects University of Freiburg Computer Science Department Computer Graphics - 5

Spatial Data Structures uniform grid Quadtree / Octree k-d tree BSP tree space is subdivided into cells cells maintain references to primitives intersecting the cell data structures have different degrees-of-freedom actual space subdivision is adapted to the scene University of Freiburg Computer Science Department Computer Graphics - 6

Outline introduction uniform grid Octree and k-d tree BSP tree University of Freiburg Computer Science Department Computer Graphics - 7

Basic Idea space is divided up into cells object primitives are placed into cells object primitives within the same cell are checked for collision pairs of primitives that do not share the same cell are not tested (trivial reject) University of Freiburg Computer Science Department Computer Graphics - 8

Application collision detection for deformable objects tetrahedral meshes uniform 3D grid non-uniform distribution of object primitives and unbounded simulation domain hashed storage detection of collisions and self-collisions discussion of parameters NCCR Co-Me Epidaure, INRIA University of Freiburg Computer Science Department Computer Graphics - 9

Setup infinite uniform grid: hash function: H(cell) hash table index hash table:... (spatial data structure) (representation) University of Freiburg Computer Science Department Computer Graphics - 10

... Stage 1 all vertices are hashed according to their cell University of Freiburg Computer Science Department Computer Graphics - 11

... Stage 2 all tetrahedrons are hashed according to the cells touched by their bounding box University of Freiburg Computer Science Department Computer Graphics - 12

... Stage 3 vertices and tetrahedrons in the same hash table entry are tested for intersection A) no collision B) collision C) self-collision University of Freiburg Computer Science Department Computer Graphics - 13

Vertex-in-Tetrahedron Test Barycentric coordinates Oriented faces Barycentric coordinates more efficienct they also provide useful collision information University of Freiburg Computer Science Department Computer Graphics - 14

Implementation store all vertices in the hash table compute hash table indices for the bounding boxes of the tetrahedrons do not store the tetrahedrons in the hash table, but check for intersection with all vertices in the respective entry parameters grid cell size grid cell shape hash table size hash function University of Freiburg Computer Science Department Computer Graphics - 15

Parameters infinite uniform grid: hash function: H(cell) hash table index hash table:... cell shape cell size hash table size University of Freiburg Computer Science Department Computer Graphics - 16

Grid Cell Size cell size should be equal to the size of the bounding box of an object primitive [Bentley 1977] [Teschner, Heidelberger et al. 2003] test scenario University of Freiburg Computer Science Department Computer Graphics - 17

Hash Table Size hash collisions reduce the performance larger hash table can reduce hash collisions test scenario University of Freiburg Computer Science Department Computer Graphics - 18

Hash Function should avoid hash collisions should be efficient (has to be computed for all primitives) cell coordinates: large primes: hash table size: University of Freiburg Computer Science Department Computer Graphics - 19

Performance linear in the number of primitives independent of the number of objects objects tetras vertices max time [ms] 100 1000 1200 6 8 4000 1936 15 20 10000 4840 34 2 20514 5898 72 100 50000 24200 174 test scenarios Pentium 4, 1.8GHz University of Freiburg Computer Science Department Computer Graphics - 20

Summary Uniform Grid space uniformly partitioned into axis-aligned space cells primitives (or their AABBs) are scan-converted to identify intersected space cells hashed storage of cells for non-uniform distribution simple and efficient particularly interesting for deformable objects, n-body environments and self-collision parameters significantly influence the performance performance dependent on the number of primitives performance independent of the number of objects technique works with various types of primitives University of Freiburg Computer Science Department Computer Graphics - 21

Some History [Levinthal 1966] 3D grid ( cubing ) analysis of molecular structures neighborhood search to compute atom interaction [Rabin 1976] 3D grid + hashing finding closest pairs [Turk 1989, 1990] rigid collision detection 3D grid + hashing Cyrus Levinthal, MIT University of Freiburg Computer Science Department Computer Graphics - 22

Outline introduction uniform grid Octree and k-d tree BSP tree University of Freiburg Computer Science Department Computer Graphics - 23

Octree hierarchical structure space partitioning into rectangular, axis-aligned cells Octree root node corresponds to AABB of an object internal nodes represent subdivisions of the AABB leaves represent cells which maintain primitive lists University of Freiburg Computer Science Department Computer Graphics - 24

Octree uniform or non-uniform subdivision adaptive to local distribution of primitives large cells in case of low density of primitives small cells in case of high density dynamic update cells with many primitives can be subdivided cells with less primitives can be merged University of Freiburg Computer Science Department Computer Graphics - 25

k-d Tree 2-d Example University of Freiburg Computer Science Department Computer Graphics - 26

Collision Query (Range Query) traverse all nodes affected by the intervals of an AABB check all primitives in the leaves for intersection University of Freiburg Computer Science Department Computer Graphics - 27

Outline introduction uniform grid Octree and k-d tree BSP tree University of Freiburg Computer Science Department Computer Graphics - 28

Binary Space Partitioning Tree BSP hierarchical structure space is subdivided by means of arbitrarily oriented planes generalized k-d tree space partitioning into convex cells discrete-orientation BSP trees DOBSP (finite set of plane orientations) proposed by [Henry Fuchs et al. 1980] to solve the visible surface problem University of Freiburg Computer Science Department Computer Graphics - 29

Collision Detection Example BSP trees can be used for the inside / outside classification of closed polygons + 1-1 2 1 2 3b 3a + - + - 4 3 3b 4 3a out 4 out 2 + - + - out in out in scene scene partitioning solid-leaf BSP tree University of Freiburg Computer Science Department Computer Graphics - 30

Collision Query query point is inside 4 3b 1 3a 2 + 3b 1 3a + - + - out 4 out 2 + - + - out in out in - query point is outside 4 3b 1 3a 2 + 3b 1 3a + - + - out 4 out 2 + - + - out in out in - University of Freiburg Computer Science Department Computer Graphics - 31

Rendering Example 3 2 3 2b 2a + 1-1 1 3 4 + - + - 4 4 2b 2a scene scene partitioning BSP tree University of Freiburg Computer Science Department Computer Graphics - 32

BSP Tree for Rendering for a given viewpoint render far branch render root (node) polygon render near branch recursively applied to sub-trees back to front rendering viewpoint example: viewpoint is in 1- rendering of 1+, 1, 1- rule recursively applied to 1+ and 1- viewpoint is in 3+ rendering of 3, 2b viewpoint is in 4- rendering of 2a, 4 University of Freiburg Computer Science Department Computer Graphics - 33 3 1 2b 2b 4 + 1 2a 3 4 BSP tree - + - + - 2a

Construction keep the number of nodes small keep the number of levels small introduce arbitrary support planes (especially in case of convex objects, where all polygon faces are in the same half-space with respect to a given face) University of Freiburg Computer Science Department Computer Graphics - 34

Summary uniform grid Octree and k-d tree BSP tree University of Freiburg Computer Science Department Computer Graphics - 35

References C. Levinthal, Molecular model-building by computer, Scientific American, pp. 42-52, June 1966. J. L. Bentley, D. F. Stanat, E. H. Williams, The complexity of fixed-radius near neighbor searching, Inf. Process. Letters, vol. 6, 209-212, 1977. G. Turk, Interactive collision detection for molecular graphics, TR90-014, University of North Carolina at Chapel Hill, 1990. S. Bandi, D. Thalmann, An adaptive spatial subdivision of the object space for fast collision detection of animating rigid bodies, Proc. of Eurographics, pp. 259-270, 1995. A. Gregory, M. Lin, S. Gottschalk, R. Taylor, H-COLLIDE: A framework for fast and accurate collision detection for haptic interaction, TR98-032, University of North Carolina at Chapel Hill, 1998. S. Melax, Dynamic plane shifting BSP traversal, Proc. Graphics Interface, pp. 213-220, 2000. M. Teschner, B. Heidelberger, M. Mueller, D. Pomeranets, M. Gross, Optimized Spatial Hashing for Collision Detection of Deformable Objects, Proc. Vision, Modeling, Visualization VMV 03, pp. 47-54, Nov 2003. University of Freiburg Computer Science Department Computer Graphics - 36