home/ atoms/ squash-stretch-volume-preservation

Squash-and-stretch animation preserves volume by inversely scaling perpendicular axes

The first of the 12 principles of animation: when a body compresses along one axis (squash at ground contact) it must expand along the perpendicular axes so its total volume stays constant. For an ellipsoid with radii (rx, ry, rz), if ry is halved, rz must increase so rx·ry·rz remains constant. In GLSL this means the inverse of the vertical compression factor scales the horizontal radius. A misconception is to only shrink vertically without compensating — the result looks like the object is deflating rather than impacting.

Examples

float sy = mix(0.5, 1.0, h); // vertical scale float sz = 1.0/sy; // volume compensation vec3 rad = vec3(0.25, 0.25*sy, 0.25*sz);

Assessment

An ellipsoid is squashed to 60% of its vertical radius. By what factor must the depth (z) radius scale to preserve volume if the horizontal (x) radius stays constant?

“preserve volume, right? It's not like when you have a bit of a ball of jelly or something or an object, which is what is called, like plastic deformation or something”
corpus · inigo-quilez-live-coding-happy-jumping-video · chunk 7