Baltor Get started

Gallery / Godot shaders

Ordered dithering to few colours or one bit

In your harnessGodot shaderMIT

Dither the screen with an 8 x 8 Bayer matrix: reduce each channel to a few levels, or the image to two colours like a one-bit display, with adjustable dot scale and contrast.

Render of Ordered dithering to few colours or one bit
The render its check recorded in Godot 4.7.2, 256 by 256 pixels.

What it takes and gives

Shader type
spatial
Render modes
unshaded, cull_disabled, depth_test_disabled, depth_draw_never, skip_vertex_transform, fog_disabled
Parameters
screen_texture (sampler2D), levels (int = 4), dot_scale (float = 2), one_bit (bool = no), dark_color (vec4 = 0.1, 0.08, 0.16, 1), light_color (vec4 = 0.92, 0.9, 0.8, 1), contrast (float = 1.1)
Use it on
A MeshInstance3D with a 2 x 2 QuadMesh, material.tres as its material override and a large extra cull margin, as in demo.tscn.
Result
The scene reduced to four levels per channel with a fine crosshatch-like dot pattern.
Renderers
compatibility: compiled and rendered, forward plus: not verified, mobile: not verified
Placement
res://baltor/godot_shaders/post_bayer_dither/

Limits. Ordered dithering shows a regular grid pattern by design. When the output is scaled by a non-integer factor the pattern beats into moire. The pass reads Godot's screen texture after opaque geometry, so transparent objects drawn after it are not processed and its order among other transparent passes is not controlled.

Details

Kind
Godot shader
Engine
Godot 4.3 or later
Files
11 files, 54.4 KB
Licence
MIT
Declared effects
reads files, runs commands
Checked with
Godot 4.7.2, opengl3 compatibility (Mesa llvmpipe, Xvfb)
Checks
contract static, engine run, engine log clean, shader in scene, capture written, render not uniform, shader changes pixels
Techniques
8 x 8 Bayer threshold from bit interleaving, Ordered dithering quantization, One-bit luminance dither
Tags
godot shader, spatial, post-process, dithering, bayer, one bit, retro, full-screen
Identity
library.supply.creative_originals.fd2cfbf444be839b67eec4af.4bd93478bf80cd4d
Version
4bd93478bf80cd4d36ca6bc888daa5d71706123baef09d5229ae6a178982f78d

The version is the SHA-256 of the item your harness downloads; every file in it names its own checksum.

Something wrong with this item, its rights or its safety? Report it on the support page, or from your harness after a download.