UNIVERSIDADE FEDERAL DO RIO DE JANEIRO Some techniques to Speed up Collision Detection Yalmar Ponce...

39
UNIVERSIDADE FEDERAL DO RIO DE JANEIRO Some techniques to Speed up Collision Detection Yalmar Ponce Atencio LCG/PESC/COPPE

Transcript of UNIVERSIDADE FEDERAL DO RIO DE JANEIRO Some techniques to Speed up Collision Detection Yalmar Ponce...

Page 1: UNIVERSIDADE FEDERAL DO RIO DE JANEIRO Some techniques to Speed up Collision Detection Yalmar Ponce Atencio LCG/PESC/COPPE.

UNIVERSIDADE FEDERAL DO RIO DE JANEIRO

Some techniques to Speed up Collision Detection

Yalmar Ponce Atencio

LCG/PESC/COPPE

Page 2: UNIVERSIDADE FEDERAL DO RIO DE JANEIRO Some techniques to Speed up Collision Detection Yalmar Ponce Atencio LCG/PESC/COPPE.

UNIVERSIDADE FEDERAL DO RIO DE JANEIRO

Problem

Given a large environment with moving objects,

Detect overlapping objectsOverlapping triangles in each pair

Page 3: UNIVERSIDADE FEDERAL DO RIO DE JANEIRO Some techniques to Speed up Collision Detection Yalmar Ponce Atencio LCG/PESC/COPPE.

UNIVERSIDADE FEDERAL DO RIO DE JANEIRO

Goal

Interactive collision detectionbetween complex objects

Large number of objectsHigh primitive count Non-convex objectsOpen and closed objectsDeformable objects•Changing topology

Page 4: UNIVERSIDADE FEDERAL DO RIO DE JANEIRO Some techniques to Speed up Collision Detection Yalmar Ponce Atencio LCG/PESC/COPPE.

UNIVERSIDADE FEDERAL DO RIO DE JANEIRO

Related Work

Collision detectionHardware accelerated techniquesObject space techniquesTwo phases

Broad phase – Compute object pairs in close proximity Narrow phase – Check each pair for exact collision detection

Page 5: UNIVERSIDADE FEDERAL DO RIO DE JANEIRO Some techniques to Speed up Collision Detection Yalmar Ponce Atencio LCG/PESC/COPPE.

UNIVERSIDADE FEDERAL DO RIO DE JANEIRO

Related WorkBroad phase

Spatial partitioningSweep-and-prune

Narrow phaseSpatial partitioningBounding volume hierarchies

Surveys [Klosowski 1998, Lin and Manocha 2003, Redon et al. 2002, Andrew Nealen et al. 2005]

Page 6: UNIVERSIDADE FEDERAL DO RIO DE JANEIRO Some techniques to Speed up Collision Detection Yalmar Ponce Atencio LCG/PESC/COPPE.

UNIVERSIDADE FEDERAL DO RIO DE JANEIRO

Limitations of Object-space Techniques

Considerable pre-processingHard to achieve real-time performance on complex deformable models

Page 7: UNIVERSIDADE FEDERAL DO RIO DE JANEIRO Some techniques to Speed up Collision Detection Yalmar Ponce Atencio LCG/PESC/COPPE.

UNIVERSIDADE FEDERAL DO RIO DE JANEIRO

Collision Detection using Graphics Hardware

Primitive rasterization – sorting in screen-space

Interference tests• NV_OCCLUSION_QUERY• Requires high screen resolution

Page 8: UNIVERSIDADE FEDERAL DO RIO DE JANEIRO Some techniques to Speed up Collision Detection Yalmar Ponce Atencio LCG/PESC/COPPE.

UNIVERSIDADE FEDERAL DO RIO DE JANEIRO

Image Space TechniquesUse of graphics hardware

CSG rendering [Goldfeather et al. 1989, Rossignac et al. 1990]Interferences and cross-sections [Baciu et al. 1998, Myszkowski 1995, Rossignac et al. 1992, Shinya and Forgue 1991]Virtual Surgery [Lombardo et al. 1999]Minkowski sums [Kim et al. 2001]Cloth animation [Vassilev et al. 2001]Proximity computation [Hoff et al. 2001, 2002]CULLIDE, R-CULLIDE, Q-CULLIDE[Govindaraju et al. 2003-2005]

