glTF STEP Interpolation Curve and Mathematics
This article provides an overview of how the STEP
interpolation mode operates within glTF keyframe tracks, identifying the
exact mathematical function that drives it. While traditional keyframe
animation frequently uses continuous curves like linear or cubic splines
to smoothly blend values over time, STEP interpolation
relies on a fundamentally discontinuous model. Below is a detailed
breakdown of the governing piecewise constant function, its formal
mathematical definition, and how it behaves across animation tracks in
the glTF 2.0 specification.
The Governing Function: Piecewise Constant (Zero-Order Hold)
The mathematical "curve" that governs STEP interpolation
across glTF keyframe tracks is not a smooth polynomial curve, but rather
a piecewise constant function, conceptually and
mathematically equivalent to a zero-order hold (ZOH) or
a sequence of shifted Heaviside step functions.
In a piecewise constant curve, the function's output value remains completely static over an interval and changes instantaneously at specified boundary points. When plotted over time, this produces a discontinuous staircase shape rather than a sloped or curved trajectory.
Mathematical Formulation
In glTF 2.0, animation samplers define an input accessor containing monotonically increasing floating-point timestamps \(t_0, t_1, \dots, t_n\) and an output accessor containing keyframe values \(v_0, v_1, \dots, v_n\).
For any continuous evaluation time \(t\) between the keyframe timestamps \(t_k\) and \(t_{k+1}\), the STEP
interpolation function \(f(t)\) is
defined as:
\[f(t) = v_k \quad \text{for} \quad t_k \le t < t_{k+1}\]
Using the unit step (Heaviside) function \(H(t)\), where:
\[H(t) = \begin{cases} 0, & t < 0 \\ 1, & t \ge 0 \end{cases}\]
The track's trajectory across all keyframes can be represented as a linear combination of shifted step functions:
\[f(t) = v_0 + \sum_{k=0}^{n-1} (v_{k+1} - v_k) H(t - t_{k+1})\]
Behavior in glTF Animation Tracks
- Immediate State Retention: The animation track maintains the exact value \(v_k\) of the preceding keyframe throughout the entire duration of the interval \([t_k, t_{k+1})\).
- Instantaneous Transition: Exactly at \(t = t_{k+1}\), the output jumps directly to \(v_{k+1}\) with no intermediate calculation, easing, or blending.
- Derivative Properties: The mathematical derivative of this function with respect to time (\(f'(t)\)) is zero everywhere except at the exact boundary timestamps \(t_k\), where it is mathematically undefined (represented in distribution theory as a Dirac delta function).
Practical Applications in 3D Scenes
Because the curve eliminates transitional values, STEP
interpolation in glTF is commonly used for:
- Discrete State Changes: Toggling boolean-like states, such as visibility or material triggers.
- Stop-Motion Aesthetics: Replicating lower frame-rate physical motion without continuous smoothing.
- Mechanical Switching: Representing rigid mechanical toggles, stepped dials, or gear shifts that snap instantaneously into position.