โ† All examples

godot shaders

Posterize in perceptual steps

Reduce the image to a few flat tone levels per channel or on luminance only, quantizing after a gamma curve so steps are evenly spaced to the eye, with a hard or slightly softened step edge.

Recorded render of Posterize in perceptual steps

What this component contains

  • ATTRIBUTION.md
  • LICENSE
  • README.md
  • component.json
  • demo.tscn
  • inspect_shader.py
  • material.tres
  • post_posterize_gamma.gdshader
  • preview.png
  • test_package.py
  • verification/native.json

How it works

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 = 5), gamma (float = 1), luminance_only (bool = no), edge_softness (float = 0), saturation (float = 1.15)
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 flattened into five crisp tone steps per channel with slightly boosted saturation.
Renderers
compatibility: compiled and rendered, forward plus: not verified, mobile: not verified
Placement
res://baltor/godot_shaders/post_posterize_gamma/

Recorded checks

godot 4.7.2.stable.official.ed1daf0bf

  • contract_static
  • engine_run
  • engine_log_clean
  • shader_in_scene
  • capture_written
  • render_not_uniform
  • shader_changes_pixels

Limits to consider

Smooth gradients such as the sky turn into visible bands by design. Per-channel quantizing can shift hues in dark areas. 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.