SlideShare ist ein Scribd-Unternehmen logo
1 von 8
Downloaden Sie, um offline zu lesen
1




                                 Interactive Cloth Simulation
                                                            Hsin-Huei Cheng

                        Computer Science Department, University of California, Los Angeles, USA


                                                                        neighbors by a number of massless springs at their natural
   Abstract—Cloth simulation has been extensively applied in film       lengths. While more sophisticated model could be used for
making and in-game animation. In this project, I implemented a          constructing the simulated cloth (e.g., the finite-element
virtual simulation interface for users to manipulate the cloth in       constitutive model), the simple mass-spring constitutive model
real-time. The key objectives in my project are to provide users with
an interactive interface to manipulate the virtual cloth dynamically,
                                                                        was sufficient for the modeling presented in this report. Based
while at the same time preserving the physical morphological details    on the model, three different types of springs were used (i.e.,
of the cloth, such as wrinkles and folds. In addition, collision        structural, shear, and bending springs), which are showed in Fig.
avoidance of the virtual cloth (e.g., self-collision and cloth-object   2.
collision) was implemented to realistically represent how a virtual
cloth conforms to different static objects.

                        I. INTRODUCTION

C    LOTH INTERACTION, depending on the degree of realistic
     representation required during the simulation, can consume
a significant amount of computational resources. Modeling of
the virtual cloth using continuum models is therefore not
suitable for the purpose. To enhance the computational
efficiency, a mass-spring model is commonly used. In this
project, I implemented a simple interactive cloth simulation
interface based on the mass-spring model to animate a piece of
cloth in real-time. The virtual simulation environment allows
users to interact with the cloth in a three-dimensional (3D) space
through the mouse or keyboard controls.
                                                                         Fig.1. The flowchart of the cloth interactive simulation.
   In the simulation, the motion of the cloth is influenced by the
forces within the particles inside the cloth (i.e., internal force),
as well as the forces between the cloth and the other objects,            The movement of each particle is governed by the
such as gravity (i.e., external force). Internal forces were            well-known Newton’s equation of motion:
handled by constraining the motion of the particles, except for                                                  d 2 xi
the bending force acting on the cloth. External forces, such as                        Fi = mi ⋅ ai = mi ⋅                            (1)
                                                                                                                 dt 2
gravity, momentum transfer by winds, or the controls from the
users, were applied to the cloth, where the force magnitudes            where x ∈ ℜ3 denotes the 3D position of a particle,
                                                                                  i
were integrated over time. For collision detection, bounding
volume hierarchies (BVH) were used to improve the                        Fi ∈ ℜ denotes the force acting on the particle, a ∈ ℜ 3 and
                                                                               3
                                                                                                                             i
computational efficiency. Self-collision of the object (i.e., cloth)     m represent the acceleration and the mass of the particle,
was handled to a certain extent. All functions of the interface            i
were programmed into a modular structure to facilitate the              respectively.
testing of individual functions. The work flow chart of the                To solve for the equation (1), we have to determine the
interface is illustrated in Fig. 1.                                     resultant force, F , acting on each of the individual particles.
                                                                                          i
                                                                        The resultant force consists of two components, one is the
                     II. THE CLOTH MODEL                                internal force, Fint , and the other is the external force, Fext .
  To construct a simulated cloth, a simple mass-spring                  Mathematically, the resultant force can be expressed as,
constitutive model was used. The model consisted of a mesh of
m × n virtual masses, with each mass being connected to its
                                                                                              Fi = Fint + Fext                        (2)
                                                                        By calculating the internal and the external forces acting on
                                                                        individual particles, one can determine the resultant force based
2

on equation (2). In the following, I will first introduce the            function of the rate of change of the dihedral angle. Details of
possible external forces that act on the cloth in the simulation.        the equations and implementation of the model can be referred
These external forces will be modified by a bending force model          in Bridson et al. [1]. With the use of the bending force model,
to further enhance the wrinkles and folds of the simulated cloth.        one can simulate the interaction between the cloth and the object
The modified external forces will be utilized to determine the           more naturally (i.e., wrinkles on the cloth, see Fig. 4).
intermediate position of the particle at a specific time step using
an integration method. The intermediate position will be further
                                                                                                      ˆ
                                                                                                      e
refined by considering the internal forces acting within the
cloth.                                                                                                                 ˆ
                                                                                                                       n2
                                                                                      ˆ
                                                                                      n1
                                                                                                                            ˆ
                                                                                                                            n1           ˆ
                                                                                                                                         n2
                 m =1            m =2            m =3                                                                            θ
              n =1


                                                                             Fig. 3. The bending elements contain two triangles with a shared edge.
              n =2                                                            r
                                                                                  ˆ      ˆ
                                                                             e . n1 and n2 are the normals of the two triangles. θ is the angle
                                                                             between n1 and n2 , and the dihedral angle is defined as π - θ .
                                                                                     ˆ      ˆ


              n =3


    Fig. 2. Mass spring model for cloth representation. Particles
    are represented in yellow circle. Three kinds of spring are
    employed, structural (green), shear (blue) and bending (red)
    spring.
  A. External Force
   In real world, many different types of forces exist, such as
gravity and reaction forces induced by collision. When these
external forces impart on an object, the object will be set into
motion. To simulate the motion of the object realistically in a                                                (a)
digital computer, we need to account for the forces that act on
individual particles within the object.
   The external forces can be mathematically represented by
vectors, which quantify the magnitude and the direction of the
forces. The resultant force acting on a particle can be obtained
by the addition of the force vectors. Through the use of
Newton’s law of motion, the acceleration of the particle can be
determined. This information is then used to calculate the
displacement of the particle at a particular time step through the
method of integration.                                                                                          (b)
                                                                             Fig. 4. Comparison of the morphological features on a virtual cloth. (a)
  B. Bending Force                                                           Cloth simulation without bending force. (b) Cloth simulation with
  One of the goals of cloth simulation is to obtain folds and                bending force (rest angle = 15o), where more wrinkles were appeared.
wrinkles realistically. To achieve the effects, we have to
consider the bending forces acting on the cloth. Here, I chose to          C. Integration Method
implement the bending force model proposed by Bridson et al.               The standard explicit Euler integration method is a way to
[1]. Specifically, Bridson et al. [1] suggested that it is critical to   compute the time history of the particle trajectory efficiently.
avoid the introduction of arbitrary and artificial in-plane and          Despite the simplicity of the integration method, there are a
bending deformations into the model. This is due to the fact that        number of drawbacks for its use in the cloth simulation. First,
the exact nature of these physical coupling varies between               the method is not suitable for larger simulation time step,
materials, and is not understood even for the simplest fabrics.          especially in the situations when forces with large magnitudes
   Bending force contains two components. The first component            are involved [2]. Also, instabilities of the particle trajectory
