Image dither
A picture to five greys and the ember, through the 4×4 Bayer matrix.
- Drawn with
- GLSL + CPU
- Chain
- image-dither
- Code
- @forgeron/shaders: imageDitherMeta, imageDitherGlsl, imageDitherCpu
/01 → What it is
- Luminance picks between two neighbouring greys through the 4×4 Bayer threshold.
- Warm pixels (red well above green and blue) become ember over the background.
- Its source is a picture from the page: the demos go through `mountDitheredImage`.
- Both sides: GLSL and CPU, with the same result. A cell pass.
- CPU against GLSL: within a stated share: luminance is float.
/02 → In the examples
| Example | Chain |
|---|---|
| Image | image → pixelate → image-dither → palette |
/03 → Versions
- /01 Hero
pixel 3 · gain 1.1 - /02 Brighter
pixel 3 · gain 1.5
/04 → Use it
{
"type": "image-dither",
"gain": 1.1,
"greys": 5
}import { imageDitherMeta, imageDitherGlsl, imageDitherCpu } from "@forgeron/shaders";
// imageDitherMeta: description and params schema (validation, the editor)
// imageDitherGlsl: the GPU side, for bindChain then glPipeline
// imageDitherCpu: the CPU side, for bindChain then runCpuAPI → Options
| Option | Type | Default | Description |
|---|---|---|---|
gain | number | 1.1 | Luminance gain. |
greys | number | 5 | Greys in the palette; ember is the tone after them. |