A Physically Faithful Multigrid Method for Fast Cloth Simulation SeungWoo Oh KAIST Institute for Entertainment Engineering Korea Advanced Institute for Science and Technology email:
[email protected] Junyong Noh Graduate School of Culture Technology Korea Advanced Institute for Science and Technology email:
[email protected] Kwangyun Wohn Graduate School of Culture Technology Korea Advanced Institute for Science and Technology email:
[email protected] Abstract We present an efficient multigrid algorithm that is adequate to solve a heavy linear system given in cloth simulation. Although multigrid has been successfully applied to the Poisson problems, it is hard to migrate to complicated cloth deformations due to its lack of physical meaning in level construction. We addresses this problem by developing a physically faithful technique ensuring the conservation of all physical quantities across levels. The performance of our approach is demonstrated on a number of garment simulations implemented by the state of the art techniques: the implicit integration, the triangle-based in-plane energy model, and the curvature-based bending energy model. Our multigrid algorithm is about four times faster than the preconditioned Conjugate Gradient method for a garment with 20K particles.
1 Introduction Virtual garments have been widely used in film making such as Shrek and Monsters, Inc. Their usage has recently expanded to real-time applica-
tions including computer games, fashion design, and virtual fitting systems thanks to improvements in hardware and software technologies. There still exists, however, a difficulty against the practical use of virtual garments: a huge amount of simulation time. It is still a challenge to accomplish real-time simulation of realistic clothes. Optimization on current cloth simulation techniques is necessary. Implicit integration is the most popular choice in recent cloth simulations [1]. A drawback, however, is that solving a large linear system formulated by implicit integration is computationally expensive, often becoming a bottleneck. Our experiments show that the linear system solving typically takes more than a half of the entire simulation. The best solver known in cloth simulation literature is currently the Conjugate Gradient (CG) method with O(n1.5 ) time bound. In simpler domains, the multigrid method [2] is increasingly gaining popularity. It exploits a hierarchy of detail levels of the original linear system. Speedup comes from capturing global deformations more efficiently in coarse levels than in fine levels. The multigrid method achieves O(n) performance in solving a linear system derived from
elliptic PDEs. It has been used for many physics based simulations such as fluids [3, 4], volumetric deformable bodies [5, 6] and thin shells [7, 5]. To our knowledge, however, it has never been successfully applied to cloth simulation formulated with implicit integration. Our experiments verified that the standard multigrid [2] is much slower than CG and often fails to converge at a given residual error. There are several reasons for the standard multigrid method to perform poorly in cloth simulation. First, its level construction is physically incorrect causing inconsistency between different levels. Second, cloth has much weaker bending forces than in-plane forces. This yields a very low stiffness along the direction out of surface. Consequently, the system matrix becomes ill-conditioned. Third, complex deformation of cloth introduces a large number of eigenvalues in the system matrix. A garment draped on a moving avatar has a lot of deformation modes: highfrequency modes for local deformations such as wrinkling and folding; low-frequency modes for global and rigid motions. The existing multigrid techniques have only been exploited for relatively simple problems with a small number of eigenvalues. Examples includes fluid simulation [3] where the problem domain is axis-aligned or mesh editing [8] where global deformations are dominant. We propose an efficient multigrid algorithm for cloth simulation. Our contributions include • A fine level energy is conserved in the corresponding coarse level. It is possible by physically faithful reconstruction of the coarse level system matrices. Since consistency is ensured between levels, the ill-conditioned problem with many eigenvalues is handled well. • By removing redundant matrix-vector multiplications, about 30% speedup is achieved in Conjugate Gradient computation for a blocksymmetric matrix. We prove that common cloth energy models yield block-symmetric system matrices. • We do not trade quality for speed gain. Our system utilizes the state of the art techniques: the implicit integration, the triangle based stretching/shearing model, and the angle-based bending model. The speed of our multigrid is linear to the system matrix size. In practice, real-time simulation is possible for a garment with 3K particles, which is twice faster than the preconditioned Conjugate Gradient (PCG). For 20K particles, our method has ten times higher speed.
1.1 Related work Since a pioneering work by Terzopoulos et al. [9], much advance has been made in cloth simulation [10, 11]. We focus on the studies pertinent to implicit integration methods, adaptive simulation techniques, and multigrid algorithms. Baraff and Witkin [1] developed an implicit integration based simulation framework which has been widely used in cloth simulations. The framework includes the Euler implicit integration formula, the triangle-based energy model, and CG solver with fixed and sliding contact constraints. Further practical advance has been made by [12]. They introduced an immediate buckling model allowing more realistic wrinkling by stable computation of force Jacobian matrices. More advanced implicit integration schemes were discussed, such as the second-order backward difference formula [13] and midpoint implicit integration [14, 15]. They alleviate the implicit integration’s inherent damping artifacts which degrade simulation quality. The implicit integration requires solving of a large sparse linear system. Such a heavy computation is avoided by using a constant system matrix resulting from omission of some non-linear terms [16]. The adaptive method is one of popular acceleration techniques for deformable body simulation. Acceleration is achieved by allocating as many elements as the simulation detail requires. For instance, many elements are distributed on local deformation regions and a few elements on global. This area of research includes a space/time adaptive simulation of deformable body with explicit FEM [17], an easy-to-implement adaptive FEM [18], a skeleton-driven dynamic deformations using adaptive FEM [19], a multiresolution mass-spring system [20], and a subdivision-based adaptive cloth simulation [21]. Unfortunately, the original simulation quality is often lost due to the sacrifice of original dynamics for speedup. The multigrid method exploits multiresolution to solve a linear system. Multigrid was first introduced by Fedorenko in 1964 and has been popularized by Brandt in 1970’s. The method has been widely used in research fields including optimization, geometric processing, and VLSI design [2]. We focus on multigrid methods applied to physics based simulations. The standard multigrid is well suited for Laplacian and Poisson problems with axis-aligned domains as evidenced by recent advances in fluid simulation [3, 2]. Furthermore, a multigrid fluid solver has been implemented on GPU [4]. Shi et al. [8] proposed an efficient algebraic multigrid(AMG) method for mesh editing
formulated as a Poisson problem. They devised a restriction/prolongation operator specialized for mesh editing and incorporated fixed constraints into the multigrid framework. It allows interactive manipulation of a 3D mesh with about 50K vertices. It is difficult to apply the multigrid framework to thin shell simulations such as paper and cloth. Thin shell does not have an axis-aligned problem domain and yields an ill-conditioned system matrix due to the relatively weak bending stiffness. Fish et al. [7] presented a fast multigrid method suitable for a thin shell problem. They devised a restriction operator based on FEM shape functions and exploited the multigrid preconditioned Conjugate Gradient(MPCG) to effectively handle the ill-conditioned problem. Green et al. [5] also applied MPCG to thin shell simulations with subdivision based restriction/prolongation operator. However, their techniques were applied to relatively simple examples having a few number of deformation modes; cloth has a lot of deformation modes during motions.
2 Approach overview Our approach is based on a geometric multigrid framework. The coarsest mesh is recursively subdivided to construct a multiresolution geometric hierarchy (see Section 3). PDEs of the original dynamics system is defined on the finest resolution mesh. The Euler implicit integration of the PDEs requires a linear system solving [1]. The multigrid method uses four basic operators: smoothing, coarsening, restriction, and prolongation. In preprocessing, a multilevel hierarchy of the system matrix is constructed. The coarsening operator computes coarser level system matrices by restricting the finer ones from finest to coarsest. Once the hierarchy is built, the multigrid method starts to find the solution through traversing on the hierarchy. We describe a detailed procedure with a simple V-cycle traversing scheme. First, the smoothing operation is executed to damp out high-frequency errors (local deformations) on the finest level. After several smoothing iterations, we obtain an immediate solution and residual errors at that level. Second, the restriction operator subsamples the residual errors onto the next coarser level. The smoothing operation is also performed to damp out the level-specific frequency errors at the coarse level. Once this recursive process has reached the coarsest level, a direct solver is used for an exact solution. This exact solution
is interpolated by the prolongation operator to correct the immediate solution on the next finer level. The sum of the interpolated and finer level solution serves as an initial guess for the finer level linear system. The smoothing operator is again used to correct the initial guess. The prolongation and smoothing continue until the finest level is reached. The four basic operators are designed taking both accuracy and speed into account. They are as follow: Smoothing operator (Section 4): The employed iterative method should quickly converge to the solution. CG is employed due to its superiority over Jacobi and Gauss-Seidel iterations for cloth simulation. CG can be further accelerated by about 30% if the system matrix is block-symmetric. We will show that the cloth models can be formulated as block-symmetric linear systems. Coarsening operator (Section 5): Level consistency is important for performance improvement. We propose an energy conserving coarsening process in which each element’s energy is conserved from the fine to coarse level. The process is easy to implement consisting of simple dividing and merging computations of block matrices. Restriction operator (Section 6): Speed is a main factor in the restriction because of repetition through multigrid cycles. We adopt the same operator as in the standard multigrid. Intuitively it may not be the best choice for accuracy since it cannot conserve the energy in level transitions. On the contrary, we will show that accuracy increases with the uniformity of triangles. Prolongation operator: We use a simple linear interpolation as in the standard multigrid. Although simple, overall accuracy is still maintained due to energy conserving coarsening. Of course, accuracy could be improved by more sophisticated methods such as a subdivision-based prolongation [5] or an original equation-driven prolongation [8]. In our experiments, however, overall speed gain was not apparent due to their expensive computations.
3 Mesh hierarchy construction We construct a mesh hierarchy with an input cloth pattern as shown in Figure 1. First, the coarsest mesh is generated by the conforming constrained Delaunay triangulation [22]. Then each of the mesh triangle is subdivided into four as in Loop
which consists of a time-step size, h, a mass matrix, M, a force vector, f, a position vector, x, a velocity vector, v, and the unknown vector, ∆v = vn+1 − vn where the superscript, n, denotes a timestep. With the system matrix, A, and the force part, b, the above equation can be rewritten as a standard linear system, A∆v = b,
Figure 1: Multi-resolution mesh generation. Algorithm 1 A block-symmetric matrix-vector multiplication Input: a vector d ∈ R3n and a matrix A ∈ R3n×3n which is decomposed to Jint and B (= M + Jext ) Output: Ad 1: for i = 0 to n − 1 do 2: (Ad)i = Bi × di 3: end for 4: for all (i, j) such that i < j, 0 ≤ i, j < n, and Jint i j 6= 0 do 5: c = Jint i j × (d j − di ) 6: (Ad)i + = c 7: (Ad) j − = c 8: end for subdivision. The process is repeated recursively until the finest level is reached. Our multigrid simulation requires a uniform mesh structure for better performance (see Section 6. Every meshing process is followed by an optimization task to make the triangles uniform. We set every triangle to be equilateral and have the same area in the rest state. Then, the optimization minimizes the difference between the current and rest deformations with fixed constraints located on the pattern borderlines. The difference metrics are the same as in the triangle-based energy formula. The minimization is solved by the least-square solver.
4 Smoothing operator 4.1 Block-symmetric linear system Euler implicit integration provides the linear system at the finest level: µ µ ¶¶ µ ¶ ∂f ∂f ∂f n n M−h +h ∆v = h f + h v , ∂v ∂x ∂x (1)
(2)
which is again reformulated by decomposing A into the mass matrix, M, the external force Jacobian part, Jext , and the internal force Jacobian part, Jint : ¡ ¢ M + Jext + Jint ∆v = b. (3) Note the off-diagonal blocks of A are occupied only by the off-diagonal blocks of the internal force Jacobian. Thus, the system matrix is block-symmetric, if and only if, Jint is blockint symmetric,i.e., Jint ji = Ji j for every i 6= j. Here, another noteworthy fact is that decomposing above is possible for every linear system in the multilevel hierarchy by our coarsening operator, but impossible by the standard coarsening (see Section 5). This is an important property required for applying the following acceleration technique to a linear system at every level. We use CG as the smoothing operator. If s given system matrix is block-symmetric, the CG iteration can be accelerated. The matrix-vector multiplication is the most time-consuming process with much room to improve. The improvement comes from removing redundant computations caused by matrix-vector multiplications of a block-symmetric matrix. For example, let us consider a multiplication of a 3n × 3n system matrix, A, and a 3n-dimensional vector, d. This results in a 3n-dimensional vector, Ad. Its ith 3-dimensional subvector is separated into diagonal and off-diagonal parts: ¡ ¢ int int (Ad)i = Mii + Jext (4) ii + Jii di + ∑ Ji j d j . j6=i
This can be rewritten by using the identity, Jint ii = − ∑ j6=i Jint , derived from the law of action and reij action: ¡ ¢ int (Ad)i = Mii + Jext ii di + ∑ Ji j (d j − di ). (5) j6=i
In the same way, jth subvector is given by ¡ ¢ int (Ad) j = M j j + Jext j j d j − ∑ J ji (d j − di ). (6) i6= j
int If A is block-symmetric, i.e., Jint ji = Ji j , this equation can be rewritten: ¡ ¢ int (Ad) j = M j j + Jext j j d j − ∑ Ji j (d j − di ). (7) i6= j
Algorithm 2 A standard matrix-vector multiplication Input: a matrix A and a vector d Output: Ad 1: for i = 0 to n − 1 do 2: (Ax)i = Aii × xi 3: for all j ∈ Si do 4: (Ax)i + = Ai j × x j 5: end for 6: end for
Table 1: A speed comparison Algorithm 1
cmul
line 2 9n
line 5 4.5kn
line 6,7 -
cadd
6n
4.5kn
3kn
cset
3n
1.5kn
3kn
Algorithm 2 total 9n + 4.5kn 6n + 7.5kn 3n + 4.5kn
line 2 9n
line 4 9kn
6n
9kn
3n
3kn
total 9n + 9kn 6n + 9kn 3n + 3kn
a spring with the rest length, l, connecting two particles i and j. Once two particles move at the positions xi and x j , the energy is given by Es = A
¯ ¢2 k ¡¯¯ xi − x j ¯ − l , 2
where k is the spring stiffness and A is the spring area which is introduced to reduce spring model’s mesh-dependency. Then, its force and negative Hessian can be derived from a generalized formula: n−1 k For E = A (|d| − l)2 ,where d = ∑ ci xi 2 i=0
d ∂E = −Akci (|d| − l) |d| ∂ xi ! õ ¶ ∂ fi l l d dT Ji j = = −Akci c j 1− . I+ |d| |d| |d|2 ∂xj (8) fi = −
Comparing Equation 5 and 7, we see that every multiplication in the term, ∑i6= j Jint i j (d j − di ), is duplicate in entire product computations, Ad. Our multiplication algorithm improves the speed by removing the duplication. A detailed procedure is given in Algorithm 1. In Table 1, we compare it with the standard multiplication procedure in terms of computation by using the basic scalar operations: multiply, cmul , add, cadd , and set, cset . A set containing all non-zero off-diagonal blocks in the ith row of A is denoted by Si , which contains k elements on average. In conclusion, we save 4.5kn cmul and 1.5kn cadd while sacrificing 1.5kn cset . In practice, our method brings about 30% improvements on the performance of the CG iteration.
Here, we can easily draw that the Jacobian is block-symmetric as ci c j = c j ci . Consequently, any mass-spring systems can be accelerated by our method.
4.2 Block-symmetric cloth modeling
with a conventional vector form, vi j = vi − v j . The weft and warp stretching energies are written by
This section shows that the existing cloth models yield block-symmetric linear systems. Block symmetry can be verified by checking the equalint ity, Jint ji = Ji j , for every i 6= j in the internal force Jacobian part. Since force Jacobian is a negative Hessian matrix of energy, the verification is done by the energy differentiation. We will show that the block-symmetry holds in the Hessian matrices derived from all of the following commonly used cloth energy models: spring energy, trianglebased stretching/shearing energy and curvaturebased bending energy models. In mass-spring systems [23, 12], springs are used for modeling internal interactions on cloth: stretching, shearing and bending. Let us consider
Let us move onto a triangle-based stretching energy model in [1, 24], which is more accurate than the spring model because it can capture anisotropic deformation along weft and warp directions. Let us consider a deforming triangle whose vertices are particles i, j and k. They are located at position xi , x j and xk ∈ R3 in the deformed state, and ui , u j and uk ∈ R3 in the rest state. The weft deformation, du , and the warp deformation, dv , are measured by [ du dv ] = [ x ji xki ] [ u ji uki ]−1 ,
Aksu (|du | − bu )2 2 Aksv Evs = (|dv | − bv )2 , 2
Eus =
where A is the triangle area in the rest state. Their Jacobians can be derived from Equation 8 because du and dv are given in the first-order polynomial vector form, p. Hence the triangle-based stretching energy model also results in a block-symmetric Jacobian. For the shearing energy, an angle-based model can be employed as in [1]. Unfortunately, this does not a yield block-symmetric matrix. Thus, we take a simple energy model as used in [23][25], which is
based on two shearing deformations: du + dv and du − dv : √ ´2 Akh ³ |du + dv | − 2bh 2 h³ √ ´2 Ak |du − dv | − 2bh . Ebh = 2 Eah =
Since this has the same type of energy as in Equation 8, we obtain a block-symmetric Jacobian. For bending, we can use simple models [26, 27] which produce block-symmetric Jacobian matrices.
5 Coarsening operator The coarsening reconstructs coarse level system matrices from finer ones. Ideally, this operation should yield a physically consistent matrix. Unfortunately, the standard multigrid operation often fails to do so. It coarsens the system matrix, Ah , by using the restriction operator, R, and the prolongation operator, P: A2h = RAh P, where R is a full-weighting matrix and P is a linear-interpolation matrix (see [2]). Figure 2 shows a result of this coarsening. As can be seen in the figure, a diagonal block of Ah is subdivided and merged into some off-diagonal blocks of Ah . This indicates that the mass matrix and external force Jacobians at a fine level are used for the internal force Jacobians at the coarse level. Such an inconsistency causes the standard method to fail in cloth simulations. To ensure consistency between levels, we propose a physically faithful operator guaranteeing the conservation of all physical quantities across levels. Mass and energy on a fine level area should be locally distributed in the corresponding coarse level area without any loss. A separate operation is developed for each of the physical quantities included in the system matrix. It is composed of simple dividing and merging process of block matrices.
5.1 Mass matrix and external force Jacobian Every particle on a cloth surface has a mass proportional to its Voronoi region area assuming uniform mass-density. Consider a Voronoi region constructed on each of two level meshes. Let us define Sim as a set containing all the fine level
particles whose Voronoi regions are covered by a coarse level particle i’s region. For guaranteeing mass conservation through the coarsening, a fine level particle, j, has to distribute its mass to i by as much as its overlapped Voronoi region with i’s. Summing contributions of all vertices in Sim , results in i’s mass matrix: A ji f Mci = ∑ M , Aj j j∈Sm i
where A j is j’s area and M jf is j’s mass matrix, and A ji is the amount of j’s Voronoi region area overlapped with j’s. External forces of a particle, such as the wind force and air viscosity, increase with its Voronoi region area. Since Jacobians are also proportional to the area, the same procedure as in mass coarsening is applied to external force Jacobians.
5.2 Stretching/shearing force Jacobian In our mesh hierarchy, a coarse triangle is mapped onto four fine triangles as depicted in Figure 1. Energy in a coarse triangle, T c , is given as the sum of the four triangle energies: E c = ∑ Eif ,
(9)
i∈S
where S is a set containing T c ’s four sub-triangles. Our goal is to derive Jacobian matrices from E c . A Jacobian might be computed from each coarse level triangle energy, Eif , and then summed into the fine level Jacobian. However, the Jacobian is not given as the sum of fine level Jacobians as in the external force Jacobian case. This is because in-plane force Jacobians are not proportional to the triangle area as can be seen in Equation 8 which has three area-dependent coefficients, A, ci and c j . To reflect the non-linearity on Jacobian computation, we consider a fine triangle expanded into the coarse triangle area, Ac , with the same deformation, dc (= d f ). According to the energy conservation, the expanded triangle area is given by summing each of fine triangle area: A˜ = Ac = ∑i∈S Aif . ˜ is computed The expanded triangle Jacobian, J, using Equation p 8. As the coefficientsp are given as, A = Ac , ci = cif A f /Ac , and c j = c fj A f /Ac , the following equality is derived: J˜ = J f .
(10) Af
Ac ,
As the fine level triangle takes of its energy ˜ is rewritten with the expanded triangle energy, E: µ f¶ A ˜ E. (11) Ef = Ac
Figure 2: Restriction and coarsening on an equilateral mesh. Each colored block represents either a subvector or a sub-matrix. (a) The full-weighting restriction. (b) The standard coarsening operation. It distributes mass and external force Jacobians at a fine level into internal force Jacobian at a coarse level, yielding a physically incorrect system. In contrast, our approach offers a coarsening operation for each physical quantity: a mass coarsening (c) and a in-plane force Jacobian coarsening (d). Applying Equation 11 in Equation 9 and deriving the Jacobian by Equation 10 result in Aif f J . c i i∈S A
Jc = ∑
The Jacobians computed on the expanded triangles are summed into the corresponding coarse level Jacobian. The correspondence is constructed by a fine-to-coarse mapping of triangles: f f f f c (the notation follows , T542 , T453 7→ T012 T035 , T314 Figure 3). The mapping also offers the corresponf f , e31 dence for edges or vertices. For example, e03 f and e54 are on ec01 . The internal force Jacobian is mapped onto each edge of a triangle as it is related to two linked particles (see Equation 8). Each fine level Jacobian corresponds to the Jacobian mapped on a coarse level edge. The correspondence results in a coarse level Jacobian: Aif f J , c i,e i∈S A
Jce = ∑
f is a Jacobian of a fine level triangle, i, where Ji,e corresponding to an edge, e, of the coarse triangle.
Note that this is identical to the Jacobian derived from direct differentiations wherever only planar deformations exist. Consequently, we have developed an energy-conserving linear operator which can assemble the coarse level Jacobian with the four fine level Jacobians. Thus, our coarsening operation can be implemented by a simple dividing and merging scheme of block matrix as depicted in Figure 2.
Figure 3: Correspondence between levels for inplane (a) and bending forces (b)
5.3 Bending force Jacobian A coarsening operator for a bending force Jacobian is developed in the same way as the inplane force case. Bending-wing pairs are considered, not triangles, resulting in two differences in the energy-conserving procedure: the element correspondence and Jacobian computation. A coarse bending-wing pair has four fine pairs. The correspondence between levels is constructed as in the example of Figure 3: f f f f c . 7→ W0312 ,W4872 ,W8617 ,W5368 W0584 Different from the in-plane case, a magnitude of Jacobian changes after expanding a bending-wing pair: Af J˜ = c J f , A where A f and Ac are area amounts before and after the expansion. Equation ?? draws the equation as its variables are given by n = (Aif /Ac )n f and x =
q
Aif /Ac x f .
Reflecting the two differences to the energyconserving procedure, the Jacobian on each edge of a coarse bending-wing pair is obtained: Ã Jce = ∑
i∈S
Aif Ac
!2 f Ji,e ,
f where Ji,e is a Jacobian of a fine bending-wing pair, i, corresponding to an edge, e, of the coarse pair.
6 Restriction operator Speed of the restriction is crucial for fast multigrid cycling due to its repetition. We adopt the same simple operation as used in the standard multigrid, called full-weighting scheme. Figure 2 (a) shows its procedure where the residual of a fine level midparticle, located on a midpoint of a coarse level edge, is split and merged into its both ends (we call these by parents of the mid-particle). Uniform meshes can improve the accuracy of fullweighting scheme. The scheme completely conserves external energies and stretching/shearing energies during operation on equilateral triangular meshes. Therefore, accuracy increases with the uniformity of triangles. We henceforth prove the energy conservation on equilateral meshes by comparing the results of the full-weighting and energy-conserving schemes. External energies and forces of every particle are proportional to its Voronoi region area. Let us again consider the Voronoi regions constructed on a fine and coarse level meshes. On an equilateral triangular mesh, a half of a mid-particle’s Voronoi region is included in each of its parents’ regions. Thus, external force of the mid-particle is split and merged into its parents. This is the same process as the full-weighting scheme. The full-weighting operation transfers a half of internal forces of a fine triangle into the coarse triangle. In Figure 3 (a), the forces transferred from f c are given in, fc = 1/2f f , fc = 1/2f f , to T012 T035 1 3 2 5 and fc0 = f0f + 1/2f3f + 1/2f5f . As the sum of internal forces is zero, i.e. f0f + f3f + f5f = 0, an equality, fc0 = 1/2f0f , holds. Hence, the internal force decreases in half during the transfer. This is true for all the other fine level triangles. The energy-conserving scheme also reduces the transferred force to a half. The same energyconserving procedure in Section 5 can be applied
to the force restriction. Force on an expanded triangle is given by r c ˜f = A f f , Af q f as A = Ac and ci = cif AAc in Equation 8. Force on a coarse triangle is given by s Aif f f , fcv = ∑ Ac i,v i∈S f where fi,v is a force of a fine triangle, i, corresponding to a vertex, v, of the coarse q triangle.
In the case of equilateral meshing, as
Aif /Ac =
f 1/2 and fcv = ∑i∈S 12 fi,v , we conclude the energyconserving scheme has the same procedure as the full-weighting.
7 Experimental Results 7.1 Setting We implemented our method on a PC with a 3.0GHz Pentium IV CPU, an NVIDIA GeForce 7800 GTX GPU, and 2GB memory. Our simulator employees the triangle-based stretching/shearing model, the curvature-based bending model, and the implicit integration with second-order backward difference formula. For body-cloth collision handling, our system detects collisions between body triangles and cloth particles only. Contact constraints are incorporated into the linear system as in [1]. To test cloth-cloth collisions, we compute the distance of particle-particle pairs. A strong spring force is inserted to push the colliding particles apart. The spring force were also incorporated into MG in the same energyconserving way as in triangle-based forces. For culling the majority of pairs, a spatial partitioning method(voxel) is used. We implemented a V-cycle MG algorithm with a three-level hierarchy over all examples presented in this paper. The other cycling schemes such as W-cycle or full-multigrid did not show much improvement. Although a higher level hierarchy allows better performance, it might cause unrealistic wrinkles. In our case, the number of optimized level was three. The smoothing iteration is controlled by the residual error. In the standard MG smoothing, the iteration count is fixed as an input by a user. Thus it cannot handle either varying deformation modes
Table 3: Timing results for falling and walking simulation: time is given in milliseconds. Falling simulation Particle 1189 2397 4491 9919 #. PCG 16.0 49.2 130.5 418.3 MG 3.3 9.0 19.6 55.5 Walking simulation Particle 1189 2397 4491 9919 #. PCG 12.7 42.62 117.6 471.0 MG 6.3 18.7 44.1 152.9
19014 1396.2 147.5 19014 1687.3 458.9
Table 4: Speed comparison with respect to material type: time is given in milliseconds. Figure 4: Animation results: all simulations ran at 3–10 fps.
Material silk type. PCG 79.0 MG 17.2
wool cotton
denim
leather
90.9 17.8
136.6 21.9
145.8 20.9
131.1 19.6
Table 2: Stiffness for various cloth materials Material type. Stretching K Shearing K Bending K
silk
wool cotton denim leather
3.0
4.0
8.0
10.0
13.0
1.5
2.0
4.0
5.0
8.0
0.03 0.2
0.8
2.5
5.0
over an entire simulation period or varying levelspecific frequency errors over an MG cycle. For example, it must run a fixed number of iterations even though no level-specific frequency errors remain. In our approach, the smoothing operation runs until the residual error is reduced to a value determined by the user-defined decreasing ratio, cd , i.e. |r|n /|r|0 < cd , yielding a better adaptivity to deformation modes. For all experiments, the decreasing ratio of residual errors was fixed at 0.4. Collision constraints are incorporated into MG by a simple scheme. Every fine level constraint is transferred into the coarse linear system as it is, introducing a new constrained level system. However, this scheme causes the inconsistency between levels. This problem should be addressed in future.
7.2 Results The performance of cloth simulation depends on the mesh complexity and on the material stiffness.
We performed experiments with respect to these two criterions. Speeds of the PCG and our MG were compared by simulations of a garment with increasing mesh complexity. The simulations were performed with a cotton material stiffness and a 10−4 relative residual error. An average computational time is given in Table 2 during a given period of falling simulations of the deformed garment. Although MG is not linear to the complexity, it is about ten times faster than PCG for 20K particles. Speed comparison with a variety of material types are given in Table 3. The stiffness was determined by visual comparisons between a real and virtual garments, given in Table 1. A 10−4 relative residual error and a garment with 4, 491 particles were used for these experiments. Our MG method shows a nearly constant performance while the PCG’s performance increases with the stiffness. To see the influence of collision constraints on our MG, we performed simulations of a garment draped on a walking avatar. Our method became from two to three times slower than in the falling simulation while PCG’s performance was improved in some experiments. This problem is caused by the simple constraint transferring. Nevertheless, our approach showed about four times speedup over PCG for 20K particles. Our work has been applied to an interactive garment prototyping system like [24]. This system enables us to modify a 3D garment without the
time-consuming draping process. Once a user manipulates a 2D pattern, our system computes its mesh deformation and then transfer it to 3D garment. Our fast MG allows an interactive design of garments with about 10K particles.
8 Conclusions We developed an efficient multigrid-based cloth simulation technique. A fast multiplication method was proposed for the block-symmetric matrix, allowing about 30% speed gain in the Conjugate Gradient computations. We also proved that common cloth models yield the block-symmetric system matrices. Our major contribution is the physically faithful method to reconstruct coarse system matrices. This allows successful application of the multigrid framework to complicated cloth deformations. There are a few avenues for further improvement. Collision handling in multigrid. Speed gain of our method decreases in collision-intensive examples. If there were only fixed constraints, much improvement could be achieved by the algebraic multigrid method as used in [8] where the hierarchy is constructed leaving out constrained nodes. A difficulty is that sliding constraints are dominant in garment simulations. An efficient constraint incorporation scheme is necessary to overcome this problem. Optimized smoothing iteration control. Current smoothing iterations are controlled by the userdefined target residual errors. Although it performs better than the standard, more optimization may be desirable, such as maximizing the residual decreasing speed during multigrid cycles. Extension to algebraic multigrid. Our method is based on the geometric multigrid. It can lead to unnecessarily high mesh resolution on small cloth patterns like ribbons and belts. Since algebraic multigrid method constructs the hierarchy only from the information on a linear system, it might be a good candidate despite the slower performance than the geometric multigird. Our coarsening operators should be extended to the algebraic multigrid for more compatibility.
References [1] D. Baraff and A. Witkin. Large steps in cloth simulation. In Proceedings of ACM SIGGRAPH 98, pages 43–54. ACM Press, 1998. [2] P. Wesseling. An Introduction to Multigrid Methods. R.T.Edwards, 2004.
[3] J. L. Thomas, B. Diskin, and A. Brandt. Textbook multigrid for fluid simulations. Annumal Reviews in Fluid Mechanics, 35:317– 340, 2003. [4] J. Bolz, I. Farmer, E. Grinspun, and P. Schr¨oder. Sparse matrix solvers on the gpu: Conjugate gradients and multigrid. Proceedings of ACM SIGGRAPH, 2003. [5] S. Green, G. Turkiyyah, and D. Storti. Subdivision-based multilevel methods for large scale engineering simulation of thin shells. In ACM symposium on Solid modeling and applications, 2002. [6] J. Georgii and R. Westermann. A multigrid framework for realtime simulation of deformable volumes. In Workshop on Virtual Reality Interaction and Physical Simulation, 2005. [7] J. Fish, L. Pan, V. Belsky, and S. Gomma. Unstructured multigrid method for shells. International Jounal for Numerical Methods in Engineering, 1996. [8] L. Shi, Y. Yu, N. Bell, and W. Feng. A fast multigrid algorithm for mesh deformation. In Proceedings of ACM SIGGRAPH, 2006. [9] D. Terzopoulos, J. Platt, A. Barr, and K. Fleischer. Elastically deformable models. In Computer Graphics (Proceedings of ACM SIGGRAPH 87), pages 205–214. ACM Press, July 1987. [10] D. House and D. Breen, editors. Cloth Modeling and Animation. A.K. Peters, 2000. [11] P. Volino, F. Cordier, and N. Magnenat-Thalmann. From early virtual garment simulation to interactive fashion design. ComputerAided Design Journal, 37:593–608, 2005. [12] K.-J. Choi and H.-S. Ko. Stable but responsive cloth. ACM Transactions on Graphics (ACM SIGGRAPH 2002), 21(3):604–611, July 2002. [13] M. Hauth and O. Etzmuß. A high performance solver for the animation of deformable objects using advanced numerical methods. Computer Graphics Forum (Eurographics 2001), 20(3):319–328, September 2001. [14] P. Volino and N. Magnenat-Thalmann. Implementing fast cloth simulation with collision response. In Proceedings of Computer Graphics International (CGI 2000), pages 257–268. IEEE Computer Society, June 2000. [15] P. Volino and N. Magnenat-Thalmann. Implicit midpoint integration and adaptive damping for efficient cloth simulation. Computer Animation and Virtual Worlds, 16:163–175, 2005. [16] M. Desbrun, P. Schr¨oder, and A. Barr. Interactive animation of structured deformable objects. In Proceedings of Graphics Interface (GI 1999), pages 1–8. Canadian Computer-Human Communications Society, 1999. [17] G. Debunne, M. Desbrun, M.-P. Cani, and A.H. Barr. Dynamic real-time deformations using space time adaptive sampling. In Proceedings of ACM SIGGRAPH, 2001. [18] E. Grinspun, P. Krysl, and P. Schr¨oder. Charms: A simple framework for adaptive simulation. In Proceedings of ACM SIGGRAPH, 2002. [19] S. Capell, S. Green, B. Curless, T. Duchamp, and Z. Popovi´c. Interactive skeleton-driven dynamic deformations. In Proceedings of ACM SIGGRAPH, 2002. [20] J. Villard and H. Borouchaki. Adaptive meshing for cloth animation. In Proceedings of the 11th International Meshing Roundtable (IMR 2002), pages 243–252. Sandia National Laboratories, 2002. [21] V. Volkov and L. Li. Adaptive triangular meshes for cloth simulation. Research Journal of Textiles and Apparel, 2005. [22] J. R. Shewchuk. Delaunay refinement algorithms for triangular mesh generation. Computational Geometry: Theory and Applications, 22(1-3):21–74, May 2002. [23] X. Provot. Deformation constraints in a mass-spring model to describe rigid cloth behavior. In Proceedings of Graphics Interface (GI 1995), pages 147–154. Canadian Computer-Human Communications Society, 1995. [24] P. Volino and N. Magnenat-Thalmann. Accurate garment prototyping and simulation. Computer-Aided Design and Applications, 2, 2005.
[25] K.-J. Choi and H.-S. Ko. Extending the immediate buckling model to triangular meshes for simulating complex clothes. In Eurographics 2003 Short Presentations, pages 187–191, 2003. [26] P. Volino, M. Courchesne, and N. Magnenat-Thalmann. Versatile and efficient techniques for simulating cloth and other deformable objects. In Proceedings of ACM SIGGRAPH 95, pages 137–144. ACM Press, 1995. [27] M. Bergou, M. Wardetzky, D. Harmon, D. Zorin, and E. Grinspun. A quadratic bending model for inextensible surfaces. In Eurographics Symposium on Geometry Processing, 2006.