Page 9: UNIVERSIDADE FEDERAL DO RIO DE JANEIRO Some techniques to Speed up Collision Detection Yalmar Ponce Atencio LCG/PESC/COPPE.

UNIVERSIDADE FEDERAL DO RIO DE JANEIRO

Limitations of Current Approaches

Closed modelsFrame buffer readbacks – slow

Page 10: UNIVERSIDADE FEDERAL DO RIO DE JANEIRO Some techniques to Speed up Collision Detection Yalmar Ponce Atencio LCG/PESC/COPPE.

UNIVERSIDADE FEDERAL DO RIO DE JANEIRO

Outline

OverviewPruning AlgorithmHashedOctreeImplementation and ResultsConclusions and Future Work

Page 11: UNIVERSIDADE FEDERAL DO RIO DE JANEIRO Some techniques to Speed up Collision Detection Yalmar Ponce Atencio LCG/PESC/COPPE.

UNIVERSIDADE FEDERAL DO RIO DE JANEIRO

Outline

OverviewPruning TechniquesHashedOctreeImplementation and ResultsConclusions and Future Work

Page 12: UNIVERSIDADE FEDERAL DO RIO DE JANEIRO Some techniques to Speed up Collision Detection Yalmar Ponce Atencio LCG/PESC/COPPE.

UNIVERSIDADE FEDERAL DO RIO DE JANEIRO

Overview

Potentially Colliding Set (PCS) computationExact collision tests on the PCS using a HashedOctree

Page 13: UNIVERSIDADE FEDERAL DO RIO DE JANEIRO Some techniques to Speed up Collision Detection Yalmar Ponce Atencio LCG/PESC/COPPE.

UNIVERSIDADE FEDERAL DO RIO DE JANEIRO

Technique

Object LevelPruning

Sub-objectLevel

PruningExact Tests

GPU based PCS computation

Using CPU

Page 14: UNIVERSIDADE FEDERAL DO RIO DE JANEIRO Some techniques to Speed up Collision Detection Yalmar Ponce Atencio LCG/PESC/COPPE.

UNIVERSIDADE FEDERAL DO RIO DE JANEIRO

Potentially Colliding Set (PCS)

PCS

Scene

Page 15: UNIVERSIDADE FEDERAL DO RIO DE JANEIRO Some techniques to Speed up Collision Detection Yalmar Ponce Atencio LCG/PESC/COPPE.

UNIVERSIDADE FEDERAL DO RIO DE JANEIRO

Outline

OverviewPruning TechniquesHashedOctreeImplementation and ResultsConclusions and Future Work

Page 16: UNIVERSIDADE FEDERAL DO RIO DE JANEIRO Some techniques to Speed up Collision Detection Yalmar Ponce Atencio LCG/PESC/COPPE.

UNIVERSIDADE FEDERAL DO RIO DE JANEIRO

Pruning Techniques

Occlusion queriesBack-face culling

Convex modelsView volume culling

glSelectBuffer()

Page 17: UNIVERSIDADE FEDERAL DO RIO DE JANEIRO Some techniques to Speed up Collision Detection Yalmar Ponce Atencio LCG/PESC/COPPE.

UNIVERSIDADE FEDERAL DO RIO DE JANEIRO

View volume culling

Using AABBs

Page 18: UNIVERSIDADE FEDERAL DO RIO DE JANEIRO Some techniques to Speed up Collision Detection Yalmar Ponce Atencio LCG/PESC/COPPE.

UNIVERSIDADE FEDERAL DO RIO DE JANEIRO

A

B

Improvements

Using OBBsTransform B for A orientationUse OBBB as cliping planesPCSB

Page 19: UNIVERSIDADE FEDERAL DO RIO DE JANEIRO Some techniques to Speed up Collision Detection Yalmar Ponce Atencio LCG/PESC/COPPE.

