A Signed Distance Function (SDF) tells you how far any point is from the nearest edge of a shape — positive outside, negative inside, zero right on the boundary. For a circle, the SDF is beautifully simple: length(uv) - radius. You can turn that distance into a crisp shape using step(), or get smooth anti-aliased edges with smoothstep(). SDFs are the building block for drawing shapes in shaders without any geometry.
Key Concepts
SDF concept
length()
step() vs smoothstep()
anti-aliasing
Try this shader live in the Shader Sandbox editor with real-time preview.