sdf2d
2D signed distance fields, boolean operations, and 2D primitive SDF shapes
| Targets | blender-compositor, blender-geometry, blender-gp |
|---|---|
| Version | 0.13.1 (edition 2026) |
| Depends on | — |
| Import | use sdf2d or use sdf2d (name, …) |
| Source | stdlib/sdf2d.bn |
2D Signed Distance Field (SDF) toolkit for Geometry Nodes: elementary 2D primitives, chamfered booleans, repetitions, and isolines. Formulas follow definitions published by Inigo Quilez (iquilezles.org). All functions operate in the XY plane (z ignored).
2D Primitives#
sdf segment 2d#
Signed distance to an XY-plane line segment thickened by thickness (2D: z ignored)
geometry graph "sdf segment 2d"(
p: Vector = Position(),
a: Vector = (-0.5, 0.0, 0.0),
b: Vector = (0.5, 0.0, 0.0),
thickness: Float = 0.1 in 0.0..
) -> Float
| Input | Type | Default | Range |
|---|---|---|---|
p | Vector | Position() | |
a | Vector | (-0.5, 0.0, 0.0) | |
b | Vector | (0.5, 0.0, 0.0) | |
thickness | Float | 0.1 | 0.0.. |
sdf rounded box 2d#
XY-plane rectangle with rounded corners of given half-size (2D: z ignored)
geometry graph "sdf rounded box 2d"(
p: Vector = Position(),
"half size": Vector = (0.6, 0.4, 0.0),
radius: Float = 0.15 in 0.0..
) -> Float
| Input | Type | Default | Range |
|---|---|---|---|
p | Vector | Position() | |
half_size | Vector | (0.6, 0.4, 0.0) | |
radius | Float | 0.15 | 0.0.. |
sdf rhombus 2d#
XY-plane rhombus centered at origin (2D: z ignored)
geometry graph "sdf rhombus 2d"(
p: Vector = Position(),
"half size": Vector = (0.6, 0.4, 0.0)
) -> Float
| Input | Type | Default | Range |
|---|---|---|---|
p | Vector | Position() | |
half_size | Vector | (0.6, 0.4, 0.0) |
sdf equilateral triangle 2d#
XY-plane equilateral triangle centered at origin (2D: z ignored)
geometry graph "sdf equilateral triangle 2d"(
p: Vector = Position(),
radius: Float = 0.7 in 0.0..
) -> Float
| Input | Type | Default | Range |
|---|---|---|---|
p | Vector | Position() | |
radius | Float | 0.7 | 0.0.. |
not in a shader tree: no Compare in a shader tree
sdf hexagon 2d#
XY-plane regular hexagon centered at origin (2D: z ignored)
geometry graph "sdf hexagon 2d"(p: Vector = Position(), radius: Float = 0.6 in 0.0..) -> Float
| Input | Type | Default | Range |
|---|---|---|---|
p | Vector | Position() | |
radius | Float | 0.6 | 0.0.. |
sdf regular polygon 2d#
XY-plane regular N-sided polygon centered at origin (2D: z ignored)
geometry graph "sdf regular polygon 2d"(
p: Vector = Position(),
radius: Float = 0.6 in 0.0..,
sides: Int = 5 in 3..64
) -> Float
| Input | Type | Default | Range |
|---|---|---|---|
p | Vector | Position() | |
radius | Float | 0.6 | 0.0.. |
sides | Int | 5 | 3..64 |
sdf star 2d#
XY-plane regular N-pointed star (2D: z ignored)
geometry graph "sdf star 2d"(
p: Vector = Position(),
radius: Float = 0.7 in 0.0..,
points: Int = 5 in 3..32,
indent: Float = 0.5 in 0.05..1.0
) -> Float
| Input | Type | Default | Range |
|---|---|---|---|
p | Vector | Position() | |
radius | Float | 0.7 | 0.0.. |
points | Int | 5 | 3..32 |
indent | Float | 0.5 | 0.05..1.0 |
sdf arc 2d#
XY-plane circular arc centered at origin (2D: z ignored)
geometry graph "sdf arc 2d"(
p: Vector = Position(),
aperture: Float = 2.0 in 0.0..3.141593,
radius: Float = 0.6 in 0.0..,
thickness: Float = 0.1 in 0.0..
) -> Float
| Input | Type | Default | Range |
|---|---|---|---|
p | Vector | Position() | |
aperture | Float | 2.0 | 0.0..3.141593 |
radius | Float | 0.6 | 0.0.. |
thickness | Float | 0.1 | 0.0.. |
not in a shader tree: no Compare in a shader tree
sdf sector 2d#
XY-plane angular sector centered at origin (2D: z ignored)
geometry graph "sdf sector 2d"(
p: Vector = Position(),
aperture: Float = 1.0 in 0.0..3.141593,
radius: Float = 0.7 in 0.0..
) -> Float
| Input | Type | Default | Range |
|---|---|---|---|
p | Vector | Position() | |
aperture | Float | 1.0 | 0.0..3.141593 |
radius | Float | 0.7 | 0.0.. |
sdf cross 2d#
XY-plane cross with arms of given length and thickness (2D: z ignored)
geometry graph "sdf cross 2d"(
p: Vector = Position(),
length: Float = 0.7 in 0.0..,
thickness: Float = 0.25 in 0.0..,
radius: Float in 0.0..
) -> Float
| Input | Type | Default | Range |
|---|---|---|---|
p | Vector | Position() | |
length | Float | 0.7 | 0.0.. |
thickness | Float | 0.25 | 0.0.. |
radius | Float | 0.0.. |
not in a shader tree: no Compare in a shader tree
Operators#
sdf ring 2d#
2D shell or band of given thickness centered on an SDF contour
geometry graph "sdf ring 2d"(distance: Float, thickness: Float = 0.1 in 0.0..) -> Float
| Input | Type | Default | Range |
|---|---|---|---|
distance | Float | ||
thickness | Float | 0.1 | 0.0.. |
sdf chamfer union#
Union of two shapes with a beveled chamfer join
geometry graph "sdf chamfer union"(a: Float, b: Float, chamfer: Float = 0.15 in 0.0..) -> Float
| Input | Type | Default | Range |
|---|---|---|---|
a | Float | ||
b | Float | ||
chamfer | Float | 0.15 | 0.0.. |
sdf chamfer subtraction#
Subtraction of b from a with a beveled chamfer join
geometry graph "sdf chamfer subtraction"(
a: Float,
b: Float,
chamfer: Float = 0.15 in 0.0..
) -> Float
| Input | Type | Default | Range |
|---|---|---|---|
a | Float | ||
b | Float | ||
chamfer | Float | 0.15 | 0.0.. |
Domains and Repetition#
sdf repeat 2d#
Repeats the XY plane in an infinite grid: wraps p into its origin-centered cell
geometry graph "sdf repeat 2d"(p: Vector = Position(), cell: Vector = (1.0, 1.0, 0.0)) -> Vector
| Input | Type | Default | Range |
|---|---|---|---|
p | Vector | Position() | |
cell | Vector | (1.0, 1.0, 0.0) |
sdf limited repeat 2d#
Repeats the XY plane in a finite origin-centered grid without distance discontinuities
geometry graph "sdf limited repeat 2d"(
p: Vector = Position(),
step: Float = 1.0 in 0.0001..,
limit: Vector = (2.0, 2.0, 0.0)
) -> Vector
| Input | Type | Default | Range |
|---|---|---|---|
p | Vector | Position() | |
step | Float | 1.0 | 0.0001.. |
limit | Vector | (2.0, 2.0, 0.0) |
sdf polar repeat 2d#
Repeats the XY plane with radial symmetry across N angular sectors
geometry graph "sdf polar repeat 2d"(p: Vector = Position(), sectors: Int = 6 in 1..128) -> Vector
| Input | Type | Default | Range |
|---|---|---|---|
p | Vector | Position() | |
sectors | Int | 6 | 1..128 |
sdf isolines#
Distance field to contour lines (isolines) spaced by step
geometry graph "sdf isolines"(
distance: Float,
step: Float = 0.2 in 0.001..,
width: Float = 0.03 in 0.0..
) -> Float
| Input | Type | Default | Range |
|---|---|---|---|
distance | Float | ||
step | Float | 0.2 | 0.001.. |
width | Float | 0.03 | 0.0.. |