Large Steps in Cloth Simulation Safeer C Sushil Kumar Meena Guide: Prof. Parag Chaudhuri
Introduction Cloth modeling a challenging problem. Phenomena to be considered Stretch, shear, bend of cloth Interaction of cloth with itself (while collision) Interaction of cloth with other objects (collision, sliding). Interaction with fluid. Such ranges of phenomena to be considered make the problem challenging.
Introduction Most other method take small steps to avoid numerical instability in the solution. This system uses implicit integration as opposed to direct integration method in most other methods. This allows to have large time steps while maintaining stability.
Simulator Architecture Cloth represented as triangular mesh of particles n particles. Position of particle i, x i R 3. Geometrical state of all particles, x R 3n. Force acting on particle i, f i R 3. Force acting on cloth, f R 3n.
Triangular Mesh http://www.mathworks.com/matlabcentral/fx_files/25555/1/mesh3.png
Forces and Energy overview Stretch force Resist in-plane compression/ stretch. A cloth typically does not stretch. Coefficient of stiffness very high for our case. Shear and bend force. Corresponding three damping forces. Additional forces Gravity, air drag. User given mouse forces (for interactive behavior).
Constraints overview Individual particles velocity/position can be constrained in any dimensions. Constraints due to cloth s interaction with other solid objects. Cloth/cloth interactions.
Implicit Integration Equation of motion: (x -> position, v -> velocity, M -> Mass Matrix) Forward Euler method: Implicit backward Euler method:
Implicit Integration Contd Taylor series approximation to first order: Final implicit equation: Unknowns: f o Derivative of f w.r.t x. Derivative of f w.r.t v. To be evaluated: Δ v
Representation of Energy and Force E(x) scalar potential energy. f = E/ x and f/ x can be calculated. Handling E as single monolithic function becomes difficult. E(x) = Σ α E α (x), where each E α depend on few elements of x. Formulate vector condition C(x) and define energy as k/2c(x) T C(x). {k stiffness constant} Condition vector is analogous to x for spring energy equation E= 1 / 2 kx 2. This formulation helps in representation.
Force and Force Derivatives f i = - E c / x i. Similarly, derivative of f i w.r.t x can be taken. Since, C does not depend of v derivative of f w.r.t v is zero. Now, only task is to formulate C for different forces.
Stretch Forces (u i, v i ) fixed plane coordinates of particle, when cloth is at zero stretch/bend/shear. W(u,v) mapping from plane coordinates to world coordinates. Stretch can be measured with derivatives w u = w / u and w v = w / v at that point.
Stretch Forces contd Consider triangle with particles (i, j, k). Consider Δx 1 = x j x i and Δx 2 = x k x i. Define similarly Δu 1, Δu 2, Δv 1 and Δv 2. Assuming w u and w v constant over a triangle, Δx 1 = w u Δu 1 + w v Δv 1, and Δx 2 = w u Δu 2 + w v Δv 2. These equations can be solved to get w u and w v.
Stretch Forces contd Condition vector Where, a area of the triangle, generally, b u = b v = 1 but b u can be increased if we want to stretch cloth in u direction.
Shear Forces Extent of shear in a triangle can be measured by w ut w v. Since stretch coefficient is very high, shear angle can be approximated as w ut w v. Condition vector is simply, C(x) = aw u (x) T w v (x).
Bend Forces Bend is measured as angle between pairs of adjacent triangles, θ. Condition number is simply, C(x) = θ.
Additional Forces Air drag per-triangle basis. Gravity on all particles. User given forces (mouse drag) given to particles selected by user.
Damping So far, forces depended only on the position. But for realistic cloth features, damping forces which depend on velocity also are important. A damping force, d, should be in the direction of f, the force which it is damping: C(x) / x. Strength should be proportional to velocity: Ċ(x), derivative of condition vector w.r.t time.
Damping contd Final equation of force is, We also need to calculate, d i / x j and d i / v j. Please note that in this case d i / v j is not zero and needs to be considered. Above quantities can be easily calculated (not mentioning the derivation for the purpose of simplicity).
Constraints (Mass Modification) A constraint can be imposed by making mass infinite, or inverse mass zero. Remember: we need M -1. Represent mass of a particle as 3x3 diagonal matrix with diagonals 1/m i. Make row 3 zero to constraint particle in z direction.
Constraints (Mass Modification) contd Constraint can be in any direction. If p and q are direction in which particle is constraint, then inverse mass matrix is 1/m i (I pp T qq T ). Replace M -1 in the equation of motion with W (3nX3n matrix). If z i is the change in velocity we wish to enforce on constraint particle i, instead of zero, final equation becomes
Implementation Use Conjugate Gradient method to solve the equation. Ax = b. Where A has to be symmetric and positive definite. Without constraints, just multiply left by M (W -1 )
Implementation contd With constraints W -1 is singular. Use of normal equations: For solving Ax = b, multiply both sides by A T. (A T A)x = A T b A T A is now symmetric. Involves the cost of multiplication. Alternative, use modified CG method as mentioned in the paper (see references). We are not attempting that method.
Conjugate Gradient Method f(x) = 1 / 2 x T Ax x T b f (x) = Ax-b r k = b Ax k
Conjugate Gradient Method http://en.wikipedia.org/wiki/conjugate_gradient_method
Implementation Target Simulation of a simple cloth (like flag) without constraints and collisions, but with air drag. Optional: Solving system with constraints.
Reference