Game Development Reference
In-Depth Information
//Do cloth simulation here
}
protected:
//Cloth specific data like:
// previous vertex positions / velocity
//
spring data
// mass data
//
number of iterations
// etc....
}
Listing 13.1. A sample pure-virtual base class for creating different kinds of “stack-able”
deformers. Update() is called on the base of the stack, which cascades down the chain
until all the deformers are computed.
If implemented in an extensible manner, new deformer types can be developed
and integrated into our animation system as time permits. The actual guts of the
deformer can be any function of the input mesh but may include other generic
inputs from our animation system. Common inputs include joints/bones, time,
other geometry, implicit surfaces/curves and weight maps.
13.2.2
Layering Deformers Using Weights
It's not uncommon for a deformer to require additional input data in the form
of per-vertex weights. These are usually normalized float values that provide
the artist with local control over the behavior of the mesh. Artists are familiar
with the process of assigning per-vertex values from their experience with smooth
skinning.
In this paradigm, it would be useful to consider cloth simulation as just another
type of deformer. With the addition of per-vertex weighting, the cloth simulator
can interpret a per-vertex float value as the strength of a spring (with zero length)
that connects that particle/vertex to its prior position (the position being passed
into the cloth deformer).
In this way, the cloth simulation can be layered and combined with any other
deformations. To see why this might be useful, consider the example of rigging
a dragon wing. For the sake of argument, the wing has a thin membrane of skin
stretched between several bony fingers. It would be nice if we could use cloth
simulation on the skin membrane and combine that with skeletal skinning on the
fingers.
With the addition of per-vertex normalized deformer weights, we can create
a seamless transition from simulated vertices to those being controlled by the
skinning algorithm.
Search Nedrilad ::




Custom Search