This is a realistic realtime physically-based simulation of the movement of a piece of cloth handling collision with the environment, self-collision, and friction.
There are three challenging components to successfully performing realtime simulation of cloth collision:
This simulation is a project for a graduate level class in Graphics and Simulation taken at University of California, San Diego. It was done under the guidance of Steve Rotenberg.
The model of the cloth is a mass-spring model. It is composed of particles connected through springs.
Particles have mass, position and velocity, and are the recipients of forces. At each iteration now positions nad velocities are computed based on the forces applied to the particle.
There are three different types of springs. Structural springs deal with stretching, shear springs deal with shear, flexion springs deal with bend. Each spring have contants which are used to compute the spring and damper forces from the springs.
The spring contants determined characteristics of the cloth, for example, if it is stretchy or stiff. Video 2 shows the difference in movement when a force is applied to a stretchy and a stiff piece of cloth.
Collision detection is computationally expensive, since it needs to check for potential collisions of all points of the cloth with all objects in the environment at each time step.
An acceleration structure is used to eliminate unnecessary testing. Video 3 shows an AABB tree in use. The green boxes represent the tree nodes not being tested for potention collision during the time step.
In addition to using an aceleration structure, I also implemented a two-stage collision detection algorithm in order to speed up computation time.
The first stage: proximity detection and response
The second stage: geometric collision detection and response
The first stage eliminates almost all collisions, leaving only a few collisions for the second stage.
