bvh for cd

12
Bounding Volume Hierarchies for Collision Detection SH Tanalol, S Sulaiman, A Bade, School of Science & Technology, Universiti Malaysia Sabah Abstract In computer graphics, collision detection is considered as a bottleneck in most of important real- time simulation such as physical simulation. In this paper, we present an overview of collision detection and how essential it is in achieving a realistic interaction in real-time system. However, the key problem in collision detection has always been the expensive computational cost and also the accuracy. When two objects animated, the most obvious problem which arises is the O(n 2 ) problem of detecting collisions between all n objects. This is clearly undesirable property of any collision detection algorithm. Therefore, several techniques have been proposed to deal with this problem. One of the efficient solutions is using bounding volume hierarchies (BVH). The major advantages of bounding volume hierarchies are the fast query for interaction testing which will reduce the computation cost. Several popular BVHs also presented.

Upload: siti-hasnah-mea-tanalol

Post on 20-Jul-2016

239 views

Category:

Documents


1 download

DESCRIPTION

Bounding Volume Hierarchy for Collision Detection

TRANSCRIPT

Bounding Volume Hierarchies for Collision Detection

SH Tanalol, S Sulaiman, A Bade,

School of Science & Technology, Universiti Malaysia Sabah

Abstract

In computer graphics, collision detection is considered as a bottleneck in most of important real-

time simulation such as physical simulation. In this paper, we present an overview of collision

detection and how essential it is in achieving a realistic interaction in real-time system.

However, the key problem in collision detection has always been the expensive computational

cost and also the accuracy. When two objects animated, the most obvious problem which arises

is the O(n2) problem of detecting collisions between all n objects. This is clearly undesirable

property of any collision detection algorithm. Therefore, several techniques have been proposed

to deal with this problem. One of the efficient solutions is using bounding volume hierarchies

(BVH). The major advantages of bounding volume hierarchies are the fast query for interaction

testing which will reduce the computation cost. Several popular BVHs also presented.

1. Introduction

Graphic computing has been commonly used in various types of computer applications such as

in games, robotics, animation and virtual reality. Therefore, collision detection has become more

essential process in achieving a realistic and believable interaction between objects. There is no

doubt that the process involved in real-time collision detection is very complex and sometime,

however, less accurate. The need for efficient interference detection frequently arises in

computer graphics, robotics, virtual prototyping, surgery simulation, computer games, and

visualization. To prevent bodies passing directly through each other, the simulation system must

be able to track touching or intersecting geometric primitives.

Larsson (2009) suggested that the computing and maintaining proximity information between

objects are important as objects in real life do not normally penetrate and most of the interactions

between objects happen when they are near each other. Collision query need to be performed in

every simulation step in order to determine the collision and contact point between objects. This

often been the main cause for expensive computation cost, especially in large scale interactive

animations. Ensuring objects interact in the correct manner is very computationally intensive and

much research has addressed the issues involved with trying to reduce the computational

requirements by simplifying the representation of the objects in the scene. (C. Fares and Y.

Hamam, 2005)

The determination of contact between two geometric primitive is often an expensive operation.

In order to determine a collision between two primitives, the objects will be divided into millions

of triangles. For two objects with m and n triangles, computation of mn triangle-triangle

intersections will be needed. Therefore, given a scene with n moving primitives or bodies, the

number of unique body pairs that can be selected is

Thus, if considering all collision status of these bodies the methods suffers from the all-pair

weakness which will cause the interactive visual simulations to run very slow. Even if the

method executed is as simple as a sphere-sphere over lap test, just to find that there is no

collision occur, this would take O(n2) time and when n is too large it will become a

computational bottleneck. Normally, a dynamic scene is running at 30 frames per second. In

each frame it can be more than two objects colliding with each other. This will bring enormous

computation needs and at the same time need to make all the calculation as efficient as possible.

Therefore, the goal of any collision detection algorithm is to first reduce the number of object

pairs that must be considered using an efficient algorithm. Such an initial phase is often referred

to as the broad phase of the collision detection process (P. M. Hubbard 1995, J.D. Cohen et al

1995).

2. Collision Detection Pipeline

The primitive can be wrapped in a bounding volume (BV) to improve the computing

performance. By using BV the surface representation is able to be simplified for a fast

approximate collision detection test. This could be done by checking the information of the BV

whether the bounded primitives could interfere with each other.

The basic idea is to apply a test first to a simple bounding volume before using a time

consuming and exact test for the original object. If the simple test fails the complex test does not

need to be performed as it will fail as well.

Collision detection can be represented and built as a pipeline (P.M. Hubbard 1995) as

shown in Figure 1. Collision detection can be divided in to two main parts: broad-phase and

narrow-phase. The goal of this pipeline is to apply successive filters in order to break down the

O(n2) complexity.

Figure 1 : Collision detection pipeline (Q. Avril et al. 2010)

2.1 Broad Phase

Most efficient collision detection systems use this two-phase approach to reduce the