UNIVERSIDADE FEDERAL DO RIO DE JANEIRO

Outline

OverviewPruning TechniquesHashedOctreeImplementation and ResultsConclusions and Future Work

Page 20: UNIVERSIDADE FEDERAL DO RIO DE JANEIRO Some techniques to Speed up Collision Detection Yalmar Ponce Atencio LCG/PESC/COPPE.

UNIVERSIDADE FEDERAL DO RIO DE JANEIRO

CreationHierarchical• Recursively

Hash [N.A.Gumerov et al. 2003]• From hierarchical

Octree or Using a generated Key

• Key is generated from parent nodes

• Hash table uses k mod 2b (b last bits)

Octree x HashedOctree

1

101

110100

111

11000

11100

10111

10100

11101

11110

10101

10110

11001

11010

1111

11011

Page 21: UNIVERSIDADE FEDERAL DO RIO DE JANEIRO Some techniques to Speed up Collision Detection Yalmar Ponce Atencio LCG/PESC/COPPE.

UNIVERSIDADE FEDERAL DO RIO DE JANEIRO

Search in Octree

p

Hierarchicalrecursive

Page 22: UNIVERSIDADE FEDERAL DO RIO DE JANEIRO Some techniques to Speed up Collision Detection Yalmar Ponce Atencio LCG/PESC/COPPE.

UNIVERSIDADE FEDERAL DO RIO DE JANEIRO

Search in HashedOctree

p

Direct accessUsing key node

Page 23: UNIVERSIDADE FEDERAL DO RIO DE JANEIRO Some techniques to Speed up Collision Detection Yalmar Ponce Atencio LCG/PESC/COPPE.

UNIVERSIDADE FEDERAL DO RIO DE JANEIRO

Outline

OverviewPruning TechniquesHashedOctreeImplementation and ResultsConclusions and Future Work

Page 24: UNIVERSIDADE FEDERAL DO RIO DE JANEIRO Some techniques to Speed up Collision Detection Yalmar Ponce Atencio LCG/PESC/COPPE.

UNIVERSIDADE FEDERAL DO RIO DE JANEIRO

HashedOctree

Morton keyGenerated recursivelyKey is computed using Interleaving• k(n) = xlylzlxl-1yl-1zl-1…x1y1z1

• l is the level of the octreeInterleaving is achieved by “OR”ing

Page 25: UNIVERSIDADE FEDERAL DO RIO DE JANEIRO Some techniques to Speed up Collision Detection Yalmar Ponce Atencio LCG/PESC/COPPE.

UNIVERSIDADE FEDERAL DO RIO DE JANEIRO

B

A

Potentially Colliding Setx HashedOctree

Each object have a HashedOctree

PCSB = trgls_in(OBBA OBBB)

Exact test PCSB x HashedOctreeA

Page 26: UNIVERSIDADE FEDERAL DO RIO DE JANEIRO Some techniques to Speed up Collision Detection Yalmar Ponce Atencio LCG/PESC/COPPE.

UNIVERSIDADE FEDERAL DO RIO DE JANEIRO

Algorithm

CSA = CSB = foreach (tB in PCSB){ PCSA = foreach (p in tB) PCSA HashedOctreeA.searchElems(p) if (PCSA ) foreach (tA in PCSA) if (tA tB){ CSA tA

CSB tB }}

Page 27: UNIVERSIDADE FEDERAL DO RIO DE JANEIRO Some techniques to Speed up Collision Detection Yalmar Ponce Atencio LCG/PESC/COPPE.

UNIVERSIDADE FEDERAL DO RIO DE JANEIRO

Results

Page 28: UNIVERSIDADE FEDERAL DO RIO DE JANEIRO Some techniques to Speed up Collision Detection Yalmar Ponce Atencio LCG/PESC/COPPE.

UNIVERSIDADE FEDERAL DO RIO DE JANEIRO

Results

Page 29: UNIVERSIDADE FEDERAL DO RIO DE JANEIRO Some techniques to Speed up Collision Detection Yalmar Ponce Atencio LCG/PESC/COPPE.

