advanced

#18 Morphing Shapes

Interpolating between SDFs

Since SDFs are just numbers representing distance, you can blend between two completely different shapes by interpolating their distance values with mix(sdf1, sdf2, t). As t animates from 0 to 1, one shape smoothly morphs into the other — a circle melts into a square, a triangle flows into a star. Smoothing the blend factor with a cubic curve (the hermite S-curve) makes the transition feel natural rather than linear. This technique works with any SDF shape you can define.

Key Concepts

Try this shader live in the Shader Sandbox editor with real-time preview.
Open in Sandbox

Source Code


    
← Previous Glow & Bloom Next → Texture Sampling

All Tutorials