Dynamic SDF Rendering for Automated Video
Overview
- Project: Automated Video Generation Pipeline
- Status: Active — evaluation phase
- Concept: “Geometry as code” — entire 3D scenes defined by mathematical functions in text files
Why SDFs for Automation
| Advantage | Relevance |
|---|---|
| Version control friendly | Scene is kilobytes of GLSL code, diffable via Git |
| Procedural generation | Inject variables (time, audio, text) directly into rendering equations |
| AI-compatible | Claude/Gemini can generate/debug GLSL faster than manipulating binary 3D files |
Technical Architecture
Core: Raymarching via GLSL Fragment Shader
Instead of rasterizing triangles, shoot a ray per pixel and step along it querying the distance field. Dynamic via uniforms:
uniform float iTime;— animationuniform vec3 iAudioLow;— audio reactivityuniform float iDeformStrength;— shape modulation
CLI Renderer: glslViewer
Headless mode rendering piped directly to FFmpeg:
glslViewer scene.frag --headless --width 1920 --height 1080 \
| ffmpeg -f rawvideo -pixel_format rgba -video_size 1920x1080 -i - output.mp4Python Orchestration
- Accept input data (e.g., project completion %)
- Modify GLSL file or pass data as uniforms
- Trigger render command
- Merge output with audio tracks
Use Cases
Status Visualizers
3D fluid containers filling based on project data. SDF boolean intersection between Box (container) and Plane (liquid level) with smooth minimum blending.
Audio-Reactive Backgrounds
Domain repetition via modulo operator creates infinite fields of pulsing shapes. Feed audio amplitude into SDF sphere radius.
Morphing Logos
Linear interpolation between distance functions: mix(sdSphere, sdBox, 0.5 + 0.5*sin(time)) — logo morphs between shapes representing different apps.
Recommended Stack
- Language: GLSL (OpenGL Shading Language)
- Editor: Neovim with glsl-analyzer LSP
- Preview: glslViewer (live coding, updates on save)
- Reference: Inigo Quilez (iq) — foundational SDF documentation
Related
- remotion — Code-driven video production with React
- procedural-generation-workflows — Multi-tier procedural generators