Links
Description
This project is a renderer that raymarches 3D signed distance field (SDF) scenes and outputs SVG files with hatching lines. The hatching strokes follow surface tangent directions, with density controlled by lighting, producing an engraving or etching aesthetic inspired by Piter Pasma’s “rayhatching” technique.
The rendering pipeline has three passes. First, a Rust backend raymarches the SDF scene per-pixel using rayon parallelism, producing hit, brightness, and hatch angle buffers. Then a flow field line tracer connects polylines through the 2D angle field, enforcing minimum spacing that varies with brightness to create light and shadow. Finally, the polylines are written out as SVG.
Scenes are defined in Python as trees of SDF nodes (spheres, boxes, tori, boolean operations, transforms) which are evaluated natively in Rust via PyO3, giving roughly 150x speedup over pure Python.
Tech stack
- Rust with PyO3 for the raymarching and line tracing engine
- Python for scene definition and SVG output
- rayon for parallel rendering
- maturin for building the Rust extension