Skip to content

alphaTest

alphaTest(inputColor, threshold): Node<"vec4">

Defined in: packages/nodes/src/alpha/alphaTest.ts:21

Discard pixels with alpha below a threshold. Useful for hard-edged transparency (pixel art, text).

Parameters

inputColor

Node<"vec4">

The input color (vec4 with alpha)

threshold

FloatInput

Alpha threshold (pixels below this are discarded)

Returns

Node<"vec4">

Color unchanged, or discarded if below threshold

Examples

// Discard nearly transparent pixels
alphaTest(texture(tex, uv()), 0.5)
// Animated alpha cutoff
alphaTest(texture(tex, uv()), thresholdUniform)