Docstoc

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

Document Sample
MUTI-LEVEL SB COLLIDE COLLISION AND SELF-COLLISION IN SOFT BODIES Powered By Docstoc
					   MUTI-LEVEL SB COLLIDE: COLLISION AND SELF-COLLISION
                     IN SOFT BODIES

                     Jaruwan Mesit             Ratan K. Guha              Erin J. Hastings
                  jmesit@cs.ucf.edu           guha@cs.ucf.edu           hastings@cs.ucf.edu
                         Department of computer science, University of Central Florida
                             4000 Central Florida Blvd., Orlando, Florida 32826.


Keywords                                                  proposed whereas Separation-sensitive collision
                                                          detection (Erickson et al. 1999) was presented for
soft body simulation, animation, spatial                  convex objects.
subdivision, spatial hashing
                                                                    Another method for collision detect is
                                                          spatial subdivision. Numerous variations have been
Abstract                                                  proposed such as: octtree (Moore and Wilhelms.
                                                          1988), BSP tree (Naylor et al. 1990), brep-indices
          In interactive 3D graphics collision            (Bouma and Vanecek, Jr 1991), k-d tree (Held et al.
detection of soft bodies in real time is a significant    1995), bucket tree (Ganovelli 2000), hybrid tree
problem. It is time consuming because soft bodies         (Larsson et al. 2001), and uniform spatial
are composed of possibly thousands of moving              subdivision (Teschner et al. 2003). Some additional
particles. Each time step all particles rearrange in      subdivision methods specifically suited for collision
new positions according to their behaviors and            detection in large environments are I- COLLIDE
collision must be detected for each particle. To          (Cohen et al. 1995) and CULLIDE (Govindaraju et
optimize collision detection in soft bodies, we           al. 2003).
introduce a solution called Multi-Level SB Collide.
The method relies on the construction of subdivided                However, most of the methods that have
bounding boxes, box hash functions, and contact           been mentioned are to solve collision detection
surfaces. Multi-level SB collide applies multi-level      between rigid bodies and other rigid bodies, or
subdivided bounding boxes (AABBs) into a box              between soft bodies and rigid bodies, which is
hash function and uses contact surface method to          slightly less complex problem. In this paper we
detect collision. This contact surface can be used to     present a new efficient algorithm for collision
detect both collision with other objects and self-        detection among soft bodies, which is extended
collision in soft bodies. Experimental results show       from Mesit et al. 2004. The algorithm is based on
that multi-level SB Collide is an accurate and            the classical methods of subdivided bounding
efficient method for real-time collision detection in     volume and spatial hashing. The major contribution
soft bodies.                                              of this paper includes: 1) subdivided bounding box
                                                          method, 2) the specialized hash function, and 3) the
                                                          contact surfaces.
1. Introduction
                                                                   The paper will proceed as follows: first,
          Collision detection is a fundamental issue      an overview of the proposed algorithm, next
in most all forms computer animation. Many                analysis of the algorithm, then a set of the
algorithms are based upon types of bounding               experiments with the algorithm and results, and
volume hierarchies. Some notable examples are:            finally conclusions and discuss possibilities of
bounding spheres (Hubbard 1995, James and Pai             further work.
2004), axis-aligned bounding boxes (AABBs)
(Bergen 1997, Teschner et al. 2003), oriented
bounding boxes (OBBs) (Gottschalk et al. 1996),
quantized orientation slabs with primary
orientations (QuOSPOs) (He 1999), and discrete-
oriented polytopes (K-DOPs) (Klosowski et al.
1998). For polyhedral objects, CLOD with dual
hierarchy (Otaduy and Lin 2003) has been also
                                                         those two vertices. Figure 3 shows compressed
                                                         spring and stretched spring.




Figure 1: The skeleton of a soft body object where
the vertices are moving particles interconnected by
                   force springs.

1.1 Introduction to soft body simulation
                                                         Figure 3: Spring structure for soft body simulation
          A soft body simulation is usually a set of                    with rest length = d
