Sphere tracing ยท Signed Distance Fields ยท Soft shadows ยท Ambient occlusion
Drag canvas to rotate camera
Render any 3D shape defined purely by a mathematical formula. The ray marcher steps along camera rays, querying a signed distance function (SDF) to find surfaces โ no polygons required.
An SDF returns the shortest distance from any point to the nearest surface. Ray marching (sphere tracing) takes steps of exactly that distance โ guaranteed safe โ then halts when the distance falls below a threshold. Because distances combine via smooth-min and boolean operations (union, intersection, subtraction), complex shapes like Mandelbulbs, metaballs and rounded boxes emerge from short formulas. Soft shadows are computed by tracking the minimum SDF value along shadow rays.
Drag the scene to orbit the camera. Use the sliders to adjust shadow softness (penumbra angle), ambient occlusion steps, orbit speed, and field of view. Switch between scenes to see different SDF compositions โ from simple spheres and boxes to metaball blending and fractal distance estimators. Toggle ambient occlusion on/off to see how it darkens concave areas and adds depth.
Inigo Quilez popularised ray marching on ShaderToy, a platform where GLSL shaders run live in the browser. His "Raymarching Primitives" page (2008) gave the community a library of SDF formulas that is still the standard reference. Ray marching was later adopted in game production โ the fog and cloud volumes in AAA titles like Horizon: Zero Dawn and Death Stranding are computed with variants of sphere-tracing SDF volumes.