A transform is composed of a position, a rotation, and a scale. The position is represented as a three-dimensional vector, and the scale is also a three-dimensional vector. Every level of the scene hierarchy carries one, mapping a contained coordinate system into its container, so an object’s world placement is the composition of the transforms along its path to the root.
The three components compose into a single 4×4 matrix — using homogeneous coordinates, so that translation, rotation, and scale all become multiplication and a chain of them collapses into one product. That matrix is the form the GPU consumes.
Representing rotation#
The rotation is represented as either a three-dimensional vector or a quaternion — to be determined. The trade-off, unchanged since the question was first raised:
- Euler angles are three numbers and can be read and authored by a human, but they suffer gimbal lock — at certain orientations an axis of freedom collapses — and their meaning depends on an axis-order convention that would have to be fixed protocol-wide and honoured by every independently-written node.
- Quaternions are four numbers, have no gimbal lock, compose and invert cheaply, and interpolate smoothly along the shortest arc (slerp). They cannot readily be read by hand and need periodic renormalisation against accumulated drift.
For Gargantis the interpolation property is the one that bites. A parameter stream delivers rotations at intervals and a node must interpolate between them every frame, extrapolating across gaps; Euler angles interpolate badly, taking curved paths and passing through degenerate orientations. This entry records the trade-off, not a decision.
External links#
Similar concepts and prior art:
- Transformation matrix and affine transformation on Wikipedia
- Quaternions and spatial rotation, Euler angles, and gimbal lock
- Slerp — shortest-arc interpolation between orientations
- Homogeneous coordinates — why the matrix is 4×4 and not 3×3