is the elastic bending force, which is governed by the dihedral          result when the positions of the particles change rapidly due to
angle, θ , and the rest angle, θ 0 (Fig. 3). Sculpting folds could       sudden collisions. To alleviate these problems, Meyer et al. [3]
be simulated on a cloth by setting a non-zero rest angle. The            proposed to correct the particle velocities within the objects
second component is the damping bending force, which is a
3

after each time step. The modified particle velocity based on the          This process was iterated several times within one time step in
proposed method can be expressed as,                                       order to converge to the desired solution. The necessary
                                 xin − xin−1                               number of iterations varies depending on the physical system
                             v =
                              n
                              i                                      (3)   simulated.
                                     dt
where v n i denotes the velocity of the particle, xi n − 1 and

 xi n represent the positions at the previous and the current time
step, respectively, and dt denotes the infinitesimal time step.
    The velocity term in the equation (3) can be obtained by the
subtraction of the particle positions at different time steps.
Although positional errors may be accumulated as the number
of integration increases, this simplified method greatly enhances
the numerical integration stability as compared to other                                too large              rest length            too
conventional methods. To obtain the particle position in the                short
subsequent time steps, Verlet integration method was employed
as the method is known to be numerically stable [4]. This                   Fig. 5. Schematic showing the concept of the constraint
method updated the particle position without computing any                  operation. If the distance between 2 particles (yellow dot) is
                                                                            too large, then the particle will be pushed closer. Otherwise,
velocities term, and can be expressed as,
                n +1                   n −1          fi n                   Pseudo-
                                                                            Pseudo-code of satisfyConstraint()
              x i      =x +x −x
                         n
                         i        i
                                   n
                                       i      + dt ⋅
                                                  2
                                                                     (4)    Delta = x2-x1;
                                                     mi                     deltalength = sqrt(delta*delta);
where fi denotes the accumulated external forces and mi denotes             diff = deltalength *(1- restlength/ deltalength);
the mass of the particle. In the project, I assumed all the                 diff_half= diff/2;
particles were identical (i.e., having the same mass). In addition,         x1 += diff_half;
equation (4) can be further modified by introducing a damping               x2 -= diff_half;
coefficient, kd , (see equation (5)). With the new damping
coefficient, small amount of dragging effect can be                         Fig. 6. Pseudo-code of the constraint operation.
implemented into the cloth simulation.
                                                               fin
   xin+1 = xin + (1 − k d ) xin − (1 − k d ) xin −1 + dt 2 ⋅         (5)                         III. COLLISION HANDLING
                                                               mi            Collision handling refers to the detection of two objects when
                                                                           they are in close proximity (i.e., collision detection), as well as
  D. Internal Force by Constraints
                                                                           the respective methods to resolve the collision events (i.e.,
  For a particle-spring system, the interactions between                   collision resolution). For interactive applications, collision
interconnected particles are handled by linear springs. The                handling has been a bottleneck to the simulation performance.
resulting force on individual particle can be calculated by                Therefore, improvement in the computational efficiency plays
                                                 x j − xi                  an important role in collision handling, especially for
               f ij = kij ( x j − xi − lij ) ⋅                       (6)   self-collision (i.e., object collides with itself). To enhance the
                                                 x j − xi                  collision handling performance, the first step is to optimize the
where kij denotes the spring constant and lij is the rest length of        collision detection.
the spring. Despite the simplicity of the linear spring model, it            A. Bounding Volume Hierarchy
cannot fully simulate the cloth stretching process since the
process is highly nonlinear. When the elongation of the cloth                Collision detection between a cloth model with N particles
exceeds a certain threshold, the simulated cloth will become               and an object with M nodes has a O (MN ) complexity.
very stiff. Instead of considering the internal forces between the         Similarly, the self-collision detection has a O ( N 2 ) complexity.
particles, Provot [5] proposed a simple alternative method                 To enhance the speed for collision detection process,
which uses particle position as the only parameter to solve the            hierarchies of bounding volumes technique is introduced since
stiffness problem.                                                         they provide a fast way to perform collision detection between
   In this project, I utilized the concept from Provot to constraint       complex models.
the particle displacement within the cloth. In my approach, the              There are several types of volumes, such as oriented bounding
particle distances at each time step were compared with the rest           boxes (OBBs), discrete-orientation polytopes (DOPs), and
lengths of the spring. If the distance was larger than the rest            axis-aligned bounding boxes (AABBs) [6]. In this project, I
length, the particle distance would be reduced accordingly.                used AABBs due to its easy implementation and fast collision
Likewise, if the particle distance was shorter than the rest length,       detection performance.
the particle distance would be lengthened (Fig. 5). The                       The AABBs hierarchy is a binary tree, where AABBs are
pseudo-code of this constraint operation is illustrated in Fig 6.          aligned to the axes of the model's local coordinate. An AABB
The code was applied to every spring present in the cloth model.
4

hierarchy is constructed bottom-up, where two neighbor
primitives (particles, triangles or edges) are grouped under a                                   w1 + w2 + w3 = 1                        (8)
parent. This process is performed recursively until only one
AABB left, termed as the root of the AABBs hierarchy.
                                                                           The purposes for Equations (7) and (8) are to find the
Building the AABBs hierarchy for a static object is a one time
                                                                           barycentric coordinates. If the barycentric coordinates were all
operation. For a moving object (e.g., the cloth), the hierarchy is
required to be updated at each time step. The AABBs hierarchy              within the interval [−δ , 1+δ ], where δ is h divided by a
of different levels is illustrated in Fig. 7.                              characteristic length of the triangle, the point was close to the
    An intersection test between two nodes of two hierarchies is           triangular plane [7]. Then the projected position could be
done by recursively testing pairs of nodes. For each pair of the           obtained by using equation (9). Then the new position of the
                                                                                    r                         r
nodes, the AABBs are tested for overlapping. Only the                      particle x4 would be assigned to x prj to resolve the collision.
                                                                                            r          r       r       r