UNIVERSIDADE FEDERAL DO RIO DE JANEIRO

Results

Page 30: UNIVERSIDADE FEDERAL DO RIO DE JANEIRO Some techniques to Speed up Collision Detection Yalmar Ponce Atencio LCG/PESC/COPPE.

UNIVERSIDADE FEDERAL DO RIO DE JANEIRO

Results

Page 31: UNIVERSIDADE FEDERAL DO RIO DE JANEIRO Some techniques to Speed up Collision Detection Yalmar Ponce Atencio LCG/PESC/COPPE.

UNIVERSIDADE FEDERAL DO RIO DE JANEIRO

Results

Page 32: UNIVERSIDADE FEDERAL DO RIO DE JANEIRO Some techniques to Speed up Collision Detection Yalmar Ponce Atencio LCG/PESC/COPPE.

UNIVERSIDADE FEDERAL DO RIO DE JANEIRO

Results

Page 33: UNIVERSIDADE FEDERAL DO RIO DE JANEIRO Some techniques to Speed up Collision Detection Yalmar Ponce Atencio LCG/PESC/COPPE.

UNIVERSIDADE FEDERAL DO RIO DE JANEIRO

Results

Page 34: UNIVERSIDADE FEDERAL DO RIO DE JANEIRO Some techniques to Speed up Collision Detection Yalmar Ponce Atencio LCG/PESC/COPPE.

UNIVERSIDADE FEDERAL DO RIO DE JANEIRO

Results

Tests on a Pentium M 2.0Ghz with ATI X600 128Mb PCIe and 1Gb RAM

Hierarchical Octree

Depth Level 10

Hashed Octree Depth Level

10

Search a Point

Cow 4315 Triangles 8626 Faces

9-11 us 4-4.5 us

Dragon 48581 Triangles 93286 Faces

14-19 us 4-4.9 us

Exact intersection Triangle-Triangle

Torus x Torus632 Triangles 1264 Faces

12-120 us 5-39 us

Cow x Torus 45-390 us 15-99 us

Page 35: UNIVERSIDADE FEDERAL DO RIO DE JANEIRO Some techniques to Speed up Collision Detection Yalmar Ponce Atencio LCG/PESC/COPPE.

UNIVERSIDADE FEDERAL DO RIO DE JANEIRO

Outline

OverviewPruning TechniquesHashedOctreeImplementation and ResultsConclusions and Future Work

Page 36: UNIVERSIDADE FEDERAL DO RIO DE JANEIRO Some techniques to Speed up Collision Detection Yalmar Ponce Atencio LCG/PESC/COPPE.

UNIVERSIDADE FEDERAL DO RIO DE JANEIRO

Conclusions and Future Work

ConclusionsEarlier image based collision detection approaches present some limitations (Screen Resolution).Object level Pruning and Sub-object pruning are required.Hashed Octree reduces a query up to 80% over hierarchical Octree.

Future WorkGeometric models can be mapped efficiently on images (Geometry Images).Geometry images allow to generate Octrees and volume hierarchies in real-time on current GPUs.

Page 37: UNIVERSIDADE FEDERAL DO RIO DE JANEIRO Some techniques to Speed up Collision Detection Yalmar Ponce Atencio LCG/PESC/COPPE.

UNIVERSIDADE FEDERAL DO RIO DE JANEIRO

Thanks all folks!

Page 38: UNIVERSIDADE FEDERAL DO RIO DE JANEIRO Some techniques to Speed up Collision Detection Yalmar Ponce Atencio LCG/PESC/COPPE.

UNIVERSIDADE FEDERAL DO RIO DE JANEIRO

Page 39: UNIVERSIDADE FEDERAL DO RIO DE JANEIRO Some techniques to Speed up Collision Detection Yalmar Ponce Atencio LCG/PESC/COPPE.

UNIVERSIDADE FEDERAL DO RIO DE JANEIRO

1

101

110100

111

11000

11100

10111

10100

11101

11110

10101

10110

11001

11010

1111

11011