#version 300 es precision highp float; uniform sampler2D u_texture; uniform vec2 u_resolution; uniform float u_time; in vec2 v_texCoord; out vec4 fragColor; const float LEVELS = 15.0; // Number of color levels void main() { vec2 uv = gl_FragCoord.xy/u_resolution.xy; // Sample the input texture vec4 color = texture(u_texture, uv); // Quantize colors to specified number of levels vec3 quantized = floor(color.rgb * LEVELS) / (LEVELS - 1.0); fragColor = vec4(quantized, color.a); }