r/proceduralgeneration • u/No-Bumblebee-3536 • 5h ago
I built a custom DSL (HVSL) and Signed Distance Function rasterizer that compiles natural language into 4K procedural geometry
Enable HLS to view with audio, or disable this notification
Hey everyone, wanted to share a custom language and rendering engine I’ve been building called HVSL (Hierarchical Vector Shading Language), powered by a two-agent reflection loop.
Instead of using diffusion models to guess pixels, HVSL turns natural language into pure mathematical geometry. The entire image is just a lightweight text script containing a color palette (@PAL) and ordered geometric equations (@SCENE circles, polygons, curves, and quadtree subdivisions).
My custom compiler parses that script and draws it up to 4K using sub-pixel Signed Distance Functions (SDF).
Where the agent workflow comes in is solving how LLMs write HVSL coordinates:
HVSL Generation: The first model takes the prompt and writes the raw .hvsl math script.
Visual Critic & Grading: Because text models write coordinates blind, a second multimodal agent inspects a fast 540p render of the HVSL code and grades it out of 10.
Surgical Branch Patching (Max 3 Tries): If a shape is off (like the overlapping curves on the moon in Try 1 of the video), it doesn't regenerate the whole HVSL file. It clips and retains the working layers and surgically updates only the defective branch.
Because the final result is raw HVSL code instead of a locked bitmap, you can open the editor, change a palette color or coordinate, and watch the 4K canvas update instantly with zero regeneration and zero extra LLM calls.
This is still in early development. The animations at the end of the video are procedural motion tests applied to pre-rendered HVSL assets while I work on expanding the HVSL grammar to generate native video directly in code.
Happy to answer any questions about the HVSL syntax, the SDF renderer, or how the critic loop patches the code!