Posterization
Reduces each colour channel or the luminance to a small number of levels, producing flat regions of colour with hard transitions.
In the family Stylized & non-photorealistic rendering, colour reduction
Where it runs
Built inOfficial add-onPluginNone foundNot researched
| Engine | Support | How |
|---|---|---|
| three.js r187 | Built in | import { posterize } from 'three/tsl' docs TSL node. |
| Babylon.js 9.38.0 | Built in | PosterizeBlock in Node Material Editor docs |
| Godot 4.7 | None found | No dedicated built-in Posterize VisualShader node or post-process effect. |
| Unity | Built in | Shader Graph > Artistic > Adjustment > Posterize node docs |
| Unreal 5.7 | Built in | Post Process Material (luminance/color quantization in PostProcessVolume) docs |
| Blender 5.2 | Built in | Compositor > Add > Creative > Posterize docs |
| WebGPU W3C | None found | |
| Metal | None found |
How it works
The simplest form multiplies the channel by N-1, rounds or floors, and divides back, applied per RGB channel. Doing it on luminance only, then re-applying chroma, preserves hue relationships and avoids colour shifts. Working in a perceptual space such as OKLab or HSV makes the level spacing look more even. Smoothing the step with smoothstep and fwidth antialiases the contour edges between levels, and a slight blur before quantizing reduces speckle from noise. Adding noise or a dither threshold before quantizing converts hard contours into patterns, which is how it links to ordered and blue-noise dithering.
When to choose it
Reach for it when
- want flat colour regions with few levels
- graphic poster look from a render
- reduce colour channels to distinct bands
- final step to get cel-like banded colours
- quick stylised colour reduction
Choose it for a cheap graphic poster look or as the final step of a toon pipeline on a rendered image. Prefer Toon / cel shading with lighting ramps when the banding should come from lighting rather than final colour, and Kuwahara filter to also flatten spatial detail.
Field marks
- Contour lines wrap noise: speckled islands at level boundaries
- Per-channel quantization shifts hues
- Gradients show harsh bands that follow lighting rather than shape
- Visible temporal flicker when pixel values hover around a threshold
Presets
Left: continuous colour. Right: each channel quantised to 4 levels, leaving flat bands
{
"LEVELS": 4
}Show GLSL (23 lines)
float hash(vec2 c){uvec2 u=uvec2(ivec2(floor(c)));uint h=u.x*1597334673u^u.y*3812015801u;h^=h>>15;h*=2246822519u;h^=h>>13;h*=3266489917u;h^=h>>16;return float(h)*(1./4294967296.);}
float lum(vec3 c){return dot(c,vec3(.2126,.7152,.0722));}
vec3 gam(vec3 c){return pow(clamp(c,0.,1.),vec3(1./2.2));}
vec3 img(vec2 p){
vec3 c=mix(vec3(.12,.18,.34),vec3(.95,.72,.45),clamp(p.y+.5,0.,1.));
vec2 q=p-vec2(-.03,.14); float rr=.16; float d=length(q)-rr;
vec3 n=normalize(vec3(q/rr,sqrt(max(1.-dot(q,q)/(rr*rr),0.))));
float l=clamp(dot(n,normalize(vec3(-.5,.6,.6))),0.,1.);
c=mix(c,vec3(.85,.26,.2)*(.18+.9*l),smoothstep(.002,-.002,d));
vec2 r=p-vec2(0.,-.2);
if(abs(r.x)<.2&&abs(r.y)<.09) c=mix(vec3(.1,.35,.3),vec3(.93,.92,.85),smoothstep(-.3,.3,sin(r.x*340.+r.y*90.)));
if(p.y<-.34&&p.y>-.42){ vec3 h=.5+.5*cos(6.2832*((p.x+.25)*2.+vec3(0.,.33,.67))); c=h; }
c=mix(c,vec3(.97,.85,.2),smoothstep(.003,-.003,abs(p.x-.17)-.025)*step(.0,p.y)*step(p.y,.4));
return c;
}
const float LEVELS=4.0; // P
void mainImage(out vec4 fragColor,in vec2 fragCoord){
vec2 uv=(fragCoord-.5*iResolution.xy)/iResolution.y;bool R=uv.x>0.;vec2 q=vec2(uv.x+(R?-.25:.25),uv.y);
vec3 col=img(q);
if(R)col=floor(col*LEVELS)/(LEVELS-1.);
if(abs(uv.x)<.0015)col=vec3(1.);fragColor=vec4(clamp(col,0.,1.),1.);
}Attribution: written for this index
Measured GPU weight & timing
| Preset | GPU | Weight / p50 / p95 | Method |
|---|---|---|---|
| posterization-specimen | Tesla T4 1920x1080 | 1.58× baseline (feather) · 0.052 ms / 0.053 ms | opengl-timer-query · 40 frames · GPU Weight Atlas · Colab T4 sweep |
| posterization-specimen | NVIDIA L4 1920x1080 | 1.14× baseline (feather) · 0.018 ms / 0.018 ms · 2.9× faster on L4 | opengl-timer-query · Cross-architecture validation |
| posterization-specimen | NVIDIA A100-SXM4-40GB 1920x1080 | 1.01× baseline (feather) · 0.029 ms / 0.029 ms · 1.8× faster on A100 | opengl-timer-query · Cross-architecture validation |