Simulation in Computer Graphics Space Subdivision. Matthias Teschner

Similar documents
Collision Detection based on Spatial Partitioning

Intersection Acceleration

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

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

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

Collision Detection with Bounding Volume Hierarchies

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

Spatial Data Structures

Spatial Data Structures

Computer Graphics Ray Casting. Matthias Teschner

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

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

Spatial Data Structures

Spatial Data Structures

Spatial Data Structures

Acceleration Data Structures

Algorithms for GIS:! Quadtrees

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

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

BALANCED SPATIAL SUBDIVISION METHOD FOR CONTINUOUS COLLISION DETECTION

Ray Tracing Acceleration Data Structures

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

Collision and Proximity Queries

Bounding Volume Hierarchies

9. Visible-Surface Detection Methods

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

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

VIII. Visibility algorithms (II)

Geometric Representations. Stelian Coros

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

Real-Time Collision Detection for Dynamic Virtual Environments

Ray Tracing: Intersection

Collision Detection. Pu Jiantao.

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

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

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

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

Advanced 3D-Data Structures

Collision handling: detection and response

Consistent Penetration Depth Estimation for Deformable Collision Response

improving raytracing speed

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

Speeding up your game

Computer Graphics. Bing-Yu Chen National Taiwan University

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

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

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

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

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

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

Deformable Proximity Queries and their Application in Mobile Manipulation Planning

11 - Spatial Data Structures

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

Implicit Surfaces & Solid Representations COS 426

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

Lecture 11: Ray tracing (cont.)

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

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

Speeding Up Ray Tracing. Optimisations. Ray Tracing Acceleration

Data Structures and Algorithms

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

DiFi: Distance Fields - Fast Computation Using Graphics Hardware

Principles of Computer Game Design and Implementation. Revision Lecture

More Hidden Surface Removal

Computer Graphics II

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

MODELING AND HIERARCHY

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

Spatial Data Structures for Computer Graphics

DISTRIBUTED AND COLLABORATIVE SYNTHETIC ENVIRONMENTS

A Survey on Collision Detection Techniques for Virtual Environments

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

CPSC GLOBAL ILLUMINATION

CS535 Fall Department of Computer Science Purdue University

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

Lesson 05. Mid Phase. Collision Detection

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

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

Recall: Inside Triangle Test

Hidden surface removal. Computer Graphics

Graphics 2009/2010, period 1. Lecture 8: ray tracing

3D Representation and Solid Modeling

Visibility and Occlusion Culling

Exact distance computation for deformable objects

CS-235 Computational Geometry

Binary Space Partition Trees. Overview. Binary Space Partitioning Trees (Fuchs, Kedem and Naylor `80)

Geometric Algorithms. Geometric search: overview. 1D Range Search. 1D Range Search Implementations

Subdivision Of Triangular Terrain Mesh Breckon, Chenney, Hobbs, Hoppe, Watts

Accelerated Raytracing

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

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

Surgical Cutting on a Multimodal Object Representation

Animating cuts with on-the-fly re-meshing

COMP 175: Computer Graphics April 11, 2018

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

Deformable Distance Fields for Simulation of Non- Penetrating Flexible Bodies

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

8. Hidden Surface Elimination

CEng 477 Introduction to Computer Graphics Fall 2007

Ray Tracing Acceleration. CS 4620 Lecture 20

Transcription:

Simulation in Computer Graphics Space Subdivision Matthias Teschner

Outline Introduction Uniform grid Octree and k-d tree BSP tree University of Freiburg Computer Science Department 2

Model Partitioning (1) Bounding volumes (2) Bounding volume tree (3) Collision detection test University of Freiburg Computer Science Department 3

Model vs. Space Partitioning Model partitioning Space partitioning University of Freiburg Computer Science Department 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 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 6

Outline Introduction Uniform grid Octree and k-d tree BSP tree University of Freiburg Computer Science Department 7

Basic Idea Space is divided into cells Object primitives are placed into cells Object primitives in 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 8

Context Collision detection for deformable objects Tetrahedral meshes Uniform 3D grid Non-uniform distribution of object primitives and unbounded simulation domain (Hashing) Detection of collisions and self-collisions Discussion of parameters University of Freiburg Computer Science Department 9 Epidaure, INRIA NCCR Co-Me

Setup Infinite uniform grid Hash function: H(cell) hash table index Hash table... Spatial data structure Representation / implementation University of Freiburg Computer Science Department 10

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

... Stage 2 All tetrahedrons are hashed according to the cells touched by their bounding box University of Freiburg Computer Science Department 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 13

Vertex-in-Tetrahedron Test Barycentric coordinates Oriented faces Barycentric coordinates more efficient They also provide useful collision information University of Freiburg Computer Science Department 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 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 16

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

Hash Table Size Hash collisions reduce the performance Larger hash table can reduce hash collisions test scenario [Teschner, Heidelberger et al. 2003] University of Freiburg Computer Science Department 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 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 University of Freiburg Computer Science Department 20 test scenarios 100 50000 24200 174 Pentium 4, 1.8GHz

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 University of Freiburg Computer Science Department 21

Summary Uniform Grid 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 22

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] 3D grid + hashing, rigid collision detection Cyrus Levinthal, MIT University of Freiburg Computer Science Department 23

Outline Introduction Uniform grid Octree and k-d tree BSP tree University of Freiburg Computer Science Department 24

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 25

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 26

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

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 28

Outline Introduction Uniform grid Octree and k-d tree BSP tree University of Freiburg Computer Science Department 29

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 30 BSP tree

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 31

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

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 33

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 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 34 3 Viewpoint 2b + 1 1 2b 4 3 4 2a 2a + - + - - BSP tree

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 35

Summary Uniform grid Octree and k-d tree BSP tree University of Freiburg Computer Science Department 36

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 37