An arbitrary-palette positional dithering algorithm
The article presents a positional dithering algorithm that works with arbitrary color palettes. It explains how to map colors by considering both the target color and the pixel's screen position, enabling dithering without a fixed palette or error diffusion.
Background
Bisqwit (Joel Yliluoma) is a Finnish programmer known for deep-dive technical articles. This piece details "positional dithering," his own algorithm for approximating colors when an image's palette (the set of available colors) is limited. Unlike traditional dithering (e.g., Floyd–Steinberg) that spreads error across neighboring pixels, positional dithering pre-calculates fixed patterns based on each pixel's (x,y) location. This makes it fast, parallelizable, and suitable for real-time graphics on old hardware, embedded systems, or demoscene productions. The article compares its visual results to standard algorithms and explains the math behind choosing which colors to place where.