Skip to content

quantizeRGB

quantizeRGB(inputColor, rLevels, gLevels, bLevels): Node<"vec4">

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

Quantize color with different levels for each RGB channel. Useful for specific retro palettes like 3-3-2 (8-bit color).

Parameters

inputColor

Node<"vec4">

The input color (vec4 with alpha)

rLevels

FloatInput

Number of levels for red channel

gLevels

FloatInput

Number of levels for green channel

bLevels

FloatInput

Number of levels for blue channel

Returns

Node<"vec4">

Quantized color

Examples

// 8-bit color (3-3-2 format: 8R, 8G, 4B)
quantizeRGB(color, 8, 8, 4)
// 16-bit high color (5-6-5 format)
quantizeRGB(color, 32, 64, 32)