Skip to content

palettize(inputColor, paletteTex, strength?): Node <"vec4">

Defined in: packages/nodes/src/retro/palettize.ts:31

Map colors to nearest match in a palette texture. Palette should be a 1D horizontal texture (Nx1 pixels).

This function samples the palette by computing the luminance of the input color and using it to index into the palette texture.

Node <"vec4">

The input color (vec4 with alpha)

Texture 

Palette texture (horizontal strip)

FloatInput = 1

Effect strength (0 = original, 1 = fully palettized)

Node <"vec4">

Color snapped to palette

// Apply GameBoy palette
palettize(color, gbPaletteTexture)
// Partial palette effect
palettize(color, retroPalette, 0.5)