|
A cloth simulation written using Microsoft XNA 3.0. This uses a series of springs (structural, shear and bend springs) and constraints. The two top corners of the cloth is pinned using a point constraint and can be controlled by the user. The main building blocks of a good cloth simulation are the three kinds of springs:
To illustrate how the different kinds of springs are important, I have created some videos to show how the cloth will look like without some of them. The video below shows how a cloth simulation will look like without using shear and bend springs (i.e. using only structural springs). The cloth tends to lose its shape very easily, as can be seen when the two corners are brought close together. The video below shows how a cloth simulation will look like without using bend springs (i.e. using only structural and shear springs). The cloth looks decent when fully stretched out, but starts to show signs of poor deformation when it bends. It tends to fold too easily and sometimes even stays folded (e.g. at the end of the video). Constraints are another important building block of a good cloth simulation. Length constraints help to maintain the distances between the vertices and can be thought of as a spring of infinite stiffness. The video below shows how a cloth simulation will look like without using length constraints. The cloth tends to be very elastic and quite unstable as the different springs fight against one another. For more detailed information and implementation techniques, please check out my soft body tutorial. |
Copyright © 2003-2024 Skeel Lee. All works are original ones by Skeel, unless otherwise stated.
|
Nice article but I found the last part unclear. How do you meet the length constraint? Do you assign all spring constants close to infinity?
Length constraints are satisfied via iterative relaxation techniques. Check out Chapter 2 of my soft body tutorial at http://cg.skeelogy.com/introduction-to-soft-body-physics-in-xna/ for a more detailed explanation and implementation details.
Spring constants are not set to infinity (large value). When I mentioned “infinite stiffness”, it was more of a figurative thing. The springs try their best to move back to their original lengths via constraints, so it is like the springs having very high stiffness.