How do I Program that?
Single Deformable Mesh
[previous][next]
- Each bone has a list of vertices it influences and to what degree.
- All weight on a single vertex add up to 100%.
- For each vertex, calculate where it would have been if it were 100% under the
influence of each bone.
- Take that delta and multiply it by the weighting factor.
- Add the deltas up for all the influencing bones and that is your final position in
object space.
- In other words:
For each vertex V
- For each bone B that influences V
- Delta[B] = Pos[V] * Matrix[B] - Pos[V]
- FinalPos[V] += Delta[B] * weight[B]
- One tricky thing is that the mesh needs to be offset so that when it is rotated by the matrix,
it rotates about the bones axis.