Primitive-based SDFs define scenes as mathematical formulae rather than volumetric grids, giving infinite precision and a tiny memory footprint
Two approaches exist for SDFs: volumetric (sample the distance into a 3D grid) and primitive-based (compute the distance analytically from mathematical primitives at runtime). IQ’s focus from 2007 was the primitive-based approach: every object in the scene is expressed as a formula — sphere, box, cylinder, torus — composed via CSG (boolean min/max/smooth-min operations). This gives infinite sharpness and precision (no voxel grid to scale), a tiny memory footprint, and GPU-friendly compute. The tradeoff is that rendering an unlimited number of primitives and their CSG operations needs acceleration structures and more complex techniques than volumes, which have constant access time. Primitive-based SDFs became the dominant approach in demoscene intros and Shadertoy because of these properties.
Examples
A scene with a sphere, a box, and a smooth-blended union: float d = smin(sdSphere(p,0.5), sdBox(p,vec3(0.3)),0.1); — the entire scene in one line, no textures, no meshes.
Assessment
Compare primitive-based and volumetric SDF approaches in terms of memory footprint, precision, and access-time/acceleration cost; explain why demoscene productions prefer the primitive-based form.