29 lines
941 B
GLSL
29 lines
941 B
GLSL
#version 100
|
|
precision lowp float;
|
|
varying vec2 texcoord;
|
|
uniform sampler2D tex;
|
|
uniform vec2 wobble;
|
|
uniform vec3 invert;
|
|
uniform vec2 blur;
|
|
|
|
|
|
|
|
// Source: https://github.com/Jam3/glsl-fast-gaussian-blur/blob/master/5.glsl
|
|
vec4 blur5(sampler2D image, vec2 uv, vec2 resolution, vec2 direction) {
|
|
vec4 color = vec4(0.0);
|
|
vec2 off1 = vec2(1.3333333333333333) * direction;
|
|
color += texture2D(image, uv) * 0.29411764705882354;
|
|
color += texture2D(image, uv + (off1 / resolution)) * 0.35294117647058826;
|
|
color += texture2D(image, uv - (off1 / resolution)) * 0.35294117647058826;
|
|
return color;
|
|
}
|
|
void main() {
|
|
vec2 offset = wobble.x * vec2(
|
|
sin(wobble.y + texcoord.y) * 0.1,
|
|
cos(wobble.y + texcoord.x) * 0.1
|
|
);
|
|
vec4 col = texture2D(tex, texcoord + offset * (1.0 - length(texcoord - 0.5) ));
|
|
gl_FragColor = (1.0 - col) * vec4(invert, 1.0) + col * (1.0 - vec4(invert, 1.0));//blur5(tex, texcoord, blur, vec2(3.0));
|
|
}
|
|
|
|
|