overlapped nodes are further traversed to their children nodes.                             x prj = w1 x1 + w2 x2 + w3 x3                 (9)
The procedures of traversing hierarchies are borrowed from the
concept of Van Den Bergen [6]. These procedures are outlined                  In addition to modifying the particle position, it is also
as follow:                                                                 necessary to adjust the particle velocity for the purpose of
i) If both of the nodes are leaf nodes, then the primitives are            collision resolution. Since the collision event is happened in
tested for the occurrence of intersection to determine whether             between a cloth and an object, the friction between them has to
collision occurs. If collision happens, then further collision             be taken into consideration.
resolution will be performed.                                                 General macroscopic laws of friction describe the forces that
ii) If one of the nodes is a leaf node and the other is an internal        are applied to each of the objects when they are in contact. The
node, then the leaf node is tested repeatedly for the occurrence           friction forces could be derived from the Coulombian law.
of intersection with the children of the internal node, until a leaf       During an “inelastic” collision, there is some dissipation of
node is reached.                                                           energy during the collision. For a “perfectly inelastic” collision,
iii) If both of the nodes are internal nodes, then the node with           the energy is completely dissipated. Both forces are coupled to
smaller volume is tested for the occurrence of intersection with           generate an integrated response as showed in equation (10) [8].
                                                                                                                     r
the children of the node with the larger volume.                              r             r     r ' r         r vT        r
                                                                           if vT ≥ k f      v N , vT = vT − k f v N r − k d v N
                                                                                                                     vT
                                                                                                                                (10)
                                                                               r
                                                                           if v < k         r     r '       r
                                                                               T     f      v N , vT = −k d v N
                                                                                 r r r
                                                                           where v = vT + v N is the resultant velocity of the particle before
                                                                                        r       r
                                                                                        vT and vN are the tangential and the normal
                                                                           collision, and
                                                                                                                             r'
                                                                           velocity component of the particle, respectively. v is the
                                                                           resultant velocity that will be assigned to the particle. kf is the
                                                                           friction coefficient and kd is the dissipation coefficient
                                                                           ( 0 ≤ k d < 1 ). kf =0 means sliding without friction, and
            Level = 0             Level = 3              Level = 5         kf = ∞ means sliding is prohibited.

  Fig. 7. The AABBs of triangle hierarchy at different level.                C. Self-Collisions
                                                                             Accurate geometric collision test is required to resolve any
  B. Cloth-Object Collisions                                               undetected collisions. In addition, more advanced techniques,
  Cloth-object collisions are detected by testing the occurrence           such as impact zones, are applied iteratively to resolve each
of the intersection between the particle BVH of the cloth and the          collision [5, 7, 9].            These methods can generate
triangle BVH of the static model. If both nodes are leaf nodes,            close-to-perfect/perfect collision resolved results. However,
the proximity test is performed to check if the particle is close to       the drawback of these methods is the consumption of significant
                                              r                            amount of computational time. For interactive applications,
the triangle. For example, to check if point x4 is closer than the
                                        rr r                               self-collision occupies a significant portion of the rendering
cloth thickness h to a triangle                              ˆ
                                        x1 x2 x3 with normal n , I first   time, thus self-collision handling is ignored in most of these
checked if the point was close to the plane containing the                 applications.
                  r
triangle, i.e.,   x43 • n < h . If this was the case, I projected the
                        ˆ                                                    In this project, I considered the particle-particle and the
                                                                           particle-triangle interactions independently. Since the AABBs
point onto the triangular plane and computed the barycentric               hierarchies of particle and triangle of the cloth were built at each
coordinates w1 , w2 , w3 with respect to the triangle:                     time step, colliding pairs were obtained by the bounding box
                                                                           hierarchy intersection tests.
           r r            r r                  r r                           For a particle-particle pair, I directly added repulsion forces
          x13 • x13      x13 • x23   w1   x13 • x43                  between the two particles. The inelastic impulse was calculated
         x • x                             = r
                          x23 • x23   w2   x23 • x43 
           r r            r     r                    r               (7)
                                                                           based on the relative velocity of the two particles using equation
          13 23                                     
                                                                           (11).
5


                           I = mvN / 2                               (11)                            IV. INTERACTION
where I is the magnitude of impulse, m is the mass of particles,                Interaction is the most intuitive and fun part of human feelings.
and v N is the relative velocity on the normal direction. For one             In this project, I implemented two different interactive functions
                                                                              for user to manipulate the cloth in the virtual world.
particle, the repulsion force was given by I • n , whereas that of
                                                ˆ
the other particle was given by - I • n . ˆ                                     A. Dragging
   For the particle-triangle pairs, I performed the proximity test              User could drag any part of the cloth to see how the cloth
which is the same as the test described in that of the cloth-object           interacted with the objects or the environment in real-time. The
collision. The inelastic impulse was calculated using equation                openGL GL_SELECT mode was used to determine which
(11) based on the relative velocity of particle and the                       particle was selected. In some situations, there might be several
                                                 r      r      r              particles lining up together at the location where the user chose.
interpolated velocity of the triangle (i.e. w1v1 + w2v2 + w3v3 ).
                                                                              The pick function would automatically choose the particle
The repulsion forces acted on the particle and the triangle could
                                                                              which was closest to the user determined position.
then be obtained using equation (12).
                                                                                User could also click on the left button of the mouse to drag
        ~             2I
        I =                                                                   the particle to a specific location, and then free the particle by
              1 + w + w2 + w3
                     2
                     1
                           2     2
                                                                              releasing the button. This interaction would generate an
        r        r         ~                                                  external force. The force vector is defined as the difference
        v inew = vi + wi ( I / m)n ˆ          i = 1,2,3                (12)   between the local particle position and the position where the
        r        r      ~                                                     user released the button.
        v4new = v 4 − ( I / m)nˆ
      ~                          r                                              B. Fixing and Releasing
where I is the weighted impulse, v inew (where i=1,2,3) indicates
                                                                                In the 2nd type of interaction, users can fix and release the
                                                                   r
the new velocities of three particles of the triangle, and         v4new is   virtual cloth through the mouse and keyboard control. The
the new velocity of the particle.                                             function “Fixing” fixed the particles to specific positions. User
                                                                              could click on any part of the cloth during the simulation and the
  D. Preserving Folds and Wrinkles                                            pick function would determine which particle is being selected.
   The collision between cloth and object is often resolved by                The motion of a moving particle can be made frozen by using a
