CS 480 Project 1, Christopher Start

What is it? : Creating realistic cloth simulation such as that of a piece of fabric falling onto some object (like a ball or table) or some fabric being affected by another force such as wind and gravity.

What is it used for? : Immediate applications would be games and simulations - anywhere that cloth and physics could be used in conjuction with each other.

How it works... (or can work)


Characteristics of Cloth

Simple, Massless Cloth Model (/Method)

Using a network of points to create the surface, one can simulate cloth!

This is often referred to as a spring network (though I personally don't think the term quite fits since there is minimal to no stretching between the points, they don't seem to act much like springs). For each point, when calculating relative forces from the neighbors, comparing to the 4 nearest neighbors is the minimum but gets you something that acts much like a fisherman's net (as described from this source). But if you up the number of neighbors to the nearest 8, you will get a very flexible cloth. Upping it to the 24 nearest neighbors will get a more realistic, stiffer cloth that is much slower to compute. For each point you must have an associated velocity and location. You should include some form of collision detection for the points so that the cloth does not break the rule about passing through solid objects (and can instead wrap around or slide off of the object(s)).

Making It Look Good (Adding Wind)

First Note: This is more for simulations, from what I have found most games don't so much continuously simulate cloth in these instances as they just make a decent looking fluttering model and let it replay.

Second Note: We will be disregarding the component of the wind being affected by the cloth for this description. This allows us to bypass a large amount of fluid dynamics calculations and simplifies the explanation substantially.

Assuming you are using the model described above (spring/mesh network), derive a loop that will break down the cloth into triangles. Apply the force of wind to each of the points (members) of the triangle. This force is computed by the unit vector normal of the triangle multiplied by the dot product of the normal and wind vectors.

Computation: force = unitvector(normal) * dotproduct(normal, wind)

Apply this wind force to the points involved, cycle through all the points (triangles) of the cloth, then apply the other forces (gravity, etc) and update positions!

Timesteps / Stability

This was a major component of most of the websites found on the topic. The general consensus from the different pages was that smaller timesteps are much more stable but are far slower (and computationally intensive) versus large timesteps. If the timestep is too large, the simulation will essentially fail. In fact, in the references below, this particular paper was describing a method for increasing the size of the timesteps while keeping the simulation stable (thus stable and faster!). Each different page described what seemed like an arbitrary balance that worked for their particular simulation and what they were trying to do.

Interaction with Objects and Collision Detection

This was left as an exercise to the reader in the pages referencing cloth simulation. The specific method used seems to be arbitrary by each developer of any particular project and is most likely done using similar methods discussed previously in class. The most straight-forward method would be defining other objects in the scene as a class with a "no go" zone defined in three-dimensional space by points, and making sure none of the points belonging to the cloth enter the "no go" zone, similar to the particles falling around the invisible ball in Dr. Lawlor's demo. As was shown in previous presentations, this is by far no simple task to enable properly (realistically).

CPU vs. GPU

The method described above and the pages below all describe methods for cloth simulation which use the CPU. This is one reason that performance with the proper timesteps is so crucial. With further research, I discovered that nVidia has supposedly created a method for doing cloth simulation on the graphics card (which would theoretically be much faster as working on numberous points simaltaneously would be its specialty). nVidia's website suggests that it's PhysX package includes the necessary tools for proper cloth simulation (and beyond). In fact, the "cloth simulation" has been expanded upon to simulate objects such as sheet metal on a car so that it can properly simulate dents and other damage on the metal (beyond acting like traditional cloth as one would think of in the real world).

References