Skip to content
This is the alpha v4 version website. Looking for the v3 documentation?

LayerContext

Defined in: packages/sigma/src/rendering/nodes/types.ts:159

Context provided to a fragment layer’s GLSL code via the global context struct. This struct is populated by the generator before calling any layer functions.

GLSL definition:

struct LayerContext {
float sdf; // Signed distance from shape boundary
vec2 uv; // UV coordinates [-1, 1]
float shapeSize; // Effective shape radius in UV space
float aaWidth; // Anti-aliasing width
float pixelSize; // Node diameter in screen pixels
float correctionRatio; // Scaling factor for consistent rendering
float pixelToUV; // Conversion: pixels * pixelToUV = UV units
};
LayerContext context; // Global instance

Properties

aaWidth

aaWidth: "float"

Defined in: packages/sigma/src/rendering/nodes/types.ts:181

The antialiasing width in UV space. Use this for smooth transitions between internal borders/regions.


correctionRatio

correctionRatio: "float"

Defined in: packages/sigma/src/rendering/nodes/types.ts:193

Scaling factor for consistent rendering across zoom levels. Useful for advanced effects that need to compensate for camera zoom.


pixelSize

pixelSize: "float"

Defined in: packages/sigma/src/rendering/nodes/types.ts:187

The node diameter in screen pixels. Useful for pixel-mode border calculations.


pixelToUV

pixelToUV: "float"

Defined in: packages/sigma/src/rendering/nodes/types.ts:200

Conversion factor from screen pixels to UV units. Multiply a pixel value by this to get the equivalent size in UV space. Use this for pixel-mode border sizes or any pixel-based measurements.


sdf

sdf: "float"

Defined in: packages/sigma/src/rendering/nodes/types.ts:164

The signed distance field value at this fragment. Negative inside the shape, zero at boundary, positive outside.


shapeSize

shapeSize: "float"

Defined in: packages/sigma/src/rendering/nodes/types.ts:175

The effective shape size in UV space (1.0 - aaWidth). This is the radius where the solid shape ends, before the AA band.


uv

uv: "vec2"

Defined in: packages/sigma/src/rendering/nodes/types.ts:169

Normalized UV coordinates in [-1, 1] range, with (0,0) at center.