Verlet Cloth


Overview
Cloth simulation utilising Verlet integration and soft constraints.
It is written in C++ and uses OpenGL for rendering.

Cloth simulation
The cloth is represented as a series of particles connected by constraints.
Each particle has position, a position from the last time-step, the forces currently applied to the particle, a mass and flag noting if the particle is fixed in 3d space or not.
The constraints link several particles together making the cloth keep its shape.

Every update the particles’ positions are updated with the current affecting forces. Verlet integration implicitly stores the velocity using the current and previous position of the particle, and acceleration is applied from the forces upon the particle.
The constraints are then relaxed by pushing or pulling particles together or apart till the constraints reach their original length.

OpenGL rendering
It makes use of an OpenGL 2.1 context and the programmable pipeline to display the cloth. A skybox is also displayed and a blurred version is used in a cubemap (with care to ensure there are no seams across edges) to provide more realistic lighting that matches the environment.

Download
Executable (Windows)
Source on BitBucket Project

Instructions
Using the right mouse button you can move the camera around the scene. The mouse wheel will zoom in and out of the scene.
W, A, S, D, Q, E : Move the sphere Forward, Left, Backward, Right, Downward, and Upward
B : Toggle wind blowing
P : Pause cloth simulation
R : Reset cloth simulation
F : Unfix cloth
TAB : Cycle through rendering types (point, line and solid)
Escape : Quit

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>