NOTE: This site has just upgraded to Forester 5.x and is still having some style and functionality issues, we will fix them ASAP.

example. SDF of a sphere [ag-000L]

The SDF of a sphere with radius \(r\) centered at the origin \(\boldsymbol {o}\) is \[ f(\boldsymbol {p})=\lVert \boldsymbol {p}\rVert -r \] as depicted below:

The SDF above for a sphere translates to the following GLSL:

float sdSphere(vec3 p, float r) { return length(p) - r; }