Hello. I'm trying to implement skeletal animation and loading my model and animation from COLLADA files. I've read all the data from the file and I've got my bones and vertex weights set up. Currently I set all the bones' transformation matrices to the identity matrix and then translate the root bone to see that that works.

I apply all the bone transformations with the vertex weights in my vertex shader (GLSL):

mat4 animationTransformation = TRANSFORM_Root * vertexWeights0 + TRANSFORM_Head * vertexWeights1 + TRANSFORM_Shoulder_L * vertexWeights2 + TRANSFORM_Arm_L * vertexWeights3 + TRANSFORM_Shoulder_R * vertexWeights4 + TRANSFORM_Arm_R * vertexWeights5 + TRANSFORM_Upper_Leg_R * vertexWeights6 + TRANSFORM_Leg_R * vertexWeights7 + TRANSFORM_Upper_Leg_L * vertexWeights8 + TRANSFORM_Leg_L * vertexWeights9; gl_Position = vertexTransformation * animationTransformation * vec4(vertexPosition, 1.0);

And then I modify the TRANSFORM_Root matrix and upload it:

animation.getJoints().get("Root").setTransform(new Matrix4(new float[][] { new float[] { 1.0f, 0.0f, 0.0f, 3.0f * (float)Math.sin(t) }, new float[] { 0.0f, 1.0f, 0.0f, 0.0f }, new float[] { 0.0f, 0.0f, 1.0f, 0.0f }, new float[] { 0.0f, 0.0f, 0.0f, 1.0f } })); shader.updateUniform("TRANSFORM_Root", animation.getJoints().get("Root").getMatrix(), true);

This works fine and the whole model translates nicely along the x-axis.

What I don't understand is what data to actually use for what from the COLLADA file.

Each bone has it's own transform in the skeleton definition (visual_scenes). Further I have a bind shape matrix (read from bind_shape_matrix) which is just the identity matrix in my case, a "skin bind-pose" matrix for each bone (read from library_controllers -> skin). They are specified as "inverse bind matrices". I also have animations for each bone, specified by a list of times and matrices. I understand I should interpolate between these different animation matrices.

But how do I put all these matrices together for uploading to the graphics card? I've read a couple of tutorials and they are quite unclear on how to do this (or don't use COLLADA at all), most just have a "bone transform" which is used to transform the vertices. But how do I calculate this transform from the bones' transformations, the skin bind-pose matrices and the animation matrices?

Thanks in advance!