Curves Through Points: Hermite and Catmull-Rom
Bézier curves only touch their two ends, but camera paths and animation keys need a curve that passes through every point you set. A Hermite segment is the cubic that starts and ends where you say, moving at the velocities you say; Catmull-Rom chooses those velocities from the neighboring points, so you just list waypoints and get a smooth path through all of them.
What the symbols mean
- Start point
Where the segment starts, at t = 0.
- End point
Where the segment ends, at t = 1.
- Start velocity
The tangent you want at the start: the derivative H′(0).
- End velocity
The tangent you want at the end: the derivative H′(1).
What the symbols mean
- Weight of the start point
1 at t = 0, 0 at t = 1, flat at both ends.
- Weight of the end point
This is smoothstep: 0 at t = 0, 1 at t = 1, flat at both ends.
- Weight of the start velocity
0 at both ends with slope 1 at the start, so it adds exactly m₀ to the starting velocity.
- Weight of the end velocity
0 at both ends with slope 1 at the end.
What the symbols mean
- Tangent at waypoint i
The velocity used by both segments that meet at waypoint i, which makes the path C¹.
- Neighbor-to-neighbor chord
The arrow from the waypoint before to the waypoint after. The tangent is half of it.
What the symbols mean
- Knot
The parameter value at which the curve passes waypoint i.
- Spacing exponent
How much the distance between waypoints stretches the parameter. ½ is the one that never makes cusps or loops.
Explanation
A Catmull-Rom spline is a smooth curve that passes through every point you give it, which is exactly what you want for a camera path through waypoints or an animated value through its keys. It's named after Edwin Catmull and Raphael Rom, who described it in 1974; Catmull went on to become one of the pioneers of computer animation. Every piece between two neighboring waypoints is a Hermite segment: a cubic you build from where it starts, where it ends and how fast it's moving at each end. That one is named after Charles Hermite, a 19th-century mathematician who studied fitting curves to values and slopes. Catmull-Rom's only job is to pick those end velocities for you, from the neighboring waypoints. So it's two small ideas stacked on top of each other: a Hermite segment, and a rule for its tangents.
Why not just Bézier? A Bézier curve passes through its two end points only; the handles are off the curve. For a camera that has to fly through five waypoints, you'd have to invent two handles for every piece by hand, and keep them mirrored across every waypoint so the motion doesn't jolt (Joining Curves Smoothly). Catmull-Rom does both for you.
Points and velocities in, cubic out. Look for one coordinate of the segment as a cubic . We want four things: , , and . Four conditions, four unknowns. The first two at give and right away. The two at give
Subtract twice the first from the second to get , then . Now regroup by what multiplies , , and , and out come the four basis functions at the top. Notice : that's smoothstep. Smoothstep is just the Hermite segment from to with both velocities zero.
A Hermite segment is a Bézier in disguise. A cubic Bézier leaves with velocity . For that to be , the first handle must be , and likewise the second is . So every Hermite segment is the Bézier with those four control points, and everything from the earlier lessons (de Casteljau, splitting, the derivative) works on it.
Catmull-Rom: tangents from the neighbors. Given waypoints , use the tangent at each one. In words: at each waypoint, head in the direction from the previous waypoint toward the next. Think about why that's a sensible guess. It's the same as estimating a slope from the points on either side, , with being one segment's worth of (see The Derivative). What you get for free:
- The path passes through every waypoint, since each segment starts on one and ends on the next.
- It's : the two segments that meet at use the same , so the velocity doesn't jump.
- It's local: moving one waypoint changes only the tangents of its two neighbors, so only the four segments nearby move.
- The two end waypoints have only one neighbor, so you add an extra point past each end; a common choice reflects, .
- It is not : the acceleration usually jumps at the waypoints.
For the segment from to , plug the tangents into the Hermite formula and collect by waypoint:
Halfway, at , that's . Notice the negative weights: unlike a Bézier curve, a Catmull-Rom curve can leave the hull of its points.
// Uniform Catmull-Rom from p1 to p2 (one coordinate), t from 0 to 1.
function catmullRom(p0: number, p1: number, p2: number, p3: number, t: number): number {
const m1 = (p2 - p0) / 2, m2 = (p3 - p1) / 2; // tangents from the neighbors
const t2 = t * t, t3 = t2 * t;
return (2 * t3 - 3 * t2 + 1) * p1 + (t3 - 2 * t2 + t) * m1 // Hermite
+ (-2 * t3 + 3 * t2) * p2 + (t3 - t2) * m2;
}
Camera paths through waypoints. An animator sets the camera's position at a few key times and the spline fills in the rest. With keys one second apart, each segment is one second and is the time within it. There's an animation further down of a camera flying through five waypoints, showing the four points that steer the piece it's on and the two tangents at that piece's ends.
When even spacing goes wrong: cusps and loops. Uniform Catmull-Rom gives every segment the same one unit of , whether the waypoints are m apart or cm apart. On a short segment between two long ones, the tangents (half of a long neighbor-to-neighbor chord) are far too big for the tiny distance the segment has to cover. The curve overshoots, and at a sharp turn it can form a cusp or tie a small loop. The fix, studied by Yuksel, Schaefer and Keyser, is to give each segment an amount of parameter based on its length: the knots . With every gap is (uniform); with every gap is the segment's length (chordal); with every gap is the square root of the length (centripetal). They proved that centripetal is the only choice in this family that can never make a cusp or a self-intersection inside a segment, whatever the waypoints, and it tends to follow the waypoints more tightly too.
To evaluate with knots, it's nested lerps again, just like de Casteljau, except the knots decide the fractions. For between and :
If you'd rather keep using Hermite segments, the same curve has, at the start of the segment (with running from to across it), the tangent
and the same with every index moved up by one at its end. With all gaps equal to it collapses to , the uniform tangent.
A common mistake. It's tempting to think a curve that passes through every key can't go beyond them. It can, because of those negative weights. Key a lamp's brightness at on four frames and the Catmull-Rom curve between the two middle 's bulges above before settling: the tangent at the first still points up, borrowed from the jump before it. Animation tools offer "clamped" or "flat" tangents at holds for exactly this reason.
See it
Worked examples
A uniform Catmull-Rom path passes through , , and . Find the point halfway through the segment from to by turning it into a Bézier, then check it with the weights.
- 1
The segment runs from to . The outer points and are only there to supply the tangents.
Waypoints , , and make a step: a long run, a short sidestep and another long run. Find the centripetal knots, then compare the uniform and centripetal tangents at the start of the short segment from to .
- 1
Find the three distances. , and .
Practice
Type your answer and check it. Solve them all to complete the lesson.
A Hermite segment for an animated value starts at with velocity and ends at with velocity . What is its value at ?
A Catmull-Rom path passes through , and . What tangent does it use at ? Enter it as .
A Hermite segment starts at with velocity and ends at with velocity . Write it as a cubic Bézier: give its second and third control points. Enter of the second, then of the third.
A uniform Catmull-Rom path passes through , , and . Find the point halfway through the segment from to . Enter the point as .
A drone camera is keyed at heights of , , and meters at times , , and seconds, and a uniform Catmull-Rom spline fills in between. What height does the spline give at seconds?
A camera path has waypoints , , and . With centripetal spacing and , find the knots , and . Enter them in order.
A camera path through unevenly spaced waypoints shows a small loop at a sharp turn. Which knot spacing for Catmull-Rom is guaranteed never to make a cusp or a loop inside a segment?
Find the cubic with , , and : an animated value that starts at rest at and settles at rest at .
The hardest one here. Get it, and you've got this lesson.
An animator keys a lamp's brightness at , , and on frames , , and , intending it to rise to and hold. A uniform Catmull-Rom spline fills in between frames. What is the highest brightness the spline reaches between frames and ?
Where it's used
Animation software fills in between keyframes with Catmull-Rom or Hermite curves by default, which is why graph editors show tangent handles on every key and offer "flat" and "clamped" options to stop overshoot. Game cameras, cinematic flythroughs and drone mapping missions fly Catmull-Rom paths through waypoints, usually centripetal so close-together waypoints don't make the camera whip around. The same splines interpolate motion-capture samples, sensor readings and terrain profiles, anywhere you have samples and need a smooth curve that honors every one.