Skip to content

quantize

quantize(inputColor, levels): Node<"vec4">

Defined in: packages/nodes/src/retro/quantize.ts:25

Quantize color to discrete levels per channel. Creates a retro/pixel art look by reducing the number of possible colors.

Parameters

inputColor

Node<"vec4">

The input color (vec4 with alpha)

levels

FloatInput

Number of levels per channel (2-256)

Returns

Node<"vec4">

Quantized color

Examples

// 8 levels per channel (512 colors)
quantize(texture(tex, uv()), 8)
// Binary colors per channel (8 colors total)
quantize(color, 2)
// Using a uniform for dynamic control
quantize(color, levelsUniform)