Matrix Transformation Order
Matrix Transformation Order
In MotionBuilder, the global translation, rotation, and scale matrices of a model are all computed separately. These matrix computations follow a particular order as explained in the following sections. The M suffix is used to denote matrices, and the V suffix is used to identify vectors.
Global Rotation Matrix
The local (LocalRotationM) and global (GlobalRotationM) rotation matrices are calculated as follows. The matrix operations are applied from right to left.
(1) RotationDoFM = KRotationM · JRotationM · IRotationMThe IRotationM, JRotationM, and KRotationM matrices describe the amount of rotation around each local axis depending on the model's rotation order (FBModel.RotationOrder). For example, if the model's rotation order is set to Euler ZYX (FBModelRotationOrder.kFBEulerZYX), the amount of rotation is as follows:
IRotationMdescribes the amount of rotation around the Z axis.JRotationMdescribes the amount of rotation around the Y axis.KRotationMdescribes the amount of rotation around the X axis.
I, J, and K prefixes are not related to quaternion rotations.(2) LocalRotationM = PreRotationM · RotationDoFM · PostRotationM-1Where, PostRotationM denotes the inverse of the PostRotationM matrix.
0 local rotation value along each axis. If you change the pre/post rotations, it affects the model's children. To only affect the model's geometry, you can change the FBModel.GeometricTranslation, FBModel.GeometricRotation and FBModel.GeometricScaling transformations.(3) GlobalRotationM = ParentGlobalRotationM · LocalRotationMWhere, the ParentGlobalRotationM matrix is the parent FBModel's GlobalRotationM matrix. The resulting local rotation matrix (LocalRotationM) is used in the following global scale and translation matrix computations.
Global Scale Matrix
The computation of an FBModel's global scale matrix (GlobalScaleM) depends on the scale inherit type of its parent.
| Parent's Scaling Inherit Type | Description |
|---|---|
| Local (RrSs) | Activates the local scaling mode. If you scale a parent object on its X, Y, or Z axis, the child objects scale on their local X, Y, or Z axis. The child objects also translate to keep proportional distance from the parent. You can still scale the child object without affecting the parent. |
| Parent (RSrs) | Activates the parent scaling mode. If you scale a parent object on one axis, the child objects deform to maintain their volume while stretching to scale on the same axis. For example, you can use this option if you have a group of models and you want them all to scale down on the same axis and appear squashed. |
| Scale Compensate | In this mode, the child objects do not inherit scaling from the parent objects at all. When a parent object is scaled, the child does not scale, but translates to keep the proportional distance between the models. |
Local (RrSs) Scaling Inherit Type
The result of this computation is a vector (GlobalScaleV), so that no shear is induced.
(4a) GlobalScaleV = ParentGlobalScaleV · LocalScaleVParent (RSrs) Scaling Inherit Type
This computation relies on the previously defined local rotation matrix (LocalRotationM).
(4b) GlobalScaleM = LocalRotationM-1 · ParentGlobalScaleM · LocalRotationM · LocalScaleMScale Compensate Inherit Type
(4c) GlobalScaleM = LocalRotationM-1 · ParentGlobalScaleM · ParentLocalScaleM-1 · LocalRotationM · LocalScaleMGlobal Translation Matrix
The global translation vector and matrix of an FBModel is computed as follows using LocalScaleM.
(5) ScalePivotTranslationV = (I - LocalScaleM) · ScalePivotV + ScalePivotOffsetV
Where I is the identity matrix.
(6) ScaleAndRotatePivotTranslationV = (LocalRotationM · (ScalePivotTranslationV - RotationPivotV)) + RotationPivotV + RotationPivotOffsetV
(7) LocalTranslationV = TranslationDoFV + RotatePivotTranslationV
(8) GlobalTranslationV = ParentGlobalTransformationM · LocalTranslationV Where,
ParentGlobalTransformationMis the global transformation matrix of the object's parent.LocalTranslationVis the local translation vector.TranslationDoFVis the value read from Translation (Lcl) property in the Property Editor.RotationPivotOffsetVis the value read from Transformation Pivots
Rotation Pivot
Manual Offset
Rotation Offset property in the Property Editor.RotationPivotVis the value read from Transformation Pivots
Rotation Pivot property in the Properties Editor.RotatePivotTranslationV = (I - LocalRotationM) • RotationPivotV + RotationPivotOffsetV.
Global Transformation Matrix
The global transformation matrix of an FBModel makes use of the computed global translation, rotation, and scaling matrices.
(9) GlobalTransformationMatrix = GlobalTranslationM · GlobalRotationM · GlobalScaleM
