2D Signed Distance Functions

Shapes, math, and a legend: fans swoon, devs nitpick

TLDR: Inigo Quilez released faster 2D shape formulas with live [Shadertoy] demos, inviting feedback. Comments split between hero worship and practical nitpicks: confusing parameter names and a push for a simple language to compose shapes beyond add/subtract — making graphics math more powerful and accessible.

Graphics wizard Inigo Quilez just dropped a pack of 2D “signed distance” shape formulas — think simple math recipes that tell you how far a point is from a shape — tuned to be faster with fewer square roots, plus live demos in a Shadertoy playlist. He even says: if you spot mistakes, call them out.

The top vibe is adoration. One fan, jesse__, calls IQ “a living legend” and credits his videos for a full-blown graphics obsession. But there’s spice: on_the_train loves the resource yet rolls eyes at the parameter names, confessing it’s “trial and error” every time. That annoyance snowballed into a mini naming-rights drama: should these examples label inputs like plain English instead of cryptic letters?

Then Lerc drops a brain bomb: why stop at adding and subtracting shapes? Can we freely multiply, divide, or combine distances like a cocktail — maybe even a little domain-specific language to compose shapes with one-liners? Cue the crowd imagining triangles and circles getting “square-root shipped.”

Jokes flew about pilgrimages back to IQ’s blog every project cycle, with folks treating the playlist like a math spa. Mood: hero worship meets wishlist; everyone dives into the demos.

Key Points

  • Provides exact, optimized 2D SDF implementations for multiple primitives, minimizing square roots and divisions.
  • All primitives are centered at the origin; users must transform points for rotation, translation, and scaling.
  • Each primitive includes links to real-time Shadertoy demos and some YouTube explanations, plus a public Shadertoy playlist.
  • A helper dot2(v) function is defined to compute squared vector length for efficiency.
  • Formulas and code are self-derived by the author, with a note inviting corrections or better methods.

Hottest takes

"a living legend" — jesse__
"it's a bit of trial and error figuring out the parameters" — on_the_train
"Can you freely compose signed distance functions?" — Lerc
Made with <3 by @siedrix and @shesho from CDMX. Powered by Forge&Hive.