#version 300 es precision highp float; // highp: fullscreen UV addressing (mediump fp16 is not enough on mobile) in vec2 vTexCoord; out vec4 fragColor; uniform mediump sampler2D u_tex; uniform vec2 u_center; // 0..1 UV uniform float u_strength; // 0..0.5 typical uniform int u_samples; // 2..16 const int MAX_SAMPLES = 16; void main() { vec2 dir = vTexCoord - u_center; vec3 acc = vec3(0.0); int n = clamp(u_samples, 1, MAX_SAMPLES); float invN = 1.0 / float(n); for (int i = 0; i < MAX_SAMPLES; ++i) { if (i >= n) break; float t = float(i) * invN * u_strength; acc += texture(u_tex, vTexCoord - dir * t).rgb; } fragColor = vec4(acc * invN, 1.0); }