The tapered limb is not a lerped capsule
Limbs taper, so the obvious primitive is a capsule whose radius interpolates from one end to the other. It is two extra characters, it draws a convincing tapered shape, and it does not return a distance.
Watch the cyan outline, which is drawn at one fixed distance from the surface in both halves. On the right it holds a constant width the whole way along. On the left it is fat at the wide end and pinched at the tip, because the field is reporting the wrong distance and anything reading that distance inherits the error.
Why the lerp fails
A capsule works by projecting onto its axis and subtracting a radius. That is exact while the radius is constant, because the nearest point on the surface really is directly out from the axis.
Taper it and the surface becomes a cone, tilted relative to the axis. The nearest point on a tilted surface is no longer straight out from the axis, so the projection lands in the wrong place, and the answer is off by a factor related to the cone's slope. Gentle tapers hide it. Strong ones do not, which is why this survives on arms and falls apart the moment someone models a horn or a tail.
The correct primitive already exists
The uneven capsule is the published closed form for exactly this shape. Its key term is
dot(p, vec2(a, b)) - r1, a projection onto the sloped surface
where b is the taper slope, rather than onto the axis. Two branches and a
sqrt, and it is correct.
The same reasoning applies anywhere a parameter varies along a primitive. Sweeping a radius, a width or a thickness along a shape almost always breaks the distance property unless the closed form was derived for the swept version.
What it costs you to get wrong
- Outline and glow width vary along the limb, which is the visible tell.
- Blends land in the wrong place, since
smincompares distances and one of them is lying. - Bevels and rim lights ride the wrong isoline, so the shading thickness pumps along the taper.
- Marching oversteps at the thin end, because that is where the error goes positive.
Rules of thumb
- Do not lerp a radius along a capsule. Use a round cone.
- Test a primitive with a STRONG taper. A gentle one hides the error.
- Draw an outline at a fixed distance. Varying width means the field is wrong.
- Any parameter varying along a primitive is suspect until the closed form says otherwise.
- If a limb's rim light pumps thicker and thinner along its length, this is why.
One email when something new goes up. No newsletter, no schedule, nothing else.
Double opt-in, so watch for a confirmation email. Unsubscribe any time.