3. Notes
2026-10-12

Ordered dithering with a 4×4 Bayer matrix


const bayer4 = [
  [0, 8, 2, 10],
  [12, 4, 14, 6],
  [3, 11, 1, 9],
  [15, 7, 13, 5],
];

/** is lit, considering brightness between 0 and 1. */
export function lit(x: number, y: number, brightness: number): boolean {
  return brightness > (bayer4[y % 4][x % 4] + 0.5) / 16;
}