Skip to content

bayerDither4x4

bayerDither4x4(inputColor, levels, scale, screenCoord?): Node<"vec4">

Defined in: packages/nodes/src/retro/bayerDither.ts:214

Apply 4x4 Bayer matrix ordered dithering. Standard dither pattern - good balance of quality and retro aesthetic.

Parameters

inputColor

Node<"vec4">

The input color (vec4 with alpha)

levels

FloatInput = 2

Number of color levels per channel (default: 2 = binary)

scale

FloatInput = 1

Scale of dither pattern (default: 1)

screenCoord?

Node<"vec2">

Screen coordinates (use UV * textureSize for per-sprite)

Returns

Node<"vec4">

Dithered color

Example

// 4-level dithering for retro look
bayerDither4x4(color, 4, 1, uv().mul(textureSize))