19 lines
508 B
GLSL
19 lines
508 B
GLSL
|
precision mediump float;
|
||
|
varying mediump vec2 v_texcoord;
|
||
|
uniform sampler2D tex;
|
||
|
|
||
|
uniform float radius;
|
||
|
uniform vec2 halfpixel;
|
||
|
|
||
|
void main() {
|
||
|
vec2 uv = v_texcoord * 2.0;
|
||
|
|
||
|
vec4 sum = texture2D(tex, uv) * 4.0;
|
||
|
sum += texture2D(tex, uv - halfpixel.xy * radius);
|
||
|
sum += texture2D(tex, uv + halfpixel.xy * radius);
|
||
|
sum += texture2D(tex, uv + vec2(halfpixel.x, -halfpixel.y) * radius);
|
||
|
sum += texture2D(tex, uv - vec2(halfpixel.x, -halfpixel.y) * radius);
|
||
|
|
||
|
gl_FragColor = sum / 8.0;
|
||
|
}
|