Curtain

Real time fabric simulation
$$pic(renders/render (5).png)$$

Curtain was my first adventure into soft body physics.

It started out as a week-long project when I was 16. Ultimately, my code was based off of Thomas Jakobsen’s article, “Advanced Character Physics,” which described how his character physics algorithms worked in the game Hitman. The physics attempts to maintain inertia for every particle in the system. So, every time we move a particle from a resting position, the physics engine will see this change in position and continuously add this change every timestep. This way, all we need to do is solve the distance constraints between pairs of particles. No forces, tensions, or accelerations need to be calculated.

Curtain is currently the most favorited app in OpenProcessing, with over 400 favorites and 175,000 views.

The entire code for Curtain is annotated and commented in order to be understandable for most programmers. You can see Curtain’s source (and play with the Java applet, if your browser allows) on OpenProcessing.

I also wrote a how-to article for tuts+. The same algorithm can be used to quickly simulate ragdolls and other soft-body materials.

Gallery

Click to view