We are 'on final' when it comes to finishing the project, but just before implementing the animation system.

Our Client decided to choose "Bones Animation" - which is that i should export each Bone Transformation Matrix ( Quaternion for rotation, Vector3 for translation ) for every frame.

Objects in our game are to be animated with 3DS Max Physique Modifier, so we will have bones / weighting data per vertex.

I would like to split this post into 2 points, where :

1 - Exporting bones matrices for every frame - treats about the correct method of exporting the bones positions for animation

2 - Calculating final vertex position - treats about proper matrices operations to calculate new vertex position according to bone transformation in frame X.

**1. EXPORTING BONES MATRICES FOR EVERY FRAME**

Now do i understand correctly that while exporting the animated object i should:

1.

Grab BONE transformation matrix at frame 0

Invert this matrix

2.

Grab BONE transformation matrix at FRAMEx

3.

Multiply 1 * 2 to get the transformation offset of the BONE at FRAMEx

[pseudocode] // Animation export // For each frame, export bone transformation offset for(int iFrame = 0; iFrame < vFrames.size(); iFrame++) { // For every bone in the object for(int iBone = 0; iBone < vBones.size(); iBone++) { // Grab transformation matrix for this bone at frame 0 and inverse it Matrix3 matBoneMatrixAtStart = pNode->GetObjectTMAfterWSM( 0 ); matBoneMatrixAtStart.Inverse(); // Grab transformation matrix for this bone at frame iFrame Matrix3 matBoneMatrixAtCurrentFrame = pNode->GetObjectTMAfterWSM( iFrame ); // Multiply Inversed Transformation Matrix of this bone at frame 0 - with current frame transformation matrix Matrix3 matBoneTransformationOffset = matBoneMatrixAtStart * matBoneMatrixAtCurrentFrame ; // Save matBoneTransformationOffset - vertex will be multiplied by this matrix for animation purposes fwrite(.....) } } [/pseudocode]

Will that be enough ? Or there is something i am missing here?

What results should i expect after exporting this?

**2. CALCULATING NEW VERTICES POSITIONS ( FINAL VERTEX POSITION AT FRAME X)**

Later on, when rendering, object vertices are going to be multiplied by exported bone transformation matrix for actual animation frame, and then multiplied by

this whole model transformation matrix to place the object in correct position inside the level :

[pseudocode] Update() { // The model transformation matrix describing the position of the model in the level matModelTransformationMatrix // Calculate new vertex position according to it's bone transformation offset NewVertexPosition = ( OriginalVertexPosition * matBoneTransformationOffset[iFrame] ) * matModelTransformationMatrix; // Increment the frame for testing purposes iFrame++; } [/pseudocode]

Am i thinking correct here?

So,

Having bone transformation offset for frame X,

multiplying every vertex affected by this bone by this offset

should result in a vertex transformed exactly as this bone right?

Thanks for all your help.