A Recursive Algorithm to Render Signed Distance Fields
4 days ago
- #SDF
- #ProceduralGraphics
- #Raymarching
- Signed Distance Fields (SDFs) are a mathematical way to define 3D objects using functions that compute distances to surfaces.
- SDFs can be easily combined, allowing operations like subtraction, morphing, and bending, which are difficult with polygons.
- Inigo Quilez popularized SDFs, and the demoscene, particularly Mercury crew, showcased their potential in 64KB demos.
- Raymarching or sphere tracing is the standard algorithm for rendering SDFs, simpler than rasterization but computationally expensive.
- Compiler techniques like partial evaluation and interval arithmetic can optimize SDF rendering but require complex implementations.
- Modern GPUs made real-time SDF rendering practical, but CPU-based approaches offer advantages like unified codebases.
- A recursive divide-and-conquer algorithm for CPU-based SDF rendering can reduce rays per pixel and increase frame rates.
- Linear interpolation can further optimize rendering by shading patches of pixels, reducing samples per pixel.
- Cone marching, a multi-pass GPU technique, is an existing method similar to the proposed recursive subdivision approach.
- Optimized CPU-based SDF rendering could enable GPU-less 3D games, with current techniques achieving 50-100 FPS on a single core.