glTF Animation on Nodes with Meshes and Children
In the glTF 2.0 specification, scene graphs rely on hierarchical
transformation trees where modifications to a parent node propagate
automatically down the hierarchy. When an animation targets a node that
defines both a mesh property and an array of
children, the animated transform directly alters the node's
local coordinate space. Consequently, the assigned mesh renders using
this animated local transform, while all child nodes simultaneously
inherit the transformation as their parent coordinate space. This dual
effect governs how both local rendering and child hierarchies interact
during playback.
Hierarchical Transform Propagation
In glTF, a node's local transform is defined either by explicit Translation, Rotation, and Scale (TRS) properties or by a 4x4 transformation matrix. When an animation channel targets a node, it modifies one of these local TRS components over time.
Because the mesh resides directly on the targeted node, the node’s local transformation matrix is applied directly to the mesh’s vertices:
\[\mathbf{M}_{\text{local}} = \mathbf{T} \times \mathbf{R} \times \mathbf{S}\]
Simultaneously, the node acts as a parent to any nodes listed in its
children array. The global transform for any child node is
computed by multiplying the parent’s accumulated world transform by the
child's own local transform:
\[\mathbf{M}_{\text{child\_world}} = \mathbf{M}_{\text{parent\_world}} \times \mathbf{M}_{\text{child\_local}}\]
Because the animated node is the parent, any translation, rotation, or scaling applied to it forces the children to move, rotate, and scale relative to that parent’s animated origin.
Differences Between TRS and Morph Target Animations
The specific outcome depends on the target property of the animation channel:
- Translation, Rotation, and Scale (TRS): Modifies the spatial coordinate system of the node. Both the mesh attached to the node and all child hierarchies are transformed.
- Weights (Morph Targets): Targets the morph target weights of the attached mesh. This alters only the geometry of the mesh on the targeted node; it has no spatial effect on the node's transform matrix and does not alter the transforms of child nodes.
Practical Implications in 3D Engines
While defining both a mesh and children on an animated node is fully valid in glTF, it introduces specific runtime behaviors that technical artists and engine developers must manage:
- Non-Uniform Scaling Inheritance: If the parent node animates non-uniform scale (e.g., stretching along one axis), all child nodes inherit this distortion. This can deform child meshes in unintended ways unless children explicitly counter-scale or the scene hierarchy avoids non-uniform scale.
- Pivot Point Coupling: The mesh and the child nodes share the exact same pivot point (the origin of the parent node). It is impossible to rotate the mesh around its center while keeping child nodes stationary without adding extra nodes.
- Skinning Exceptions: If the node's mesh utilizes
skeletal animation via the
skinproperty, the vertices are positioned according to the inverse bind matrices and joint hierarchies rather than the node's local TRS. However, the unskinned child nodes will still inherit the node's animated local TRS transform.
Structural Recommendation
To maintain clean separation between geometry and scene hierarchies, many 3D asset pipelines separate nodes into distinct roles. Placing the mesh on a dedicated leaf node and keeping children under a dedicated structural node prevents transform inheritance issues, though glTF fully supports combining both on a single animated node.