From BlenderWiki

Jump to: navigation, search
Note: This is an archived version of the Blender Developer Wiki. The current and active wiki is available on wiki.blender.org.

Here I will make notes on armature, bone and pose matrices to make sense of it all. Will be useful for future references.

The initial place to start looking is from BKE_where_is_bone() in armature.c. There we can see the procedure for making pose_mat for pose channels.

  • each bone has a pose channel.
  • pose->chan_mat is the channel matrix corresponding to the rest pose of the bone. matrix result of loc/quat/size transforms written by actions or transform.
  • BKE_armature_mat_bone_to_pose is used to construct the pose matrix based on the pose channel. To Convert bone-space matrix to pose-space
    • find rot/scale and location matrices from the poseChannel. These correspond to armature space. So applying the chan_mat to them and getting the pose_mat will give the pose_mat in armature space.
      • if poseChannel has no parent Channel, then the channels bone->arm_mat is used to get the rot/scale and location matrices.
      • if there is parent channel, then parent arm_mat or parent channel pose_mat is used to get the rot/scale and location matrices.
    • multiply rot/scale and loc matrices with the chan_mat to get the pose_mat.

Additional Data

  • bone->arm_mat is (bonemat(b)+head(b))*arm_mat(b-1), so it is in object_space.
  • bone_mat is the rotation derived from head/tail/roll
  • pose_mat(b) = pose_mat(b-1) * yoffs(b-1) * d_root(b) * bone_mat(b) * chan_mat(b) , therefore pose_mat is object space.