Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- uniform sampler2D texture;
- uniform float x;
- uniform float y;
- uniform float time;
- void main()
- {
- vec3 clr = vec3(texture2D(texture, gl_TexCoord[0].st));
- float distx = abs(x-gl_TexCoord[0].st[0]);
- float disty = abs(y-gl_TexCoord[0].st[1]);
- float dist = sqrt(distx*distx + disty*disty);
- float bw = 0.3*clr[0] + 0.59*clr[1] + 0.11*clr[2];
- vec4 sum = vec4(0.0);
- float blurSize = 0.00195*dist;
- sum += texture2D(texture, vec2(gl_TexCoord[0].st[0] - 4.0*blurSize, gl_TexCoord[0].st[1])) * 0.05;
- sum += texture2D(texture, vec2(gl_TexCoord[0].st[0] - 3.0*blurSize, gl_TexCoord[0].st[1])) * 0.09;
- sum += texture2D(texture, vec2(gl_TexCoord[0].st[0] - 2.0*blurSize, gl_TexCoord[0].st[1])) * 0.12;
- sum += texture2D(texture, vec2(gl_TexCoord[0].st[0] - blurSize, gl_TexCoord[0].st[1])) * 0.15;
- sum += texture2D(texture, vec2(gl_TexCoord[0].st[0], gl_TexCoord[0].st[1])) * 0.16;
- sum += texture2D(texture, vec2(gl_TexCoord[0].st[0] + blurSize, gl_TexCoord[0].st[1])) * 0.15;
- sum += texture2D(texture, vec2(gl_TexCoord[0].st[0] + 2.0*blurSize, gl_TexCoord[0].st[1])) * 0.12;
- sum += texture2D(texture, vec2(gl_TexCoord[0].st[0] + 3.0*blurSize, gl_TexCoord[0].st[1])) * 0.09;
- sum += texture2D(texture, vec2(gl_TexCoord[0].st[0] + 4.0*blurSize, gl_TexCoord[0].st[1])) * 0.05;
- gl_FragColor[0] = sum[0] + dist*(bw - clr[0]);
- gl_FragColor[1] = sum[1] + dist*(bw - clr[1]);
- gl_FragColor[2] = sum[2] + dist*(bw - clr[2]);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement