Understanding glTF Nodes and Coordinate Spaces
In the glTF (GL Transmission Format) specification, scenes are structured as hierarchical trees where nodes define the spatial positioning, orientation, and scale of elements. This article explains how glTF nodes establish local coordinate spaces and how those spaces are concatenated through the scene graph hierarchy to resolve objects into a unified world coordinate space.
The Hierarchical Node Structure
A glTF asset organizes visual elements—such as meshes, cameras, lights, and skinning joints—within a scene graph. The scene object points to an array of root nodes, and each node can optionally contain an array of indices pointing to its children.
This parent-child relationship creates a directed tree structure. Nodes themselves do not contain geometry directly; instead, they reference visual components (like a mesh index) and attach them to a specific point within the hierarchy.
Defining Local Coordinate Space
Every node defines its own local coordinate space
(also known as object space) relative directly to its immediate parent
node. If a node is a root node, its local space is relative directly to
the scene origin (0, 0, 0).
A node's transformation within its local space is defined using either:
- TRS Properties: Separate vectors for translation
(
translation), rotation represented as a unit quaternion (rotation), and scale factors (scale). - A 4x4 Transformation Matrix: A 16-element
column-major matrix (
matrix) that encapsulates translation, rotation, and scale simultaneously.
According to the glTF specification, if TRS properties are used, the local transform matrix \(M_{\text{local}}\) is computed in the fixed order of scale first, followed by rotation, and finally translation:
\[M_{\text{local}} = T \times R \times S\]
If neither TRS nor a matrix is defined on a node, its local transformation defaults to an identity matrix, matching its parent's coordinate space directly.
Transitioning from Local to World Coordinate Space
World coordinate space represents the common, global reference frame of the entire scene. To determine an object's absolute position and orientation in world space, the local transformation of its node must be combined with the transformations of all its ancestor nodes.
This is achieved through matrix multiplication (concatenation) traversing from the root node down to the target node:
\[M_{\text{world}} = M_{\text{root}} \times \dots \times M_{\text{parent}} \times M_{\text{local}}\]
Because matrix multiplication is non-commutative, child nodes inherit every translation, rotation, and scaling applied to their parents. For example, moving or rotating a parent node automatically shifts the entire sub-tree beneath it while preserving the relative distances and orientations among the child nodes in their respective local spaces.
Coordinate System Conventions
glTF standardizes on a right-handed coordinate system:
- +X points to the right.
- +Y points up.
- +Z points outward toward the viewer (forward in a right-handed view).
Front-facing cameras and lights in glTF look along the negative
Z-axis by default (-Z). Units for translation are defined
in meters, angles are measured in radians, and scale factors are
unitless multipliers.
Role in Skeletal Animation (Skinning)
The node-driven coordinate space model is critical for glTF skinning and skeletal animation. Bones or joints are represented as standard nodes arranged in a hierarchy.
To deform a skinned mesh:
- Each joint node tracks its dynamic world transform as animations play.
- The runtime multiplies the joint's world matrix by an
inverseBindMatrixassociated with that joint. - This transforms the mesh vertices from their original bind pose (local mesh space) into the coordinate space of the joint, and then into the animated world space, allowing smooth vertex blending across multiple moving nodes.