PDA

View Full Version : Collada animation



stonehat
02-20-2015, 04:42 PM
In collada the skinning equation is : v += {[(v * BSM) * IBMi * JMi] * JW}
I'd like to clear something.
1) BSM = bind shape matrix , located in <library_controller>, in <bind_shape_matrix>?

2) IBMi = inverse bind matrix, located in <library_controller>, the same number as the total number of the joints?

3) JMi = joint matrix. Is it animation matrix from <library_animation>, or world matrix or local matrix ?

4) For now I want to just change the model to another different 'pose'. The pose is defined in a keyframe in Blender. For now I only have two poses for my model. The
first one is bind pose/rest pose at frame 0, the second is a different pose at frame 30.

5) To my understanding, animation matrix's(from <library_animation>) purpose is to replace JMi in the skinning formula , in order to give the model a different 'pose'. If so, what's use of each joint's world matrix? And If BSM is an identity matrix, can it be ignored?

6) To get a bone's world matrix, can I just multiply its parent's world matrix by its relative matrix?


The joints found in <library_visual_scene> are local/relative matrix for each joint.
What I have done to achieve simply switching to another pose was , take the local matrix for the current bone and multply it with the only "world matrix of its parent"(i mean not all the way to the root bone's world matrix, only by its parents). But the result is not correct. The model is completely distorted.

I do the skinning on vertex shader. For now there are three bones for the model.
in vec4 position; // The vertice position
uniform mat4 inver,inver2,inver3; // The inverse bind matrix for each bone(3 bones)
uniform mat4 joint,joint2,joint3; // The animation matrix for each bone(directly
from<library_animation>
vec4 v = vec4(0,0,0,1);
v+= ( weight1 * inver * joint * position) + (weight2* inver2 * joint2* position)
+ (weight3 * inver3 * joint3 * position);

And I use v as the final position. The result is the model is completely distorted.