Skip to main content
Version: 3.5.x

SDF Shape Catalogue

Visual reference: Inigo Quilez — 3D Distance Functions

What is an SDF?

A signed distance function returns the distance from any point in space to the nearest surface of a shape — negative inside, zero on the surface, positive outside. That distance becomes the input to a force curve: closer to the surface means more force, farther away means none.

SDF shapes are used by the Navigation module (bubble shape).

A shape is described by a primitive and a parameters block:

{
"shape": {
"primitive": "sphere",
"parameters": { "r": 0.05 }
}
}

Basic shapes

PrimitiveParametersNotes
spherer (radius)Simplest shape
ellipsoida (semi-axis radii as vec3)Approximate SDF; accurate for forces
boxb (half-extents as vec3)Axis-aligned
rounded_boxb (half-extents), r (corner radius)Total extent = b + r
box_frameb (half-extents), e (edge thickness)Wireframe outline of a box
planen (normal vec3), h (offset along n)Infinite half-space; n must be normalised

Capsules and cylinders

PrimitiveParametersNotes
capsulea, b (endpoint positions as vec3), r (radius)Hemispherical caps
capsule_verticalh (half-height), r (radius)Y-axis shorthand
capped_cylindera, b (axis endpoints as vec3), r (radius)Flat end caps
capped_cylinder_verticalh (half-height), r (radius)Y-axis shorthand

Torus family

PrimitiveParametersNotes
torusr1 (major radius), r2 (tube radius)Donut in the XZ plane
capped_torussc (cap direction as vec2), r1, r2Arc; sc = (cos θ, sin θ)
linkle (half-length), r1 (ring radius), r2 (tube radius)Chain-link shape

Cones

PrimitiveParametersNotes
conec (angle as vec2 (sin α, cos α)), h (height)Infinite cone clipped at tip
capped_conea, b (endpoints as vec3), r1 (base radius), r2 (top radius)Frustum
rounded_conea, b (endpoints as vec3), r1, r2Frustum with spherical caps
solid_anglec (angle as vec2), r (radius)Sphere sliced by a cone

Exotic shapes

PrimitiveParametersNotes
vesica_revolveda, b (axis as vec3), w (width)Lens shape
rhombusla, lb (half-diagonals), h (extrusion half-height), r (rounding)Diamond cross-section
pyramidh (height)Square base
octahedronr (inradius)Regular octahedron
hexagonal_prismr (circumradius), h (half-height)Along Y
triangular_prismw (half-width), h (half-height)Along Z
Parameter types

Scalar parameters (r, h, e, etc.) are plain numbers. Vector parameters (a, b, n) are objects: { "x": 0.0, "y": 0.0, "z": 0.0 }. Vec2 parameters (c, sc) are objects: { "x": 0.707, "y": 0.707 }.

JSON examples

Sphere:

{ "primitive": "sphere", "parameters": { "r": 0.05 } }

Ellipsoid (wider X/Z):

{ "primitive": "ellipsoid", "parameters": { "a": { "x": 0.06, "y": 0.03, "z": 0.06 } } }

Box:

{ "primitive": "box", "parameters": { "b": { "x": 0.04, "y": 0.02, "z": 0.04 } } }

Rounded box:

{ "primitive": "rounded_box", "parameters": { "b": { "x": 0.30, "y": 0.02, "z": 0.30 }, "r": 0.01 } }

Capsule:

{
"primitive": "capsule",
"parameters": {
"a": { "x": 0.0, "y": -0.03, "z": 0.0 },
"b": { "x": 0.0, "y": 0.03, "z": 0.0 },
"r": 0.04
}
}

Plane (boundary along +X):

{ "primitive": "plane", "parameters": { "n": { "x": 1.0, "y": 0.0, "z": 0.0 }, "h": 0.0 } }

Torus:

{ "primitive": "torus", "parameters": { "r1": 0.08, "r2": 0.02 } }

Capped cone (frustum):

{
"primitive": "capped_cone",
"parameters": {
"a": { "x": 0.0, "y": -0.05, "z": 0.0 },
"b": { "x": 0.0, "y": 0.05, "z": 0.0 },
"r1": 0.04, "r2": 0.01
}
}

If an unsupported primitive is supplied, the service falls back to a distance-from-origin sphere-like evaluation.