Game Development Reference
In-Depth Information
float derr = (distance
targetDistance)/distance;
derr = ( derr < 0)?0.0f:derr;
This technique of modeling cloth, and indeed most known cloth simulators, tends
to smooth out smaller wrinkles [Bridson et al. 03]. The wrinkles are the most
noticeable feature of cloth, since they form dark shadowed valleys against peaks
that catch much of the light. We can add wrinkles back in as a rendering effect by
using wrinkle maps driven by compression values.
Friction forces are needed to model the contact between cloth and skin in a
believable manner. The most basic and performant friction model is to modify
the effective velocity of a particle when it experiences a collision. We do so
by moving the previous particle position towards the current one by the velocity
scaled by the friction coefficient:
Vector3 v = p pPrevious;
v=v normal dot(v, normal);
pPrevious += v mu;
Friction between cloth and skin is a fairly complicated interaction. We could
make the friction strength depend on the depth of the collision. This is only a
rough approximation of the contact force, and given the complicated nature of the
situation, we can choose to leave it out. Another choice is when to apply friction.
Applying friction with every collision is an option, or only applying it once, either
at the start or the end of the solver loop. It is best to experiment to find the right
look for each simulation.
12.3.1 Character Cloth Constraint
Attaching simulated cloth to an animated character requires a special type of con-
straint. A character bone may rotate and translate very large distances in a single
frame. Keeping the cloth on the correct side of a bone's collision geometry is a
challenge.
The simplest constraint that will keep a particle from passing through collision
geometry is to skin it rigidly to the bone. This isn't a very interesting way of doing
things. We'll call this the pinning constraint, or just pinning. If we have pinning
that makes sure a given particle can never move more than halfway through the
collision geometry, then, providing the geometry is convex, the collision response
will push the particle out to the side it came from. This can be done with a
unilateral distance constraint between the particle and an anchor position. The