Skip to main content

Box Frame

Code Example

#define len(x, y, z) length(max(vec3(x, y, z), 0.)) + min(max(x, max(y, z)), 0.)
float boxFrameFrameSDF(vec3 p, vec3 b, float e) {
        p = abs(p) - b;
        vec3 q = abs(p + e) - e;
        return min(min(len(p.x, q.y, q.z), len(q.x, p.y, q.z)), len(q.x, q.y, p.z));
}