projecting the particles of the cloth to the outer surface of the             keyboard control, “M” or “m”. Likewise, the same keyboard
object. However, projecting the cloth particles to the outer                  control can be used to make a frozen particle move. The
surface of the object will smooth out the wrinkles and folds of               combination of mouse and keyboard control could simulate
the cloth, as illustrated in Fig. 8 (a). To resolve this information          some interesting cloth mechanics, such as cloth hanging, or
loss (e.g., wrinkles), Bridson et al. [1] proposed a simple yet               wrapping an object etc.
powerful post-processing method. The method is to bring all                     Other user interactions, such as controlling the camera view
the cloth particles inside the collision volume above the object              by zoom in/out or rotating the scene around the y-axis, can be
surface. Mathematically, this can be achieved by applying a                   achieved by using the controls from a mouse. The keyboard
monotonic increasing function to rescale the cloth particle                   control can also be used to start or to pause the simulation.
displacement, so as to preserve the cloth morphology. The
method can be illustrated in Fig. 8 (b).                                                   V. IMPLEMENTATION AND RESULTS

                                                                                A. Default Scene
                                                                                In the project, the scene contained a static model, a horizontal
                                                                              ground where the model located, and a moving cloth. A
                                                                              representative scene is shown in Fig. 9. The number of faces in
                                                                              the model is 1418 and the total number of the particles in the
                                               (a)                            cloth is 600. Wind and gravity forces have been added to the
                                                                              cloth by default.
                                                                                B. Experimental Illustrations
                                                                                  1) Cloth – object collision
                                                                                 The cloth was hanged in the air with gravity and wind forces.
                                               (b)                            When the cloth collides with the model, the collision would be
                                                                              resolved to a certain extent. In the simulation, collision between
 Fig. 8. Cloth penetrating into an object can be (a) pushed to the cloth      the cloth and the sharper edges of the model could not be
 boundary, where the wrinkles will be flattened; or (b) pushed to a region    resolved because the edge-edge collision handling was not
 (the green dotted line) outside the object using monotone mapping, where     performed.
 wrinkles can be preserved.
6




 Fig. 9. A representative default scene.
                                                                        Fig. 11. The defect of cloth self-collision using particle-particle BVHs
                                                                        only.


                                                                        3) Cloth self- collision (particle- triangle pairs)
                                                                       The following figure (Fig. 12) showed the result of
                                                                    self-collision resolution based on particle-triangle pairs. The
                                                                    collision resolution had been resolved and the wrinkles and
                                                                    folds were preserved.




 Fig. 10. The collision handling between the cloth and the model.


    2) Cloth self- collision (particle-particle pairs)
   The following result showed when only particle-particle pairs
were considered for self-collision, the cloth would penetrate
itself.
                                                                     Fig. 12. The result of cloth self-collision using particle-triangle BVHs.
7

    4) Fix the cloth                                                    the edge-edge collision resolution was applied. As for the
   Parts of the cloth were fixed in arbitrary positions during the      self-collision, I used two methods to detect and to resolve the
simulation. The cloth simulations at different viewpoints were          collisions. One was to detect particle-particle pairs and the
illustrated in Fig. 13 and Fig. 14, respectively.                       other was to detect the particle-triangle pairs. The latter
                                                                        performed better than the former one.             However, the
                                                                        particle-triangle based collision handling consumed a
                                                                        significant amount of computer run time. The efficiency of
                                                                        collision detection could be improved by using more efficient
                                                                        hierarchy traversing and updating methods, while the collision
                                                                        resolution could be improved by using hybrid integration [ 7, 9]
                                                                        or adaptive time step integration. For the interaction part, so far
                                                                        only basic operations were implemented. Future work includes
                                                                        adding more interactive functions, such as dressing a character.

                                                                                                   VII. CONCLUSIONS
                                                                           This project demonstrated a platform for interactive cloth
                                                                        simulation, where a user could animate a virtual cloth in
                                                                        real-time. The platform developed in this project is applicable
                                                                        to simulations with large time steps. Also two important
 Fig. 13. The result of particles fixing.                               properties of cloth, folds and wrinkles, were retained in the
                                                                        virtual cloth simulation.         Collision handling was also
                                                                        implemented in the project, allowing the virtual cloth to
                                                                        conform to different static objects. In addition, basic physical
                                                                        manipulations of the virtual cloth, such as dragging and
                                                                        releasing, were provided for user interactive applications. The
                                                                        interactive platform provided in this project will allow users to
                                                                        interact directly with a realistic cloth in a virtual environment.
                                                                        The platform should be useful for a broad variety of in-game
                                                                        purposes.

                                                                                                   ACKNOWLEDGMENT
                                                                        I would like to thank my advisor Prof. Petros Faloutsos and my
                                                                        mentor Gabriele Nataneli for their patience and useful advice
                                                                        throughout the project. I am very grateful to have the chance to
                                                                        learn from them. Also, I would like to thank Prof. Demetri
 Fig. 14. The result of particles fixing (at a different view point).
                                                                        Terzopoulos and Prof. Glenn Reinman for serving on my
                                                                        Examination Committee.
    5) Releasing hanged cloth
   The default cloth was hanged by fixing 6 particles on the                                            REFERENCES
                                                                        [1]   R. Bridson, S. Marino and R. Fedkiw. Simulation of clothing with folds
cloth (i.e., 3 particles each on the upper corners of the cloth).
                                                                              and wrinkles. In Proc. ACM/Eurographics Symposium on Computer
User could use a mouse to release the cloth and also could drag               Animation, pp. 28–36, 2003.
the cloth to any positions. The results of the cloth releasing and      [2]   D. Baraff and A. Witkin. Large steps in cloth simulation. Comput. Graph.
cloth dragging were shown in Fig. 15.                                         (SIGGRAPH Proc.), pp. 1–12,1998
                                                                        [3]   M. Meyer, G. Debunne, M. Desbrun, and Alan H. Barr. Interactive
                                                                              animation of cloth-like objects for virtual reality. The Journal of
    6) Dragging response                                                      Visualization and Computer Animation, vol. 12, pp. 1–12, 2001.
   The results for cloth dragging and the subsequent response of        [4]   L. Verlet. Computer ”experiments” on classical fluids.
the cloth were shown in Fig. 16.                                              i..thermodynamical properties of lennard-jones molecules. Physical
                                                                              Review, vol. 159, pp. 98–103, 1967.
                                                                        [5]   X. Provot. Deformation constraints in a mass-spring model to describe
                            VI. DISCUSSIONS                                   rigid cloth behavior, In Graphics Interface 95, pp.147-154, 1995.
   Robust collision handling is the most challenging part in cloth      [6]   G. Van Den Bergen. Efficient collision detection of complex deformable
                                                                              models using AABB trees. Journal of Graphics Tools 2, 4, pp. 1-14, 1997
simulation. For the cloth-cloth and cloth-object collisions, I          [7]   R. Bridson, R. Fedkiw, and J. Anderson. Robust treatment of collisions,
tried to handle both point-triangle and edge-edge collisions.                 contact and friction for cloth animation.          ACM Trans. Graph.
However, the animation took a few seconds to render each                      (SIGGRAPH Proc.), vol. 21, pp. 594–603, 2002.
frame. To enhance the computational efficiency, I only used             [8]   X. Provot. Collision and self-collision handling in cloth model dedicated
                                                                              to design garments. In Graphics Interface 97, pp. 177–189, 1997.
