SDFShape
Defined in: packages/sigma/src/rendering/nodes/types.ts:104
Definition of a Signed Distance Field shape. Shapes provide GLSL code that computes the signed distance from a point to the shape’s boundary (negative inside, 0 on boundary, positive outside).
Properties
Section titled “Properties”attributes?
Section titled “attributes?”
optionalattributes?:AttributeSpecification[]
Defined in: packages/sigma/src/rendering/nodes/types.ts:131
Per-node float attributes (e.g. a rectangle’s aspectRatio), read from the node attribute texture and passed to sdf_{name}() after the uniforms.
glsl:
string
Defined in: packages/sigma/src/rendering/nodes/types.ts:119
GLSL function code that computes the signed distance field. Function signature: float sdf_{name}(vec2 uv, …) where … represents the shape-specific uniforms as additional parameters.
uv
Normalized coordinates in [-1, 1] range, (0, 0) at center
Returns
Section titled “Returns”Signed distance (negative inside, 0 on boundary, positive outside)
inradiusFactor?
Section titled “inradiusFactor?”
optionalinradiusFactor?:number
Defined in: packages/sigma/src/rendering/nodes/types.ts:149
Ratio of inradius to circumradius for this shape. This indicates how “deep” the shape goes relative to the bounding circle.
- Circle: 1.0 (inradius equals circumradius)
- Square: 1.0 (inscribed circle touches all sides)
- Triangle: 0.5 (inradius is half the circumradius for equilateral)
- Diamond: ~0.707 (√2/2 for a square rotated 45°)
Used by layers like border to correctly calculate fill sizes. Defaults to 1.0 if not specified.
inradiusFactorGLSL?
Section titled “inradiusFactorGLSL?”
optionalinradiusFactorGLSL?:string
Defined in: packages/sigma/src/rendering/nodes/types.ts:155
GLSL expression replacing inradiusFactor in the node fragment shader, for
shapes whose depth varies per node. Reads attributes as v_<name>.
name:
string
Defined in: packages/sigma/src/rendering/nodes/types.ts:109
Unique identifier for this shape (e.g., “circle”, “square”). Used to generate the GLSL function name: sdf_{name}
uniforms
Section titled “uniforms”uniforms:
UniformSpecification[]
Defined in: packages/sigma/src/rendering/nodes/types.ts:125
Additional uniforms required by this shape (e.g., u_cornerRadius, u_rotation). Values are baked into the GLSL, so each set of values is its own shape instance.
variables?
Section titled “variables?”
optionalvariables?:Record<string, {default:string|number;type:"number"|"color"; }>
Defined in: packages/sigma/src/rendering/nodes/types.ts:136
Variables backing the attributes above, like EdgePath’s variables.