Skip to content

bayerDither2x2

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

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

Apply 2x2 Bayer matrix ordered dithering. Creates a coarse dither pattern - good for very low resolution retro effects.

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

// Binary dithering on sprite
bayerDither2x2(color, 2, 1, uv().mul(textureSize))