Skip to content

palettizeDithered

palettizeDithered(inputColor, paletteTex, paletteSize, dither?, screenCoord?): Node <"vec4">

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

Map colors to palette with dithering for smoother transitions. Uses Bayer matrix dithering to blend between palette colors.

Node <"vec4">

The input color (vec4 with alpha)

Texture 

Palette texture (horizontal strip)

FloatInput

Number of colors in palette

FloatInput = 0.5

Dither strength between palette colors (0-1, default: 0.5)

Node <"vec2">

Screen coordinates for dithering pattern

Node <"vec4">

Color snapped to palette with dithering

// GameBoy 4-color palette with dithering
palettizeDithered(color, gbPalette, 4, 0.5, uv().mul(textureSize))
// C64 palette with strong dithering
palettizeDithered(color, c64Palette, 16, 0.8, screenCoord)