base-node (.bn) v0.13.1

mask2d

Compositor masks drawn by signed distance fields: disk, box, polygon, star, outline, letterbox

Targetsblender-compositor
Version0.13.1 (edition 2026)
Depends onmath, sdf2d
Importuse mask2d or use mask2d (name, …)
Sourcestdlib/mask2d.bn · example examples/mask2d_showcase.bn

Compositor masks drawn by the signed distance fields of math and sdf2d. A shape is placed in the image's uniform coordinates: the origin at the image's center, y up, its larger side from -1 to 1, so that a circle stays round whatever the aspect of the image. A mask is 1 inside and 0 outside; its edge is smoothed over one pixel, plus feather, in the same units. Each shape also gives its Distance, to be combined (min, max) or outlined.

mask2d

Space and edge#

pixel size#

Size of one pixel of the image in its uniform coordinates: 2 over its larger side

compositor graph "pixel size"(image: Color) -> Float
InputTypeDefaultRange
imageColor
geometry ✗shader ✗compositor ✓

shape space#

Uniform coordinates of the image, moved to center and turned by angle: where a shape is drawn

compositor graph "shape space"(
    image: Color,
    center: Vector = (0.0, 0.0),
    angle: Float(subtype: ANGLE)
) -> Vector
InputTypeDefaultRange
imageColor
centerVector(0.0, 0.0)
angleFloat
geometry ✗shader ✗compositor ✓

sdf mask#

Mask of a signed distance: 1 inside, 0 outside, its edge smoothed over one pixel plus feather

compositor graph "sdf mask"(image: Color, distance: Float, feather: Float in 0.0..) -> Float
InputTypeDefaultRange
imageColor
distanceFloat
featherFloat0.0..
geometry ✗shader ✗compositor ✓

outline mask#

Mask of a line of given width along the edge of a shape, from its Distance

compositor graph "outline mask"(
    image: Color,
    distance: Float,
    width: Float = 0.02 in 0.0..,
    feather: Float in 0.0..
) -> Float
InputTypeDefaultRange
imageColor
distanceFloat
widthFloat0.020.0..
featherFloat0.0..
geometry ✗shader ✗compositor ✓

Shapes#

circle mask#

Disk of given radius

compositor graph "circle mask"(
    image: Color,
    radius: Float = 0.5 in 0.0..,
    feather: Float in 0.0..,
    center: Vector = (0.0, 0.0)
) -> (Mask: Float, Distance: Float)
InputTypeDefaultRange
imageColor
radiusFloat0.50.0..
featherFloat0.0..
centerVector(0.0, 0.0)
geometry ✗shader ✗compositor ✓

box mask#

Rectangle of given half size, its corners rounded by roundness

compositor graph "box mask"(
    image: Color,
    "half size": Vector = (0.6, 0.4),
    roundness: Float = 0.1 in 0.0..,
    feather: Float in 0.0..,
    "Transform"(default_closed: true) {
        center: Vector = (0.0, 0.0),
        angle: Float(subtype: ANGLE)
    }
) -> (Mask: Float, Distance: Float)
InputTypeDefaultRange
imageColor
half_sizeVector(0.6, 0.4)
roundnessFloat0.10.0..
featherFloat0.0..
centerVector(0.0, 0.0)
angleFloat
geometry ✗shader ✗compositor ✓

polygon mask#

Regular polygon of given number of sides

compositor graph "polygon mask"(
    image: Color,
    radius: Float = 0.5 in 0.0..,
    sides: Int = 6 in 3..64,
    feather: Float in 0.0..,
    "Transform"(default_closed: true) {
        center: Vector = (0.0, 0.0),
        angle: Float(subtype: ANGLE)
    }
) -> (Mask: Float, Distance: Float)
InputTypeDefaultRange
imageColor
radiusFloat0.50.0..
sidesInt63..64
featherFloat0.0..
centerVector(0.0, 0.0)
angleFloat
geometry ✗shader ✗compositor ✓

star mask#

Regular star of given number of points, indent its inner radius over its outer one

compositor graph "star mask"(
    image: Color,
    radius: Float = 0.5 in 0.0..,
    points: Int = 5 in 3..32,
    indent: Float = 0.5 in 0.05..1.0,
    feather: Float in 0.0..,
    "Transform"(default_closed: true) {
        center: Vector = (0.0, 0.0),
        angle: Float(subtype: ANGLE)
    }
) -> (Mask: Float, Distance: Float)
InputTypeDefaultRange
imageColor
radiusFloat0.50.0..
pointsInt53..32
indentFloat0.50.05..1.0
featherFloat0.0..
centerVector(0.0, 0.0)
angleFloat
geometry ✗shader ✗compositor ✓

Framing#

letterbox#

Bars that frame the image to the given aspect: above and below, or at the sides when narrower

compositor graph letterbox(
    image: Color,
    aspect: Float = 2.39 in 0.01..,
    color: Color = (0.0, 0.0, 0.0, 1.0),
    feather: Float in 0.0..
) -> (Image: Color, Mask: Float)
InputTypeDefaultRange
imageColor
aspectFloat2.390.01..
colorColor(0.0, 0.0, 0.0, 1.0)
featherFloat0.0..
geometry ✗shader ✗compositor ✓