Skeletal Animation

Not sure where to being, I basically followed what these guys were discussing here. I’ll try and summarize what I’m doing but I’m not the best at explanations.

Basically I have initial translation and rotation for each bone based off its’ parent bone. I create a matrix by multiplying the parents matrix to get the initial position of the bone. I’m able to draw a box using this matrix and it works. I do the same thing with my animations, I multiply the parent bone’s animation matrix with the child’s to get a final matrix.

Than to get it to rotate and translate the vertices correctly I do this:
-multiply the vertex by the inverse of the initial bone matrix
-multiply that by the animation matrix
-multiply that by the initial bone matrix so it goes back to where its suppose to be

I know this is incredibly inefficient I was wondering if some could help with this as well.

The only thing that isn’t working is that the child node isn’t following the parent node. For example the parent node gets rotated by 90 degrees, but rather than the child move in an arc following the parents rotation it simply rotates 90 degrees itself remaining completely stationary. It seems its applying the rotation to the parent bone and the child bone when I want the child bone to be moving.

On a side note I tried getting this to work with glsl but I have different shaders on different parts of the mesh and I’m not sure how to go about doing this, if setting all the 32 bone matrices each time for different shaders.

  1. initial position
  2. what should happen
  3. what actually happens