particles, each of which has its own position,
velocity, and force. Particles are connected to
neighbors by linear springs. Spring length,              2. Algorithm Overview
elasticity, and damping factor are defined by
physical properties of the soft body. Figure 1 shows              For collision detection with soft bodies in
a skeleton of cloth and figure 2 presents two more       a large environment, we introduce three steps of the
types of springs called shear and bend to simulate a     Multi-Level SB Collide algorithm:
soft body. The shear and bend properties are
required to allow the soft body to stretch in and out.   1) Multi-level Subdivided Bounding Box (Multi-
                                                         level SB): all soft bodies are surrounded by a
                                                         bounding box (AABB) for tracking. Two points, a
                                                         minimum and a maximum, define the bounding
                                                         box. Then, the bounding box is subdivided to n-
                                                         levels of sub division. We use 3-level subdivision
                                                         for this simulation.

                                                         2) Box Hash Function (BHF): we apply the box
                                                         hash function to each point that we use to create the
                                                         subdivided bounding box. One subdivided
                                                         bounding box has 8 points. Each point is hashed
                                                         and given hash index by box hash function. List of
                                                         subdivided bounding boxes is put in hash table
 Figure 2: Shear and bend properties used in soft        related to hash index. Then, we compute contact
                body simulation                          surface from vertices that belong to subdivided
                                                         bounding box in the list of hash table.
1.2 Springs and Dampers
                                                         3) Collision for Flexible Models (CF): finally we
          Springs are the structures that connect        detect collision for the models. If distance between
between two vertices. The function that we use to        points in the flexible models is less than collision
stretch or compress is spring force by Hook’s law.       tolerance, collision for flexible models is detected.
This relates to the “rest length” of the spring and a
“spring constant”. The spring constant determines        2.1 Multi-level Subdivided Bounding Boxes
the stiffness of the spring. Damper is related to        (Multi-level SB)
velocity of vertices, since each vertex has its own
force and velocity. Damper acts against this                      The beginning of our algorithm is to do
velocity. If there are two vertices connected with       tracking with multi-level subdivided bounding box.
springs, dampers slow the relative velocity between      We are tracking our soft bodies by using AABB
                                                         bounding box. Minimum point and maximum point
are calculated to bound our soft body. The                      0                1
bounding box is subdivided in to 2n regions, where     3            2
n is level of subdivision. Figure 4 shows 2-level of
subdivision in which the second mid point is                    4            5
created from the first mid point.
                                                           7
                                                                        6

                                                           Figure 6: Points of subdivided bounding box are
                                                                      hashed by hash function
                                Mid points

                                                       Since there are 8 points, [0..7], in one subdivided
                                                       bounding box, BHF can be written as:

                                                       HashIndex = (floor(point[0..7].x /length) *
                                                                     xprime+
        Figure 4: Mid points for subdivision                         floor(point[0..7].y /height) *
                                                                     yprime +
        These objects are subdivided by using the                    floor(point[0..7].z /width) *
midpoint. Then, we find depth, height, and depth of                  zprime) % bucketsize
each subdivided bounding box as shown in figure 5.     where xprime, yprime, and zprime are any prime
                                                       number for x, y, and z
                                                        length, height, and width are length, height, and
                                                       width of grid cell.

                                                       When we have the hash index, we can put the
                                                       subdivided objects to hash table. At this step, we
                                                       create one hash table and we have the list of
                                                       subdivided objects that have chances of collision.
                                                       Figure 7 and 8 show that subdivided box 2 (SB2)
                                                       and 3 (SB3) are in the same hash index which is
                                                       index 6. Then, contact surface will be calculated.
 Figure 5: 8 points for a subdivided bounding box
                                                           0            1            2           3
2.2 Box Hash Function (BHF)

          We use Box Hash Function (BHF). The
idea is to use BHF and hash to 8 points that we use        4            5                6       7
to create the subdivided bounding box. To facilitate                         SB 2
hashing, initially a hash table is created which is                                                  SB 3
based on grid size. The formula is as follows:             8            9            10          11

