Realtime Cloth Simulation
Stephen Blinick  -- December, 1999



 The purpose of this project was to explore real-time modeling and simulation of cloth.  The main goal was to design and develop a simplified calculation model that would accurately exhibit the properties of woven cloth.  A variety of modeling methods were tried, but all were based on a discrete particle representation of the cloth surface.  All methods showed varying levels of success.

The particle based representation
 The cloth modeled in the simulation is represented by a grid of particles with mass-less connections between them.  This allowed for the program to perform the calculations on the cloth on a particle basis, looping through each particle.  Each particle is defined by a mass, pointers to its neighbors, and its desired distance to any neighbor.  For every iteration in the simulation, the distance from each particle to each of its neighbors is re-calculated, and the values for velocity and position of the particle are re-calculated based on the distance.

Hooke’s Law
 The connections between the mass-less particles were modeled as springs, to approximate the stretch ability of woven cloth.  Hooke’s Law is the law that describes the force between two points connected by a single spring.  This force value is defined as:
 F = -Kx
Where F is the force value between the two points, K is some arbitrary constant between 0 and 1, and x is the stretched distance amount of the particle.   This means that when the two particles are at their “optimum distance” from each other, x is zero, and therefore the force is zero.  As the distance between them increases, F, which is a vector quantity, becomes a larger negative number, meaning that the two particles are being pulled back together.  Likewise if the distance between the particles is less than the optimal distance, the force pushes them apart.

Approximating the differential equation
 Every particle in the cloth has a velocity and position.  Since we are simulating woven cloth, every particle’s velocity or position is based on the velocity and position of every other particle.  This creates a very complex differential equation, which cannot be explicitly solved.  The goal in accurately simulating the cloth in real-time is to approximate this equation for each particle over a small time step (1 frame of movement, for example).
 All the simulation techniques allowed the forces between each particle to change instantaneously, and then calculated the change in the other values over the time step based on the forces.  This meant that any drastic change in the force resulted in a drastic change in the velocity and then position.  Since the force is directly calculated from the position, there were many cases where the simulation would become unstable, sending each of the particles on extremely high velocities back and forth.

 This problem also occurred when the time step was too large for the current state of the simulation.  For example, if the particles in the system were moving very fast, a time step the length of an entire frame may be too large, because such a coarse granularity would produce a large movement, which would in turn produce a large force, sending the simulation out of control.
 Finally, it became apparent that all of the methods for approximating the equation needed a time step size that could vary depending on the current state of the simulation.  To arbitrarily decrease the time step to a constant value would unnecessarily create a large amount of calculating, even when forces were small.

Euler’s Method
 Euler’s method was one of the first approximation methods used for modeling the cloth.  Euler’s method is a simple summation of the derivative function at each time step to approximate the integral.  For the simulation, each  time step the  forces between each particle were calculated.  The force was then summed into velocity for each particle, and the velocity was summed into the position of the particle, which modified the system so the forces were different the next time step.

 This method made the grid of points behave a lot like actual cloth, including “billowing” back and forth when perturbed.  One of the problems with this method of simulation was that the cloth was extremely “stretchy”, as the bonds between the particles expanded and contracted around their equilibrium point, looking for a way to correctly balance the force of gravity with the force holding the points together.

Second Order Taylor Series
 This method is quite similar to Euler’s method (which is in fact a first order Taylor series), except that the position at each time step is based on its second derivative, force, as well as velocity.  This essentially allows for forces that are compensating for the motion of the cloth to modify the position much faster and therefore have a greater effect.  The result was that the “stretchiness” of the cloth was reduced somewhat.

Second Order Runge-Kutta Method
 The Runge-Kutta method is a way to approximate the value of a function by only knowing that functions first derivative.  In this simulation, I approximated the value for velocity without knowing anything more than the first derivative of velocity, acceleration (force).  This method works by plugging in different values to the force equation (Hooke’s Law) for a single time step, therefore providing a “look ahead” which shows what the force will be in the next time step.  The result of using this method of simulation is that the system found an equilibrium point faster than the other two methods of simulation, and therefore appeared less “stretchy”.

Going Further
 In addition to the above methods of simulation, I would like to try the Fourth Order Runge-Kutta method,  which is much more computationally intensive but allows for an “error value” look ahead, whereby the amount of error in the calculation at a time step can be predicted and the time step can then be shortened to  more accurately model the function before the  more inaccurate time step is taken.
 
 It might also be advantageous to look at other ways of representing the cloth surface or of simulating the cloth.  Perhaps some method which does not use springs would be more accurate, because the thread in cloth does not behave much like a spring, and only allows a small amount of deformation.