computational costs of making pairwise checks. The broad phase eliminate most of the pairs

using a trivial rejection test based on bounding boxes, bounding spheres, octrees, or other

methods, thus reducing the number of tests needed. The distance of each pairs on the screen can

be calculated and if the objects are too far away from each other, they can be eliminated as

potential collision. Otherwise, if they are close enough to create a potential collision, the objects

are paired. Some algorithms that can eliminate tests are Sweep and Prune and spatial hash. Both

come with O(n log(n)) cost.

Figure 2 : a) Objects are too far from each other to be tested for collisions, b) Objects are close to

each other and needs to be further tested for collision.

In the case of sphere bounding (Figure 3), this tests becomes a simple set of overlap tests

in terms of the unit axes. For a sphere defined by center, c and radius r, they do not intersect if

(c1 – c2) T (c1 – c2) >(r1+r2)

2.. Compared to other bounding volume, using sphere bounding, not

only intersections but also distances are calculated efficiently.

Figure 3 : Sphere Bounding (Stefan Kimmerle, 2005)

2.2 Narrow Phase

The pairs that survive this elimination are passed to the narrow phase, which uses a more

refined algorithm to check for collisions or to compute distances. The narrow-phase eliminates

(a) (b)

unnecessary collision detection checks and determines exact collisions as shown in Figure 4. In

this phase, more detailed information about occurring collision can be compute e. g. penetration

depth or force feedbacks.

Figure 4 : Point of collision (the red dot)

The biggest speedups come from the broad phase algorithm that reduce the number of

intersection tests that need to be performed for each collision detection. This saves a significant

amount of time in most cases. Since most of the computation is spent on performing intersection

tests, this has been the main target for optimization. The computation cost of this approach can

be formulated as follows (J. T. Klosowski et al, 1998):

T = Nv X Cv + Np X Cp + Nu X Cu + Co

Where

T: total execution time for detecting interference

Nv : number of BV pairs overlap tests

Cv : time require for testing a pair of bounding-volumes

Np : numbers of primitive pairs overlap tests

Cp : time require for testing a pair of primitives for interference

Nu : numbers of nodes that need to be updated

Cu : cost of updating each node

Co : Cost of one-time processing

3. Bounding Volume Hierarchy

Generally, collision detection algorithm can be divided into two main approaches : space

subdivision and bounding volume hierarchies. Among this two different approaches, the

bounding volume hierarchies (BVH) proved to be the most successful in contemporary system

(Fang Zhigang et al, 2010). BVH are one of the simplest, most widely used and a very efficient

data structures for performing collision detection for rigid bodies and to some extent, for

complex models such as deformable objects (J Klein & Zachmann, 2003). Besides it is the most

popular method for answering proximity and collision queries and therefore, often possible to

reduce the running time of a geometric query from, e.g., O(n) to O(log n) (Larsson, 2009).

A bounding volume hierarchy is a tree data structure on a geometric model H that stores

all the geometric primitives of H in the leaf nodes. Each node in the tree stores a volume that

encloses all the primitives located below it, i.e., in its subtree. In this way, the root node stores a

bounding volume (BV) enclosing all the primitives or the entire model. And the children nodes,

store BVs enclosing various subsets of the primitives or parts of the model in a wrapped

hierarchical way. Figure 5 below shows an example of BVH with primitives containing in BV.

The collision detection will be done by visiting the all the nodes one by one according to

traversal algorithm such as Breadth-First or Depth-First traversal. The bounding volume

hierarchies of two objects are traversed recursively. The recursion stops at the leaves and at

disjoint bounding volumes. Whenever two BVs overlap, one of them is tested against the

children of the other one.

For example, given two objects with their BVH, when root of the hierarchies do not

intersect, the calculation will not be done for both objects. However, when roots of both

hierarchies intersect, it will check for intersection between roots of one of the hierarchy’s tree

with the children of the other hierarchy’s tree. In this case, it recursively checks again whether

there is intersection between both objects at middle level until the correct intersection is found.

Figure 5: An example of a Bounding Volume Hierarchy with primitives containing Bounding

Volumes. (Zachmann, 2003)

3.1 Bounding Volume

There are many different geometric primitives have been used for constructing the

Bounding Volume Hierarchies (BVH) used to perform narrow phase processing. These include:

Spheres (Quinlan 1994; Palmer and Grimsdale 1995; Hubbard 1995; O’Sullivan and Dingliana

1999), Axis Aligned Bounding Boxes (AABB) (van Den Bergen, 2004), Oriented Bounding

Boxes (OBB) (Gottschalk et al. 1996; Krishnan et al. 1998), Discrete Oriented Polytopes (k-

DOP) (Klosowski et al. 1998), Quantised Orientation Slabs with Primary Orientations

(QuOSPO) (He 1999), Spherical Shells (Krishnan et al. 1998) and Sphere Swept Volumes (SSV)

(Larsen et al. 1999). Common BV used in BVH are as depicted in Figure 6 below.

Figure 6 : Common BV in previous researches (Suaib et al., 2008, Bade et al., 2006)

