Our first cloth sample is of silk. To create this artifact we set the
spring constants to relatively loose values (relative to the scales
prespecified in our demo executable below), and we also lower our
repulsive force coefficient. This way the cloth glides smoothly
through the air, doubles over upon itself very easily, and also glides
slickly across itself and the cage walls. (Note that this last effect
relative to the cage is due to the ability of the silk vertices to
fall quickly -- even in the close presence of other vertices -- rather
than to any inherent "slickness" of the material.)
Our next sample is of felt.
In our demo, felt is very much the opposite of silk. The spring
constants are set far more tightly, and the repulsive force is brought
up. As seen in the graphic to the right, the cloth does not fall upon
itself nearly as readily as silk, mirroring the inflexibility of real
felt. This effect also makes the felt seem to stick to the walls, as
real felt will do against certain surfaces (such as glass).
Our penultimate sample is a crumpled
paper artifact. The
model springs are extremely stiff, as if simulating several pieces of
newspaper lying in the middle of the street. Pulling on the paper
will cause it to unfurl a bit, but after it hits the ground and rolls
for a while, it will crumple back into its original form. The
crumpling effect itself is achieved by setting the shear springs'
resting distances to a smaller value than the structural springs'
resting values!
Our last sample is a cloth with default parameters,
which simulates perhaps a sturdy polyester-nylon mesh, such as one
might find in a flag. In fact, by turning
the cage on its side (so that gravity acts like wind), tacking the
cloth to the ceiling, and adding an inspiring spiritual emblem, we
modeled precisely that artifact here!
Executable
This executable file should work on any recent Windows system with
FLTK and OpenGL libraries. The C++ source was written in Microsoft
Visual Studio.
Using the simulation is straightforward. Sliders control the various spring and environment parameters. The left mouse button allows the user to pull the cloth, while the right button acts as the trackball handle to rotate the entire 3D world. The middle button "tacks" the point on the cloth closest to the mouse to its current position in space. Clicking a visible tack with the middle button again releases the tack. Also note that there are preset button controls to switch between parameter settings for the default cloth, the silk, the felt, and the crumpled paper models. The user can also overlay our flag image on the cloth at any time.
Note: Due to the explicit Euler method used in our simulation, it is possible to make our model "explode". This interesting visual effect usually happens only if there is too much strain on the system, such as in a cloth with very stiff spring constants and large repulsion forces, which is flung rapidly through the air and then asked to stop suddenly with several different tacks that stretch the grid well out of its resting position. If you experience such an explosion, it is sometimes possible to restore the cloth to its normal state by relaxing the spring constants and/or decreasing the repulsive force coefficient.
Download the executable cloth simulation here: Cloth Simulator 2000.
Download our inspiring flag image here: Zoran Popovic!