Writing SDFs by hand is fun! But it can be a slow and arduous process.

This tool is an signed distance field (SDF) code generator running inside Unity.

It lets the user make and combine distance functions to make interesting scenes inside an intuitive editor such as Unity. It then tries to optimize the code for specific known cases (for example, it tries to prevent using matrices when dealing with planes), but it is far from complete. There’s still a lot of optimization left to do.

It also features a generic, dynamic raymarching renderer inside Unity’s editor so that composing the final SDF is easy. It can output GLSL and HLSL code.

Check out the source code at GitHub!

Example SDFs

An approximation of the Sponza Atrium

Diablo 3’s Soulstone