How does Blender calculate the positions of vertices moved by an armature?

Hello, I have made a small game engine written in C++ for a project of mine and I would like to add support for bone animations. I want to export my meshes from blender into a self-developed file format (works fine already) and the animations should look exactly like in Blender.
So now I need the formula how Blender calculates the position of the vertices in a specific pose to transfer it to my C++ code.
Thanks for any help.

The inputs to the calculation are:

  • The vert positions in object space
  • The armature in rest position
  • The armature in the posed position
  • The the weights assigned to each bone.

The vert is moved from “object space” to “armature space”. “Armature space” is just a coordinate space relative to the armature. The ‘pose bones’ then have a “PoseBone.matrix” member that represents the delta of the bone from the rest position to the posed position. This ‘PoseBone.matrix’ is the final matrix after all parenting + constraints have been applied to the bone.

The final bone position is something like this pseudo-code



for each vert in model:

  totalInfluence = <sum of all weights for bones affecting this vert>

  finalPos = Vector( (0,0,0) )
  for poseBone in <influencing bones>:
    finalPos = finalPos + (poseBone.matrix * vert * (<weight for poseBone> / totalInfluence))


Note that Blender does an a trick to ensure that the weights sum to 1.0 for all influencing bones. It actually uses the percentage of the total weight for the influence factor. For example, if a vert was only affected by 1 bone with a weight of .25, the vert would behave as if it was weighted at 1.0. This is because Blender figures the entire weights affecting the vert is .25 and .25/.25 = 1.0. You can duplicate this functionality in your engine or you can be sure to hit the “normalize all” button for your weight painting. This ensures that all the weights sum to 1 in your model.

3 Likes