On this page | |
Since | 20.0 |
Transformation Construction ¶
The transformation represented by the TransformObject can be constructed in a number of different ways:
-
Translate, rotate, and scale values can be wired into the t, r, and s ports respectively.
This option is convenient if the intention is to manipulate the TransformObject as a controller. When a t, r, or s port has an incoming connection from the graph’s input node, the animation state provides the appropriate handles to set these values from the viewport.
The transformation order (the order in which to apply the translation, rotation, and scale operations), can be set with the xord port.
Transformation Order ¶
xord Transformation Order 0 Scale → Rotate → Translate 1 Scale → Translate → Rotate 3 Rotate → Scale → Translate 4 Rotate → Translate → Scale 5 Translate → Scale → Rotate 6 Translate → Rotate → Scale The rotation order (the order in which the rotations are applied about the X, Y, and Z axes) can be set with the rord port.
Rotation Order ¶
rord Rotation Order 0 X → Y → Z 1 X → Z → Y 3 Y → X → Z 4 Y → Z → X 5 Z → X → Y 6 Z → Y → X -
The local port accepts a transformation matrix which servers the same purpose as the t, r, and s ports.
This option is convenient to use when the transformation data is already represented in matrix format. Often times, this connection is used when the TransformObject is driven by rig logic, rather than directly manipulated or animated.
Note
The t, r, and s ports take priority over the local port. If any one of the t, r, or s ports has an incoming connection, the local port will be ignored.
-
The restlocal port accepts a transformation matrix which sets the initial position and orientation of the TransformObject. The t, r, s or local transformations are applied relative to this coordinate frame (premultiplied). In effect, this port sets an initial transformation on the TransformObject while leaving the other transformation ports clear for animation.
There are many potential use cases for restlocal. For example, it can be used to represent a joint hierarchy. The joint’s position and orientation (relative to its parent), is stored in restlocal. This sets the joint’s rest transformation, and then the standard transformation ports are free to be used for animation. See Update Rest Transforms From Skeleton.
-
The xform port accepts a world space transformation matrix which overrides the local transformations set by the t, r, s or local ports. By default, xform overrides the entire transformation. However, the effect can be limited to any combination of translate, rotate, and scale by providing an appropriate bit mask on the xformmask port. This option is useful for applying a constraint to the TransformObject.
Xform Mask ¶
xformmask Overrides Applied 0 No Overrides 1 Translate 2 Rotate 3 Rotate, Translate 4 Scale 5 Scale, Translate 6 Scale, Rotate 7 Scale, Rotate, Translate
Transformation Hierarchies ¶
TransformObjects are connectable in a parent-child fashion to create transformation hierarchies. The localxform output port produces a local transformation matrix representing the combination of all the input transformation ports mentioned in the previous section. The xform output port produces the TransformObject’s world space transformation matrix. In order to be able to produce the world space matrix, the TransformObject must have access to its parent’s world space matrix. The parent-child relationship is thus established by connecting the parent’s xform output port to the child’s parent input port.
Scale Inheritance ¶
When a parent TransformObject is scaled, its descendents inherit the effects of the scaling. However, at times it may be beneficial to adjust the effects of the parent’s scaling on its children to simplify various rig behaviors. Houdini offers the following scale inheritance behaviors which are controlled by setting the appropriate option on the scaleinheritance port:
-
0 - Default Scaling: Scaling is inherited normally from the parent.
xform = localxform * parent
-
1 - Offset Only: Only the child’s position is affected by scaling.
xform = localxform.scale * localxform.rotate * inverse(parentlocal.scale) * localxform.translate * parent
Tip
This is similar in nature to Maya’s segment scale compensation.
-
2 - Offset and Scale: The child’s position is scaled as before, and parent’s local scale is applied in the child’s local space. For example, if the parent is scaled by a factor of 2 in its x direction, the child will also apply a scaling of 2 in its own x directions.
xform = parentlocal.scale * localxform.scale * localxform.rotate * inverse(parentlocal.scale) * localxform.translate * parent localxform = parentlocal.scale * localxform
Tip
This is similar in nature to Softimage’s hierarchical scaling.
-
3 - Scale Only: The same local scaling is applied as in the previous option, but the child’s translation remains unaffected.
xform = parentlocal.scale * localxform * inverse(parentlocal.scale) * parent localxform = parentlocal.scale * localxform
-
4 - Ignore Parent Scaling: No scaling is inherited from the parent.
xform = localxform * inverse(parentlocal.scale) * parent
In order to support scale inheritance, an extra connection must be made from the parent’s localxform to the child’s parentlocal port. This gives the child access to the parent’s local scaling contributions.
Summary
Parent-child relationships are established by creating two connections between the parent and child TransformObjects.
-
parent.xform → child.parent
-
parent.localxform → child.parentlocal
Inputs ¶
parent:
Matrix4
The parent’s world matrix. When establishing a parent-child relationship, connect this port to the parent TransformObject’s xform port.
parentlocal:
Matrix4
The parent’s local matrix. When establishing a parent-child relationship, connect this port to the parent TransformObject’s localxform port.
scaleinheritance:
Int
Controls the behavior that the parent’s local scaling has on the child. See Scale Inheritance.
xform:
Matrix4
This matrix overrides the TransformObject’s position, scale, and orientation in world space. It can be used in combination with the xformmask to selectively set the scale, rotation, or translation components of the TransformObject.
t:
Vector3
A vector of translation values which sets the TransformObject’s position in local space.
r:
Vector3
A vector of Euler angles, in degrees, which sets the TransformObject’s orientation in local space. The rotation order is set with the rord port.
s:
Vector3
A vector of scale values which sets the TransformObject’s scale in local space.
local:
Matrix4
A matrix which sets the TransformObject’s position, scale, and orientation in local space.
restlocal:
Matrix4
A matrix to apply an initial position, scale, and orientation to the TransformObject in its local space. Transformations from the s, r, t, and local inputs are applied relative to this coordinate frame. This matrix gives the TransformObject, and its manipulation handles, an initial transformation while keeping the transformation inputs clear.
xord:
Int
Sets the transformation order of both the input and output s, r, and t ports. The default order is scale → rotate → translate. See Transformation Order.
rord:
Int
Sets the rotation order of the Euler angles encoded by the input and output r ports. The default value is X → Y → Z. See Rotation Order.
xformmask:
Int
A bit mask which is used in combination with the input matrix xform to override specific components of the transformation. The first bit overrides the translation, the second bit overrides the rotation, and the third bit overrides the scale. All three bits are set by default. See Xform Mask.
Outputs ¶
t:
Vector3
The translation applied to the TransformObject in its local space by either the t input port, or the translation component of the local input port matrix. This serves as a pass-through of the input translations.
r:
Vector3
The Euler angles, in degrees, applied to the TransformObject in its local space by either the r input port, or the rotation component of the local input port matrix. The rotation order respects the input rord port. This serves as a pass-through of the input rotations.
s:
Vector3
The scale applied to the TransformObject in its local space by either the s input port, or the scale component of the local input port matrix. This serves as a pass-through of the input scales.
xform:
Matrix4
The world space matrix of the TransformationObject.
localxform:
Matrix4
The local transformation matrix of the TransformObject such that xform = localxform * parent
.
Warning
In the presence of non-default scale inheritance, localxform is modified to include the additional scaling
such that it can be properly reapplied in descendent hierarchies. In this scenario, localxform represents
the effective local transformation and the previous relationship xform = localxform * parent
is no longer
accurate. In order to calculate a localxform which maintains that relationship, you may use the following
formula localxform = xform * inverse(parent)
.
restlocal:
Matrix4
Returns a copy of the TransformObject’s restlocal matrix which is used to set the initial position and orientation of the TransformObject.