point-triangle BVHs to handle the cloth-object collision. Under         [9]   A. Selle, J. Su, G. Irving, and R. Fedkiw. Robust high-resolution cloth
this condition, some collisions occurred on parts of the model                using parallelism, history-based collisions, and accurate friction. IEEE
with sharper edges. This type of collision could be resolved if               Transactions on Visualization and Computer Graphics, 99(2), 2008.
8




                   (a)                                                  (b)                                                  (c)




                   (d)                                                 (e)                                                  (f)

Fig. 15. Representative images showing the releasing and dragging of a cloth (e.g., releasing the cloth from a corner in (a) and dragging the cloth in (e)).




                    (a)                                                 (b)                                               (c)




                    (d)                                                (e)

 Fig. 16. Representative images showing the dragging of the cloth at a specific location (e.g., see (a)) and the subsequent response of the cloth.

Weitere ähnliche Inhalte

Was ist angesagt?

PSRI30yr anniversary lecture on Scaling Law and Agglomeration Issues in Fluid...
PSRI30yr anniversary lecture on Scaling Law and Agglomeration Issues in Fluid...PSRI30yr anniversary lecture on Scaling Law and Agglomeration Issues in Fluid...
PSRI30yr anniversary lecture on Scaling Law and Agglomeration Issues in Fluid...Masayuki Horio
 
7 - Momentum & energy
7 - Momentum & energy7 - Momentum & energy
7 - Momentum & energyguest924dbe
 
Fluctuations and rare events in stochastic aggregation
Fluctuations and rare events in stochastic aggregationFluctuations and rare events in stochastic aggregation
Fluctuations and rare events in stochastic aggregationColm Connaughton
 

Was ist angesagt? (7)

PSRI30yr anniversary lecture on Scaling Law and Agglomeration Issues in Fluid...
PSRI30yr anniversary lecture on Scaling Law and Agglomeration Issues in Fluid...PSRI30yr anniversary lecture on Scaling Law and Agglomeration Issues in Fluid...
PSRI30yr anniversary lecture on Scaling Law and Agglomeration Issues in Fluid...
 
7 - Momentum & energy
7 - Momentum & energy7 - Momentum & energy
7 - Momentum & energy
 
Sdof
SdofSdof
Sdof
 
Fluctuations and rare events in stochastic aggregation
Fluctuations and rare events in stochastic aggregationFluctuations and rare events in stochastic aggregation
Fluctuations and rare events in stochastic aggregation
 
Jokyokai2
Jokyokai2Jokyokai2
Jokyokai2
 
B31008012
B31008012B31008012
B31008012
 
14 kailash fem-125-128
14 kailash fem-125-12814 kailash fem-125-128
14 kailash fem-125-128
 

Kürzlich hochgeladen

Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 

Kürzlich hochgeladen (20)

Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 

