Apex › Storage & databases

How ray-marching renders with math (SDF)

How Shadertoy and demoscene intros render whole worlds with no meshes — the scene is a signed distance function (for any point, the distance to the nearest surface), and a ray steps forward by that distance each time (sphere tracing), safe because nothing is closer. Big steps in open space, small near surfaces, converging in a handful of iterations. Real sphere tracing on a 2-D slice: aim the ray and watch it leap, creep, and converge (or miss). The field also gives normals, CSG, soft shadows, and AO almost for free.

More in Storage & databases