Reedbeta, on 28 June 2012 - 08:02 AM, said:
It depends where your vertices are. The matrix for each bone needs to transform a vertex from the position stored in the vertex buffer to its final position, so if the vertex buffer has the model in some default pose (bind pose), the bone matrices need to include an inverse matrix for the bind pose (including any translation part) composed with the matrix for the desired pose (the one used to visualize the bones, if I understand correctly).
So basically, the matrix palette should include each bone's transposed (inverse) matrix of the bind pose multiplied with the world matrix for the current pose?
EDIT: This is now what is does:
*When the model is first loaded:
*The bind pose is stored in the combined transformation matrix (used to position and visualize the bones)
*The bind pose is also stored in a separate bind pose matrix
*The bind pose matrix is inverted and stored in the inverse bind pose matrix
*The inverse bind pose matrix is multiplied by the combined transformation matrix and stored in the skinning matrix
*Each frame:
*If the bone position is updated (combined transformation matrix changes):
*Inverse bind pose matrix is multiplied by the new combined transformation matrix and stored in the skinning matrix
Now when the model is first loaded, it is displayed correctly (probably because the combined transformation matrix is the same as the bind pose matrix) but whenever a bone position changes, the vertices that go with it start going all over the place.
This is what is looks like before bones are moved:

and after:

EDIT AGAIN:
This only seems to be happening when the rotation changes. When the bone's position is the only thing that changes, the vertices move correctly.



Find content
Not Telling
Display name history