Interactive Cloth Simulation

  • 1. 1 Interactive Cloth Simulation Hsin-Huei Cheng Computer Science Department, University of California, Los Angeles, USA neighbors by a number of massless springs at their natural Abstract—Cloth simulation has been extensively applied in film lengths. While more sophisticated model could be used for making and in-game animation. In this project, I implemented a constructing the simulated cloth (e.g., the finite-element virtual simulation interface for users to manipulate the cloth in constitutive model), the simple mass-spring constitutive model real-time. The key objectives in my project are to provide users with an interactive interface to manipulate the virtual cloth dynamically, was sufficient for the modeling presented in this report. Based while at the same time preserving the physical morphological details on the model, three different types of springs were used (i.e., of the cloth, such as wrinkles and folds. In addition, collision structural, shear, and bending springs), which are showed in Fig. avoidance of the virtual cloth (e.g., self-collision and cloth-object 2. collision) was implemented to realistically represent how a virtual cloth conforms to different static objects. I. INTRODUCTION C LOTH INTERACTION, depending on the degree of realistic representation required during the simulation, can consume a significant amount of computational resources. Modeling of the virtual cloth using continuum models is therefore not suitable for the purpose. To enhance the computational efficiency, a mass-spring model is commonly used. In this project, I implemented a simple interactive cloth simulation interface based on the mass-spring model to animate a piece of cloth in real-time. The virtual simulation environment allows users to interact with the cloth in a three-dimensional (3D) space through the mouse or keyboard controls. Fig.1. The flowchart of the cloth interactive simulation. In the simulation, the motion of the cloth is influenced by the forces within the particles inside the cloth (i.e., internal force), as well as the forces between the cloth and the other objects, The movement of each particle is governed by the such as gravity (i.e., external force). Internal forces were well-known Newton’s equation of motion: handled by constraining the motion of the particles, except for d 2 xi the bending force acting on the cloth. External forces, such as Fi = mi ⋅ ai = mi ⋅ (1) dt 2 gravity, momentum transfer by winds, or the controls from the users, were applied to the cloth, where the force magnitudes where x ∈ ℜ3 denotes the 3D position of a particle, i were integrated over time. For collision detection, bounding volume hierarchies (BVH) were used to improve the Fi ∈ ℜ denotes the force acting on the particle, a ∈ ℜ 3 and 3 i computational efficiency. Self-collision of the object (i.e., cloth) m represent the acceleration and the mass of the particle, was handled to a certain extent. All functions of the interface i were programmed into a modular structure to facilitate the respectively. testing of individual functions. The work flow chart of the To solve for the equation (1), we have to determine the interface is illustrated in Fig. 1. resultant force, F , acting on each of the individual particles. i The resultant force consists of two components, one is the II. THE CLOTH MODEL internal force, Fint , and the other is the external force, Fext . To construct a simulated cloth, a simple mass-spring Mathematically, the resultant force can be expressed as, constitutive model was used. The model consisted of a mesh of m × n virtual masses, with each mass being connected to its Fi = Fint + Fext (2) By calculating the internal and the external forces acting on individual particles, one can determine the resultant force based
  • 2. 2 on equation (2). In the following, I will first introduce the function of the rate of change of the dihedral angle. Details of possible external forces that act on the cloth in the simulation. the equations and implementation of the model can be referred These external forces will be modified by a bending force model in Bridson et al. [1]. With the use of the bending force model, to further enhance the wrinkles and folds of the simulated cloth. one can simulate the interaction between the cloth and the object The modified external forces will be utilized to determine the more naturally (i.e., wrinkles on the cloth, see Fig. 4). intermediate position of the particle at a specific time step using an integration method. The intermediate position will be further ˆ e refined by considering the internal forces acting within the cloth. ˆ n2 ˆ n1 ˆ n1 ˆ n2 m =1 m =2 m =3 θ n =1 Fig. 3. The bending elements contain two triangles with a shared edge. n =2 r ˆ ˆ e . n1 and n2 are the normals of the two triangles. θ is the angle between n1 and n2 , and the dihedral angle is defined as π - θ . ˆ ˆ n =3 Fig. 2. Mass spring model for cloth representation. Particles are represented in yellow circle. Three kinds of spring are employed, structural (green), shear (blue) and bending (red) spring. A. External Force In real world, many different types of forces exist, such as gravity and reaction forces induced by collision. When these external forces impart on an object, the object will be set into motion. To simulate the motion of the object realistically in a (a) digital computer, we need to account for the forces that act on individual particles within the object. The external forces can be mathematically represented by vectors, which quantify the magnitude and the direction of the forces. The resultant force acting on a particle can be obtained by the addition of the force vectors. Through the use of Newton’s law of motion, the acceleration of the particle can be determined. This information is then used to calculate the displacement of the particle at a particular time step through the method of integration. (b) Fig. 4. Comparison of the morphological features on a virtual cloth. (a) B. Bending Force Cloth simulation without bending force. (b) Cloth simulation with One of the goals of cloth simulation is to obtain folds and bending force (rest angle = 15o), where more wrinkles were appeared. wrinkles realistically. To achieve the effects, we have to consider the bending forces acting on the cloth. Here, I chose to C. Integration Method implement the bending force model proposed by Bridson et al. The standard explicit Euler integration method is a way to [1]. Specifically, Bridson et al. [1] suggested that it is critical to compute the time history of the particle trajectory efficiently. avoid the introduction of arbitrary and artificial in-plane and Despite the simplicity of the integration method, there are a bending deformations into the model. This is due to the fact that number of drawbacks for its use in the cloth simulation. First, the exact nature of these physical coupling varies between the method is not suitable for larger simulation time step, materials, and is not understood even for the simplest fabrics. especially in the situations when forces with large magnitudes Bending force contains two components. The first component are involved [2]. Also, instabilities of the particle trajectory is the elastic bending force, which is governed by the dihedral result when the positions of the particles change rapidly due to angle, θ , and the rest angle, θ 0 (Fig. 3). Sculpting folds could sudden collisions. To alleviate these problems, Meyer et al. [3] be simulated on a cloth by setting a non-zero rest angle. The proposed to correct the particle velocities within the objects second component is the damping bending force, which is a
  • 3. 3 after each time step. The modified particle velocity based on the This process was iterated several times within one time step in proposed method can be expressed as, order to converge to the desired solution. The necessary xin − xin−1 number of iterations varies depending on the physical system v = n i (3) simulated. dt where v n i denotes the velocity of the particle, xi n − 1 and xi n represent the positions at the previous and the current time step, respectively, and dt denotes the infinitesimal time step. The velocity term in the equation (3) can be obtained by the subtraction of the particle positions at different time steps. Although positional errors may be accumulated as the number of integration increases, this simplified method greatly enhances the numerical integration stability as compared to other too large rest length too conventional methods. To obtain the particle position in the short subsequent time steps, Verlet integration method was employed as the method is known to be numerically stable [4]. This Fig. 5. Schematic showing the concept of the constraint method updated the particle position without computing any operation. If the distance between 2 particles (yellow dot) is too large, then the particle will be pushed closer. Otherwise, velocities term, and can be expressed as, n +1 n −1 fi n Pseudo- Pseudo-code of satisfyConstraint() x i =x +x −x n i i n i + dt ⋅ 2 (4) Delta = x2-x1; mi deltalength = sqrt(delta*delta); where fi denotes the accumulated external forces and mi denotes diff = deltalength *(1- restlength/ deltalength); the mass of the particle. In the project, I assumed all the diff_half= diff/2; particles were identical (i.e., having the same mass). In addition, x1 += diff_half; equation (4) can be further modified by introducing a damping x2 -= diff_half; coefficient, kd , (see equation (5)). With the new damping coefficient, small amount of dragging effect can be Fig. 6. Pseudo-code of the constraint operation. implemented into the cloth simulation. fin xin+1 = xin + (1 − k d ) xin − (1 − k d ) xin −1 + dt 2 ⋅ (5) III. COLLISION HANDLING mi Collision handling refers to the detection of two objects when they are in close proximity (i.e., collision detection), as well as D. Internal Force by Constraints the respective methods to resolve the collision events (i.e., For a particle-spring system, the interactions between collision resolution). For interactive applications, collision interconnected particles are handled by linear springs. The handling has been a bottleneck to the simulation performance. resulting force on individual particle can be calculated by Therefore, improvement in the computational efficiency plays x j − xi an important role in collision handling, especially for f ij = kij ( x j − xi − lij ) ⋅ (6) self-collision (i.e., object collides with itself). To enhance the x j − xi collision handling performance, the first step is to optimize the where kij denotes the spring constant and lij is the rest length of collision detection. the spring. Despite the simplicity of the linear spring model, it A. Bounding Volume Hierarchy cannot fully simulate the cloth stretching process since the process is highly nonlinear. When the elongation of the cloth Collision detection between a cloth model with N particles exceeds a certain threshold, the simulated cloth will become and an object with M nodes has a O (MN ) complexity. very stiff. Instead of considering the internal forces between the Similarly, the self-collision detection has a O ( N 2 ) complexity. particles, Provot [5] proposed a simple alternative method To enhance the speed for collision detection process, which uses particle position as the only parameter to solve the hierarchies of bounding volumes technique is introduced since stiffness problem. they provide a fast way to perform collision detection between In this project, I utilized the concept from Provot to constraint complex models. the particle displacement within the cloth. In my approach, the There are several types of volumes, such as oriented bounding particle distances at each time step were compared with the rest boxes (OBBs), discrete-orientation polytopes (DOPs), and lengths of the spring. If the distance was larger than the rest axis-aligned bounding boxes (AABBs) [6]. In this project, I length, the particle distance would be reduced accordingly. used AABBs due to its easy implementation and fast collision Likewise, if the particle distance was shorter than the rest length, detection performance. the particle distance would be lengthened (Fig. 5). The The AABBs hierarchy is a binary tree, where AABBs are pseudo-code of this constraint operation is illustrated in Fig 6. aligned to the axes of the model's local coordinate. An AABB The code was applied to every spring present in the cloth model.
  • 4. 4 hierarchy is constructed bottom-up, where two neighbor primitives (particles, triangles or edges) are grouped under a w1 + w2 + w3 = 1 (8) parent. This process is performed recursively until only one AABB left, termed as the root of the AABBs hierarchy. The purposes for Equations (7) and (8) are to find the Building the AABBs hierarchy for a static object is a one time barycentric coordinates. If the barycentric coordinates were all operation. For a moving object (e.g., the cloth), the hierarchy is required to be updated at each time step. The AABBs hierarchy within the interval [−δ , 1+δ ], where δ is h divided by a of different levels is illustrated in Fig. 7. characteristic length of the triangle, the point was close to the An intersection test between two nodes of two hierarchies is triangular plane [7]. Then the projected position could be done by recursively testing pairs of nodes. For each pair of the obtained by using equation (9). Then the new position of the r r nodes, the AABBs are tested for overlapping. Only the particle x4 would be assigned to x prj to resolve the collision. r r r r overlapped nodes are further traversed to their children nodes. x prj = w1 x1 + w2 x2 + w3 x3 (9) The procedures of traversing hierarchies are borrowed from the concept of Van Den Bergen [6]. These procedures are outlined In addition to modifying the particle position, it is also as follow: necessary to adjust the particle velocity for the purpose of i) If both of the nodes are leaf nodes, then the primitives are collision resolution. Since the collision event is happened in tested for the occurrence of intersection to determine whether between a cloth and an object, the friction between them has to collision occurs. If collision happens, then further collision be taken into consideration. resolution will be performed. General macroscopic laws of friction describe the forces that ii) If one of the nodes is a leaf node and the other is an internal are applied to each of the objects when they are in contact. The node, then the leaf node is tested repeatedly for the occurrence friction forces could be derived from the Coulombian law. of intersection with the children of the internal node, until a leaf During an “inelastic” collision, there is some dissipation of node is reached. energy during the collision. For a “perfectly inelastic” collision, iii) If both of the nodes are internal nodes, then the node with the energy is completely dissipated. Both forces are coupled to smaller volume is tested for the occurrence of intersection with generate an integrated response as showed in equation (10) [8]. r the children of the node with the larger volume.  r r r ' r r vT r if vT ≥ k f v N , vT = vT − k f v N r − k d v N vT  (10) r if v < k r r ' r  T f v N , vT = −k d v N r r r where v = vT + v N is the resultant velocity of the particle before r r vT and vN are the tangential and the normal collision, and r' velocity component of the particle, respectively. v is the resultant velocity that will be assigned to the particle. kf is the friction coefficient and kd is the dissipation coefficient ( 0 ≤ k d < 1 ). kf =0 means sliding without friction, and Level = 0 Level = 3 Level = 5 kf = ∞ means sliding is prohibited. Fig. 7. The AABBs of triangle hierarchy at different level. C. Self-Collisions Accurate geometric collision test is required to resolve any B. Cloth-Object Collisions undetected collisions. In addition, more advanced techniques, Cloth-object collisions are detected by testing the occurrence such as impact zones, are applied iteratively to resolve each of the intersection between the particle BVH of the cloth and the collision [5, 7, 9]. These methods can generate triangle BVH of the static model. If both nodes are leaf nodes, close-to-perfect/perfect collision resolved results. However, the proximity test is performed to check if the particle is close to the drawback of these methods is the consumption of significant r amount of computational time. For interactive applications, the triangle. For example, to check if point x4 is closer than the rr r self-collision occupies a significant portion of the rendering cloth thickness h to a triangle ˆ x1 x2 x3 with normal n , I first time, thus self-collision handling is ignored in most of these checked if the point was close to the plane containing the applications. r triangle, i.e., x43 • n < h . If this was the case, I projected the ˆ In this project, I considered the particle-particle and the particle-triangle interactions independently. Since the AABBs point onto the triangular plane and computed the barycentric hierarchies of particle and triangle of the cloth were built at each coordinates w1 , w2 , w3 with respect to the triangle: time step, colliding pairs were obtained by the bounding box hierarchy intersection tests. r r r r r r For a particle-particle pair, I directly added repulsion forces  x13 • x13 x13 • x23   w1   x13 • x43  between the two particles. The inelastic impulse was calculated x • x = r x23 • x23   w2   x23 • x43  r r r r r (7) based on the relative velocity of the two particles using equation  13 23     (11).
  • 5. 5 I = mvN / 2 (11) IV. INTERACTION where I is the magnitude of impulse, m is the mass of particles, Interaction is the most intuitive and fun part of human feelings. and v N is the relative velocity on the normal direction. For one In this project, I implemented two different interactive functions for user to manipulate the cloth in the virtual world. particle, the repulsion force was given by I • n , whereas that of ˆ the other particle was given by - I • n . ˆ A. Dragging For the particle-triangle pairs, I performed the proximity test User could drag any part of the cloth to see how the cloth which is the same as the test described in that of the cloth-object interacted with the objects or the environment in real-time. The collision. The inelastic impulse was calculated using equation openGL GL_SELECT mode was used to determine which (11) based on the relative velocity of particle and the particle was selected. In some situations, there might be several r r r particles lining up together at the location where the user chose. interpolated velocity of the triangle (i.e. w1v1 + w2v2 + w3v3 ). The pick function would automatically choose the particle The repulsion forces acted on the particle and the triangle could which was closest to the user determined position. then be obtained using equation (12). User could also click on the left button of the mouse to drag ~ 2I I = the particle to a specific location, and then free the particle by 1 + w + w2 + w3 2 1 2 2 releasing the button. This interaction would generate an r r ~ external force. The force vector is defined as the difference v inew = vi + wi ( I / m)n ˆ i = 1,2,3 (12) between the local particle position and the position where the r r ~ user released the button. v4new = v 4 − ( I / m)nˆ ~ r B. Fixing and Releasing where I is the weighted impulse, v inew (where i=1,2,3) indicates In the 2nd type of interaction, users can fix and release the r the new velocities of three particles of the triangle, and v4new is virtual cloth through the mouse and keyboard control. The the new velocity of the particle. function “Fixing” fixed the particles to specific positions. User could click on any part of the cloth during the simulation and the D. Preserving Folds and Wrinkles pick function would determine which particle is being selected. The collision between cloth and object is often resolved by The motion of a moving particle can be made frozen by using a projecting the particles of the cloth to the outer surface of the keyboard control, “M” or “m”. Likewise, the same keyboard object. However, projecting the cloth particles to the outer control can be used to make a frozen particle move. The surface of the object will smooth out the wrinkles and folds of combination of mouse and keyboard control could simulate the cloth, as illustrated in Fig. 8 (a). To resolve this information some interesting cloth mechanics, such as cloth hanging, or loss (e.g., wrinkles), Bridson et al. [1] proposed a simple yet wrapping an object etc. powerful post-processing method. The method is to bring all Other user interactions, such as controlling the camera view the cloth particles inside the collision volume above the object by zoom in/out or rotating the scene around the y-axis, can be surface. Mathematically, this can be achieved by applying a achieved by using the controls from a mouse. The keyboard monotonic increasing function to rescale the cloth particle control can also be used to start or to pause the simulation. displacement, so as to preserve the cloth morphology. The method can be illustrated in Fig. 8 (b). V. IMPLEMENTATION AND RESULTS A. Default Scene In the project, the scene contained a static model, a horizontal ground where the model located, and a moving cloth. A representative scene is shown in Fig. 9. The number of faces in the model is 1418 and the total number of the particles in the (a) cloth is 600. Wind and gravity forces have been added to the cloth by default. B. Experimental Illustrations 1) Cloth – object collision The cloth was hanged in the air with gravity and wind forces. (b) When the cloth collides with the model, the collision would be resolved to a certain extent. In the simulation, collision between Fig. 8. Cloth penetrating into an object can be (a) pushed to the cloth the cloth and the sharper edges of the model could not be boundary, where the wrinkles will be flattened; or (b) pushed to a region resolved because the edge-edge collision handling was not (the green dotted line) outside the object using monotone mapping, where performed. wrinkles can be preserved.
  • 6. 6 Fig. 9. A representative default scene. Fig. 11. The defect of cloth self-collision using particle-particle BVHs only. 3) Cloth self- collision (particle- triangle pairs) The following figure (Fig. 12) showed the result of self-collision resolution based on particle-triangle pairs. The collision resolution had been resolved and the wrinkles and folds were preserved. Fig. 10. The collision handling between the cloth and the model. 2) Cloth self- collision (particle-particle pairs) The following result showed when only particle-particle pairs were considered for self-collision, the cloth would penetrate itself. Fig. 12. The result of cloth self-collision using particle-triangle BVHs.
  • 7. 7 4) Fix the cloth the edge-edge collision resolution was applied. As for the Parts of the cloth were fixed in arbitrary positions during the self-collision, I used two methods to detect and to resolve the simulation. The cloth simulations at different viewpoints were collisions. One was to detect particle-particle pairs and the illustrated in Fig. 13 and Fig. 14, respectively. other was to detect the particle-triangle pairs. The latter performed better than the former one. However, the particle-triangle based collision handling consumed a significant amount of computer run time. The efficiency of collision detection could be improved by using more efficient hierarchy traversing and updating methods, while the collision resolution could be improved by using hybrid integration [ 7, 9] or adaptive time step integration. For the interaction part, so far only basic operations were implemented. Future work includes adding more interactive functions, such as dressing a character. VII. CONCLUSIONS This project demonstrated a platform for interactive cloth simulation, where a user could animate a virtual cloth in real-time. The platform developed in this project is applicable to simulations with large time steps. Also two important Fig. 13. The result of particles fixing. properties of cloth, folds and wrinkles, were retained in the virtual cloth simulation. Collision handling was also implemented in the project, allowing the virtual cloth to conform to different static objects. In addition, basic physical manipulations of the virtual cloth, such as dragging and releasing, were provided for user interactive applications. The interactive platform provided in this project will allow users to interact directly with a realistic cloth in a virtual environment. The platform should be useful for a broad variety of in-game purposes. ACKNOWLEDGMENT I would like to thank my advisor Prof. Petros Faloutsos and my mentor Gabriele Nataneli for their patience and useful advice throughout the project. I am very grateful to have the chance to learn from them. Also, I would like to thank Prof. Demetri Fig. 14. The result of particles fixing (at a different view point). Terzopoulos and Prof. Glenn Reinman for serving on my Examination Committee. 5) Releasing hanged cloth The default cloth was hanged by fixing 6 particles on the REFERENCES [1] R. Bridson, S. Marino and R. Fedkiw. Simulation of clothing with folds cloth (i.e., 3 particles each on the upper corners of the cloth). and wrinkles. In Proc. ACM/Eurographics Symposium on Computer User could use a mouse to release the cloth and also could drag Animation, pp. 28–36, 2003. the cloth to any positions. The results of the cloth releasing and [2] D. Baraff and A. Witkin. Large steps in cloth simulation. Comput. Graph. cloth dragging were shown in Fig. 15. (SIGGRAPH Proc.), pp. 1–12,1998 [3] M. Meyer, G. Debunne, M. Desbrun, and Alan H. Barr. Interactive animation of cloth-like objects for virtual reality. The Journal of 6) Dragging response Visualization and Computer Animation, vol. 12, pp. 1–12, 2001. The results for cloth dragging and the subsequent response of [4] L. Verlet. Computer ”experiments” on classical fluids. the cloth were shown in Fig. 16. i..thermodynamical properties of lennard-jones molecules. Physical Review, vol. 159, pp. 98–103, 1967. [5] X. Provot. Deformation constraints in a mass-spring model to describe VI. DISCUSSIONS rigid cloth behavior, In Graphics Interface 95, pp.147-154, 1995. Robust collision handling is the most challenging part in cloth [6] G. Van Den Bergen. Efficient collision detection of complex deformable models using AABB trees. Journal of Graphics Tools 2, 4, pp. 1-14, 1997 simulation. For the cloth-cloth and cloth-object collisions, I [7] R. Bridson, R. Fedkiw, and J. Anderson. Robust treatment of collisions, tried to handle both point-triangle and edge-edge collisions. contact and friction for cloth animation. ACM Trans. Graph. However, the animation took a few seconds to render each (SIGGRAPH Proc.), vol. 21, pp. 594–603, 2002. frame. To enhance the computational efficiency, I only used [8] X. Provot. Collision and self-collision handling in cloth model dedicated to design garments. In Graphics Interface 97, pp. 177–189, 1997. point-triangle BVHs to handle the cloth-object collision. Under [9] A. Selle, J. Su, G. Irving, and R. Fedkiw. Robust high-resolution cloth this condition, some collisions occurred on parts of the model using parallelism, history-based collisions, and accurate friction. IEEE with sharper edges. This type of collision could be resolved if Transactions on Visualization and Computer Graphics, 99(2), 2008.
  • 8. 8 (a) (b) (c) (d) (e) (f) Fig. 15. Representative images showing the releasing and dragging of a cloth (e.g., releasing the cloth from a corner in (a) and dragging the cloth in (e)). (a) (b) (c) (d) (e) Fig. 16. Representative images showing the dragging of the cloth at a specific location (e.g., see (a)) and the subsequent response of the cloth.