Index = ( floor(Grid.min.x / length) * xprime+
          floor(Grid.min.y/ height) * yprime +
          floor(Grid.min.z / width) * zprime)
          % bucketsize;
                                                           12           13
where  length is grid length,
       height is grid height,                              Figure 7: The combination of grid and box hash
       width is grid width,                                                  function
       Grid.min.x, Grid.min.y, and Grid.min.z are
minimum points of each grid,
       xprime, yprime, and zprime are any prime
number for x, y, and z.

Next, we apply BHF to 8 points of our subdivided
bounding box shown in figure 6.
                                                          2.4 Self-collision in flexible object (SCF)
                                                                    For every soft body object, it is necessary
                                                          to solve self-collisions for internal constraints. Self-
                                                          collision in soft bodies can be achieved by using the
                                                          contact surfaces. The method of self-collision
                                                          avoidance is to create collision tolerance around the
                                                          points of flexible object. This collision tolerance
                                                          force acts like a shield which rejects the points
                                                          passing through the objects. Thus our algorithm
                                                          solves for both self-collision detection and normal
                                                          collision detection.
   Figure 8: Example of box hash table. Index 6
         points to subdivided box 2 and 3                           To summarize the algorithm, three major
                                                          steps are computed for collision detection in every
                                                          frame. First, the bounding boxes are subdivided
2.3 Self-collision and Collision for flexible             into n-level of subdivision (3 levels in this
models (SCF and CF)                                       simulation). Then, we apply the box hash function
                                                          to subdivided bounding boxes and create hash
          In this step we find the distances of           table. Finally, for each box hash table, we compute
vertices in the hash table and then we compare with       the contact surface to the vertices in the subdivided
a collision tolerance. This step returns true or false.   bounding box. As a property hash table we consider
True is colliding while false is not colliding.           more than a single pair of collisions. Thus multiple
Contact surface can be determined as follows:             soft bodies are detected for collision in a large
                                                          simulation environment.
Given position of object A and B, d is the distance
between them. If they are in same hash table, then        3. Analysis
we find for d. if d < collision tolerance, then they
collide.                                                  First we analyze the method with regard to time
                                                          complexity. Since the proposed method is using
                                                          hash table, performance depends on subdivided
                       Object B                           bounding box distribution in the scene.

                                                              •    Best Case: O(1). In this case every
           d                                                       subdivided bounding box hashes to a
                                                                   different grid cell. No collision will be
                         Object C
                                                                   performed at all.
      Object A                                                •    Worst Case: O(N2). In this case, every
                                                                   subdivided bounding box in the scene is in
Time t = n, d > collision tolerance, they don’t                    the same grid cell. N is number of vertices.
collide.
                                                          The benefit of subdivided bounding box is to
                  Object B
                                                          reduce cost of hash function. In stead of applying
                                                          hash function to N vertices in the scene, the
                                                          proposed method spend only O logn N.

           d                      Object C
                                                              •    Without subdivided bounding box: O(N).
                                                                   In this case every vertex has to be applied
                                                                   to hash function.
      Object A                                                •    With subdivided bounding box: O(logn N).
                                                                   In this case every vertex doesn’t have to
                                                                   apply to hash function. Only 8 points of
Time t = n+1, if d < collision tolerance, they
                                                                   subdivided bounding box have to be
collide.
                                                                   applied to hash function. N is the number
                                                                   of vertices and n is level of subdivision.
4. Experiments and Results                            according to detail in Maciej and Ollila, 2003. The
                                                      simulation has been captured at frame 100, 400,
                                                      600, and 800.




         Figure 9: structure of a soft body

         A simulation was developed using: Code
(C++), Graphics (OpenGL), and Compiler
(Microsoft Visual Studio). Figure 9 presents a soft
body which is created from 162 vertices and 320         Figure 11 At frame 400 a soft body object has
faces. We compare our proposed method to Grid                collided with the solid body sphere
Hash Function, and Bounding Box, Bounding Box
and Grid Hash Function. Four different scenarios
are created and called A, B, C, and D, in which all
soft bodies are falling down and colliding with a
sphere and ground surface shown in figures 10, 11,
12, and 13. There are 1k, 5k, 10k, and 15k faces in
scenario A, B, C, and D respectively. For the hash
table a bucket size of 101 is applied in scenario A
and B, while a bucket size of 1001 is created in
scenario C and D.




                                                         Figure 12: : At frame 600 multiple soft body
                                                       spheres have dropped upon each other, showing
                                                            both soft-soft and soft-solid collision




