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.
Parameters
Section titled “Parameters”inputColor
Section titled “inputColor”Node <"vec4">
The input color (vec4 with alpha)
paletteTex
Section titled “paletteTex”Palette texture (horizontal strip)
paletteSize
Section titled “paletteSize”Number of colors in palette
dither?
Section titled “dither?”FloatInput = 0.5
Dither strength between palette colors (0-1, default: 0.5)
screenCoord?
Section titled “screenCoord?”Node <"vec2">
Screen coordinates for dithering pattern
Returns
Section titled “Returns”Node <"vec4">
Color snapped to palette with dithering
Examples
Section titled “Examples”// GameBoy 4-color palette with ditheringpalettizeDithered(color, gbPalette, 4, 0.5, uv().mul(textureSize))// C64 palette with strong ditheringpalettizeDithered(color, c64Palette, 16, 0.8, screenCoord)