Skip to content

Blender Transform Model

bsupnik edited this page Sep 25, 2015 · 2 revisions

This page attempts to document how transforms and animation work in Blender.

Transform Order

Transforms in Blender are always applied in the order of: translation, rotation, scale. The rotation may be in one of eight "interpolation modes" - the key frames of the rotation (if used) are defined in a data format appropriate to the rotation mode, so that interpolation is as expected. (In other words, in XYZ mode, the rotation is a triplet of angles around the X, Y and Z axis; in Quaternion mode, the rotation is a single quaternion.)

All hierarchical transformations apply this way, e.g. we have outer translation, outer rotation, outer scale, inner translation, inner rotation, inner scale.

Data Block Transformation

A data block provides translation, rotation, and scale; translation and rotation may be key-framed to create simple animations.

Data blocks also provide an arbitrary "relative to parent" transform matrix. This matrix occurs before the key-framed translation/rotation/scale itself.

The Object member matrix_parent_inverse contains a matrix that transforms from the parent data block's coordinate system to our coordinate system before our loc/rot/scale animation.

matrix_parent_inverse gets set once when a parenting relationship is created. It is used to allow a child to not "jump" in space while not editing its key frame table. So if your new parent is at 5,0,0 then when parenting a static transform of -5,0,0 is set up for the child to keep the child's origin (pre-object-transform) at 0,0,0.

Note that the "current" loc/rot/scale parameters of the data block are seen by setting the current animation frame - therefore an exporter "walks" our animation to extract specific key frame values.

We use matrix_world to get the final total transformation of a data block; matrix_local does not have correct output when parented to a bone.

Bone Transformations

Bones live inside an armature, and the armature is a data-block. Therefore everything above applies to the outer armature itself. This does not have an affect on bone animations; the armature's data block transform has the same effect as the armature being parented into an empty display with a transform.

The bones themselves provide two transforms each:

  • The bone's rest position and orientation provide a transform.
  • The bone's "pose bone" provides (per key-frame) an additional transform applied on top of the initial transform.

Rest Positions

The rest position of a bone is only visible when the bone is in edit mode - when in "object" mode, the current pose of the scene is used.

The rest position of the bone is what you would see if the pose bones all had no transform (0,0,0 rotate, 0,0,0 translate, 1,1,1 scale).

The rest position of the bone is specified differently from the rest of the transforms in the system:

  • The translation of the bone comes from the local position (relative to the armature) of the head.
  • The rotation of the bone comes from the vector from the head to the tail of the bone and a roll factor.

Fortunately, since these values are not key-framed, we can simply extract them as a matrix. The 4x4 matrix "matrix_local" contains a transform from the coordinate system of the armature to the rest coordinate system of the bone.

Pose Bones

Pose bones contain further transformations (loc/rot/scale) that are key-framed to move the bones around. Like data blocks, we get the translation, scale and rotation directly as member data, and the rotation mode affects both interpolation and the representation of the rotation. Pose bone data is available in pose and object mode.

The data field matrix contains the pose bone's position relative to the armature.