Every pixel fires a ray into a 3D scene defined entirely by a signed distance function (SDF). Given any point in space, the SDF returns the distance to the nearest surface. The ray marcher uses sphere tracing: it steps forward by exactly that distance each iteration. Because the SDF is a lower bound on the true distance, the ray is guaranteed never to overshoot a surface. Convergence is fast in open space and slows gracefully near geometry.
The shapes are SDFs for sphere, box, torus, and octahedron, blended together with a smooth minimum (polynomial or exponential) that produces organic-looking joins instead of hard intersections. The infinite grid comes from applying fmod to the ray position before evaluating the SDF, effectively tiling a single cell across all of space. Each cell morphs at its own phase offset, so the grid breathes.
Ambient occlusion is computed by sampling the distance field at a few points along the surface normal. If those samples return distances much smaller than their offset from the surface, the point is recessed and gets darkened. Soft shadows work by a similar principle: as a shadow ray marches toward the light, it tracks the closest pass to any geometry. The closer the near-miss, the darker the penumbra. Both effects cost only a few extra SDF evaluations per pixel.
Normals are the gradient of the distance field, estimated with central differences. No geometry buffers, no vertices, no triangles. The entire scene is a single fullscreen fragment shader evaluating math per pixel. Move your mouse to orbit the camera and watch how the soft shadows shift across the infinite lattice.
Inigo Quilez, SDF · Wikipedia