There is often a trade-off between the complexity of the bounding volume primitive and

the tightness of fit that can be achieved. Simpler primitives, such as spheres and AABBs, are

quite inexpensive to test for intersections. However, as they provide relatively poor

approximations, large numbers are often required to approximate the objects effectively. More

complex bounding volume primitives require more expensive intersection tests but, as they often

provide tighter approximations, fewer primitives (and hence intersection tests) are required. The

complexity involved in query test is as describe as in this Figure 6 below.

Figure 6: The tests complexity for BV

3.2 Hierarchy Construction

Besides choosing an appropriate type of bounding volume, a tree-building algorithm must

also be selected. Normally, the input consists of a set of geometric primitives, and the output

is a partitioning (decomposition) of these primitives into a regular tree data structure, where

each tree node stores a BV enclosing all the primitives in its subtree. However, since the

number of structurally different BVHs that can be produced grows exponentially with the

number of input primitives, finding a globally optimal tree structure is considered difficult.

Instead, many different heuristics have been developed which can be categorized into

three main types of hierarchy construction algorithms; top-down using divide-and-conquer

algorithm, bottom-up using merge and clustering algorithm and incremental insertion

construction methods. For large data sets, a simple top-down or an incremental insertion

method is preferred.

4. Conclusion

For the past two decades, collision detection has drawn tremendous interest among

researchers. In this paper, the O(n2) problem of detecting collisions between all objects can

be simplify by dividing the process into two phases: broad phase and narrow phase. From

there, the object then partitioned into hierarchical representation using existing BVH

algorithms. Most of researches done agreed that BVHs are well-suited for real time

simulation or interactive applications, since efficient methods for creation, updating and

collision tests are available. Furthermore, optimization is still remain an important issue to

collision detection although the CPU technology has undergone great advancement. The

researches on finding an optimal hierarchical data structure for BVH have shown some

interest among the researchers recently.

References:

Bade, A., Suaib, N., A, M. Z. & M, T. S. T. 2006. Oriented convex polyhedra for collision

detection in 3D computer animation. Proceedings of the 4th international conference on

Computer graphics and interactive techniques in Australasia and Southeast Asia. Kuala Lumpur,

Malaysia: ACM.

Bergen, G. V. D. 2004. Collision Detection in Interactive 3D Environments, United States of

America, Elsevier, Inc.

Charbel Fares and Yskandar Hamam. 2005. Collision Detection for Rigid Bodies: A State of the

Art Review, International Conference Graphicon.

E. Larsen, S. Gottschalk, M. Lin, and D. Manocha. 1999. Fast proximity queries with swept

sphere volumes. Technical Report TR99-018, Dept. of Computer Science,University of North

Carolina.

Fang Zhigang et al. 2004. Efficient Collision Detection using Bounding Volume Hierarchies of

G. Bradshaw and C. O’Sullivan. Adaptive medial axis approximation for sphere-tree

construction. ACMTransactions on Graphics, 23(1):1–26.

Gabriel Zachmann, Günter Knittel. 2003. An Architecture for Hierarchical Collision Detection.

Visualization and Computer Vision'2003

James T. Klosowski, Martin Held, Joseph S.B. Mitchell, Henry Sowizral, Karel Zikan. 1998.

Efficient collision detection using bounding volume hierarchies of k-DOPs. IEEE Transactions

on Visualization and Computer Graphics.4( I )P:21-36.

Jan Klein & Gabriel Zachmann. 2003. ADB-Trees: Controlling the Error of Time-Critical

Collision Detection, VMV

Jonathan D. Cohen, Ming C. Lin, Dinesh Manocha, and Madhav Ponamgi.1995. I-COLLIDE:

an interactive and exact collision detection system for large-scale environments. In Proceedings

of the 1995 Symposium on Interactive 3D Graphics, pages 189–196. ACM Press.

P.M. Hubbard. 1995. Collision Detection for Interactive Graphics Applications, IEEE

TRANSACTIONS ON VISUALIZATION AND COMPUTER GRAPHICS, VOL. 1, NO. 3.

SEPTEMBER 1995. ISSN 1077-2626.

Q. Avril, V. Gouranton, and B. Arnaldi. Synchronization-free parallel collision detection

pipeline. In ICAT’2010, December 2010.

Stefan Kimmerle. 2005. Real-Time Collision Detection for Dynamic Virtual Environments.

Virtual Reality 2005, WSI/GRIS, University of Tübingen,

Suaib, N. M., Bade, A. & Mohamad D. 2008. Collision Detection Using Bounding-Volume for

avatars in Virtual Environment applications. The 4th International Conference on Information &

Communication Technology and Systems, August 2008 2008 Institut Teknologi Sepuluh

Nopember (ITS), Surabaya, Indonesia. 486 -491.

T. Larsson, 2009. PhD Thesis Adaptive Bounding Volume Hierarchies for Efficient Collision

Queries, M¨alardalen University Press Dissertations No.71