Cloth Simulation with Self-Collision Detection

Overview

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:

  • Cloth model
  • Accelleration Structure
  • Collision Algorithm

Acknowledgements

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.

Cloth model

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.

Accelleration structure

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.

Collision algorithm

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

  • is computationally cheaper
  • is used to prevent collisions from happening
  • detects proximity, then applies an inelastic impulse and a spring based repulsion force.

 

The second stage: geometric collision detection and response

  • computationally more expensive
  • deals with the actual collision.
  • detect geometric collision by updating the AABB tree and performing collision test for intersecting bounding boxes.

 

The first stage eliminates almost all collisions, leaving only a few collisions for the second stage.

Outcome

  • Programming (C++)
  • Implementation of advanced physical and mathematical models