Skip to content
This is the alpha v4 version website. Looking for the v3 documentation?

GLSL_SDF_BOX

const GLSL_SDF_BOX: ā€œ\nfloat sdfBox(vec2 p, vec2 halfSize) {\n vec2 d = abs(p) - halfSize;\n return length(max(d, 0.0)) + min(max(d.x, d.y), 0.0);\n}\nā€

Defined in: packages/sigma/src/rendering/glsl.ts:67

SDF for an axis-aligned box. Returns signed distance from point p to the box boundary.