Figure 10: Frame 100 showing a solid body sphere
   (below) and a falling soft body object (above)

         Initially in Figure 10 there are a solid
sphere (below) and a soft body (above). Then the
soft body collides with the sphere as shown in
figure 11. Later on, there are more soft bodies
falling down and colliding with other soft bodies
presented in figure 12 and 13. They deform with          Figure 13: At frame 800 gravity and friction
vertices moving based on the laws of physics,          eventually drop the soft body objects to the floor
                                                        As for future work, it is possible to simplify the
M       Grid      Bounding     BoundingMulti-           operation process to optimize the algorithm that has
O       Hash          Box       Box and level           been implemented in this paper. Also, a tree
D     Function      (frame     Grid Hash SB             structure could possibly be implemented to
E      (frame         per       Function
                                       collide          determine the area of collision in the object body
L        per       second)     (frame per
                                       (frame           and perform the collision detection in the
      second)                    second) per            overlapped area. However, a tradeoff would be
                                      second)           introduced of additional time required to modify the
 A         20         22         40         70          tree structure in each time step.
 B         18         16         35         57
 C         14         13         31         49          6. References
 D         13         14         25         41
Table 1: The average running time (frame per            Bergen, G.V.D. 1997. “Efficient Collision Detection of Complex
second) in each model on a typical laptop:              Deformable Models Using AABB Trees.” Journal of Graphics
                                                        Tools 1997, vol. 2, Issue 4 (Apr.): 1-13.
Pentium-4 3.2Ghz, 1Gb RAM, Nvidia GForce Go
GPU.                                                    Bouma, W. and Vanecek, G. Jr. 1991 “Collision Detection and
                                                        Analysis in a Physical Based Simulation.” Eurographics
         The experiment shows that using only a         Workshop on Animation and Simulation 1991 (Vienna) 191-203.
grid hash function yielded worst performance for        Cohen, J.D., Lin, M.C., Manocha, D., and Ponamgi, M. 1995.
simulations A, B, C, and D. The bounding box            “I-COLLIDE: An Interactive and Exact Collision Detection
algorithm and combined bounding box with a grid         System for Large-Scale Environments.” Proceedings of the 1995
hash function gave slightly better results. Multi-      symposium on Interactive 3D graphics 1995 (Monterey, CA,
                                                        United States) 189-196.
Level SB Collide gave the best performance,
achieving significantly better frame rate in all four   Erickson, J., Guibas, L.J., Stolfi, J., and Zhang, L. 1999
scenarios. The results of all experiments show that     “Separation-Sentitive Collision Detection for Convex Objects.”
our algorithm can reduce time computation in            Proceedings of the tenth annual ACM-SIAM symposium on
                                                        Discrete algorithms 1999, Baltimore, Maryland , 327 – 336.
comparison to the other methods.
                                                        Ganovelli, F., Dingliana, J., and O’Sullivan, C. 2000.
5. Conclusions and Future Work                          “Buckettree: Improving Collision Detection between
                                                        Deformable Objects.” In Spring Conference in Computer
                                                        Graphics SCCG 2000 , Bratislava, 156-163.
          Multi-level SB collides presents the
concept of tracking with Multi-level Subdivided         Govindaraju, N.K., Redon, S., Lin, M.C., and Manocha, D.
Bounding box (Multi-level SB), box hash function        2003. “CULLIDE: Interactive Collision Detection Between
                                                        Complex Models in Large Environments using Graphics
