Original Post
I think all of the SkinMesh experts have accended to some other plane of existence. I'm gonna keep this question very simple, in hopes of getting at least one reply. You know the TID_D3DRMFrameTransformMatrix type templates that always follow a TID_D3DRMFrame in the X-File format? What the hell are these for? If I read in the transform matrix following each bone in the X-File, what happens if I apply those matrices to my bones and render it? Will the model be in it's pose that existed in the X File? If not, what do I need to do to these matrices to make them put the model in it's default pose? Please ignore the rest of this if you can answer that question. All of my animation matrices are screwed up. In your standard walk-animation, the model's thighs are bent so that the feet are kicking it in the head. The transform matrices included after each bone give me the same results when applied DIRECTLY to the mesh hierarchy. Please tell me if I'm doing something wrong here. See any problems with this? Because it doesn't work. The only problem I can see is the matrices in animations of the X file. Any help is appreciated. [disturbed] [Edited by - Jiia on September 13, 2004 6:44:59 PM]
#1- Set all bone states (I set these DIRECTLY from the file)
#2- For each bone in hierarchy..
#2a- Set Final-Matrix of this bone to Offset-Matrix
#2b- Multiply that with the state of the bone (from #1)
#2c- Multiply that with the Inverse-Offset-Matrix (inversed #2a)
#2d- Multiply that with our parent's Final Matrix (see #2e)
#2e- Pass our Final Matrix to each child bone
#3- Throw Final Matrices into the shader and render
Here is the hierarchy part in real code..
VOID CBone::ComputeHierarchy(MATRIX *States, MATRIX *Finals, MATRIX &Derive) // Cycles the states through the heirarchy
{
Finals[Index] = Offset * States[Index] * InverseOffset * Derive;
// Compute Children
CBone *b = FirstChildBone;
while(b)
{
b->ComputeHierarchy(States,Finals,Finals[Index]);
b = b->Next;
}
}