Advanced SDF geometry: curves, implicit forms, and material channels
Learning objectives
- learner can derive SDFs from implicit equations and build quadratic Bezier curve fields
- learner can reason about exact vs approximate SDFs and use signed backtracking
- learner can extend map() with material IDs and vec4 auxiliary channels and map spherical UVs onto surfaces
Capstone — one whole task that evidences the objectives
Build an SDF scene featuring a Bezier-curve glyph derived from an implicit equation, returning per-object material IDs plus vec4 auxiliary UV/occlusion channels, and texture a sphere with spherical UVs.
Prerequisite modules
This module is where your raymarched visuals stop looking like demo-scene sphere soup and start carrying identity. In a live set, the shapes on screen are your typography: a logo glyph, a signature curve, a textured planet that recurs across the night. The capstone is exactly that whole task — a Bezier-curve glyph grown from an implicit equation, wired into a scene that reports material IDs and auxiliary channels so the shading pass can texture a sphere with proper spherical UVs, all running at projector framerate.
The arc starts supported: take a known implicit curve and convert it to a distance field using the deriving-SDFs-from-implicit-equations procedure, then swap in IQ’s three-control-point quadratic Bezier field and animate its control points — these two are your part-task drills, because mid-performance you will sketch curves faster than you can look them up. Next you confront why the glyph flickers or crawls: the exact-versus-approximate distinction explains your step sizes, and abs()-based signed backtracking is the JIT fix when a displaced field overshoots. Finally you plumb the data path — extending map() to a vec4 so UVs and occlusion travel with the winning material, then mapping latitude/longitude onto the sphere.
The required atoms gate the capstone directly: without the implicit-equation and Bezier techniques there is no glyph; without exactness reasoning and backtracking it won’t render stably; without vec4 channels and spherical UVs there is nothing to texture. Supporting atoms deepen the craft — polynomial smooth-min rigidity for when you later blend glyphs, ray differentials for antialiased edges, and Perlin noise as a UV-free alternative texture source.
Runnable examples
Generated from the context/ instrument corpus by concept (redistributable idioms only). Do not edit — regenerate with gen-module-examples.mjs.
sdf-shape
circle [0,0] 0.4 >> add
punctual-0018 · CC0-1.0
float d = length(uv) - r;
glsl-0003 · public-domain
noise-field
noise(4, 0.1).out()
hydra-0002 · CC0-1.0
float h21(vec2 p){return fract(sin(dot(p,vec2(12.9898,78.233)))*43758.5453);}
glsl-0013 · public-domain
raymarch-sdf
vec3 nrm(vec3 p){vec2 e=vec2(.001,0);return normalize(vec3(map(p+e.xyy)-map(p-e.xyy),map(p+e.yxy)-map(p-e.yxy),map(p+e.yyx)-map(p-e.yyx)));}
glsl-0033 · public-domain
Atoms in this module
Required — these gate the capstone
Supporting — enrichment, not gating
Part of curricula
- Shader Artist — real-time GPU craft to a demoscene-grade visual — Lighting, PBR, and optimized raymarched scenes required
Unlocks — modules that require this one