(BHF), Self-collision and collision in contact          Hardware.” Siggraph Eurographics Graphics Hardware 2003
surface (SCF and CF). The main strength of the          (San Diego, CA, Jul. 26-27).
multi-level SB collide lies in the efficiency in
collision detection in soft bodies, only requiring      Gottschalk, S., Lin, M.C., and Manocha, D. 1996. “OBB Tree: A
                                                        Hierarchical Structure for Rapid Interference Detection.”
multi-level bounding boxes and applying into box        Preceeding of ACM Siggraph 1996 (New Orleans, Louisiana,
hash function. Our method essentially extends the       Aug. 4-6), 171-180.
existing approaches, multi-level subdivided
bounding box and box hash function, with the            He, T. 1999. “Fast Collision Detection Using QuOSPO Trees.”
                                                        Proceedings of the 1999 symposium on Interactive 3D graphics,
concept of contact surfaces. All soft bodies are        (Atlanta, Georgia, Apr. 26-29) , ACM 1999 55-62.
surrounded by a bounding box with maximum point
and maximum point. Then, box hash table is              Held, M., Klosowski, J.T., Mitchell, J.S.B. 1995. “Evaluation of
defined by subdivided bounding box and box hash         Collision Detection Methods for Virtual Reality Fly-Throughs.”
                                                        Proceedings Seventh Canadian Conference on Computational
function. The vertices in same box hash list are,       Geometry 1995, 205–210.
finally, observed for surface contact for self-
collision and collision. Another benefit of this        Hubbard, P.M. 1995. “Collision Detection for Interactive
algorithm is that we can consider more than one         Graphics Applications.” IEEE Transactions on Visualizationand
                                                        Computer Graphics 1995, 1(3):218–230.
pair of objects so that multiple, simultaneous soft
body collisions are detected in a large environment     James, D.L. and Pai, D.K. 2004. “BD-tree: Output-Sensitive
of simulation. The result of this work performed        Collision Detection for Reduced Deformable Models.” in
with 10-15k faces showed that this algorithm is         Proceedings of ACM SIGGRAPH 2004, ( Los Angeles, CA ,Aug
                                                        8-12).
efficient for detecting collision for soft bodies in
real-time considering the time spent for animation.
Mesit, J.; Guha, R.;Hastings, E., 2004 “Optimized Collision         Maciej, M. and Ollila, M., ‘Pressure Model of Soft Body
Detection For Flexible Objects”. International Conference on        Simulation’, SIGRAD2003, November 20-21, 2003
Computer Games: Artificial Intelligence, Design, and Education
CGAIDE2004.                                                         Naylor, B., Amatodes, J.A., Thibault, W. 1990. “Merging BSP
                                                                    Trees Yields Polyhedral Set Operations.” In proceedings
Klosowski, J.T., Held, M., Mitchell, J., Sowizral, H., and Zikan,   Computer Graphics SIGGRAPH 1990 ,24(4):115–124, 1990.
K. 1998. “Efficient Collision Detection Using Bounding Volume
Hierarchies of k-DOPs.” IEEE Transactions on Visualization
and Computer Graphics, vol4 issue 1(Jan.) : 21-36.                  Otaduy, M.A. and Lin, M.C. 2003. “CLODs: Dual Hierarchies
                                                                    for Multiresolution Collision Detection.” Proceedings of the
Larsson, T. and Akenine-Möller, T. 2001. “Collision Detection       Eurographics/ACM SIGGRAPH symposium on Geometry
for Continuously Deforming Bodies” In Eerographics 2001.,           processing 2003 (Aachen, Germany, Jul. 27-31), 94-101.
Manchester, UK, 325-333.
                                                                    Teschner, M., Heidelberger, B., Müller, M., Pomeranets, D., and
Moore, M. and Wilhelms, J. 1988. “Collision Detection and           Gross, M. 2003. “Optimized Spatial Hashing for Collision
Response for Computer Animation” In proceedings Computer            Detection of Deformable Objects.” Vision, Modeling, and
Graphics SIGGRAPH 1988 , 22(4):289-298.                             Visualization 2003. (Munich, Germany, Nov. 19-21).

				
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
views:3
posted:8/13/2011
language:English
pages:7