Skip to content

bayerDither

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

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

Apply Bayer matrix ordered dithering (defaults to 4x4). Alias for bayerDither4x4 as it’s the most commonly used pattern.

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

Examples

// Binary dithering (2-color)
bayerDither(texture(tex, uv()), 2, 1, screenUV.mul(resolution))
// 4-level dithering for retro look
bayerDither(color, 4)