-
Notifications
You must be signed in to change notification settings - Fork 0
/
blur.frag
33 lines (32 loc) · 1.08 KB
/
blur.frag
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
uniform sampler2D texture;
uniform float blur_radius;
uniform float evaporate;
uniform float cutout;
void main()
{
vec2 offx = vec2(blur_radius, 0.0);
vec2 offy = vec2(0.0, blur_radius);
vec4 pixel = (texture2D(texture, gl_TexCoord[0].xy) +
texture2D(texture, gl_TexCoord[0].xy - offx) +
texture2D(texture, gl_TexCoord[0].xy + offx) +
texture2D(texture, gl_TexCoord[0].xy - offy) +
texture2D(texture, gl_TexCoord[0].xy + offy) +
texture2D(texture, gl_TexCoord[0].xy - offx - offy) +
texture2D(texture, gl_TexCoord[0].xy - offx + offy) +
texture2D(texture, gl_TexCoord[0].xy + offx - offy) +
texture2D(texture, gl_TexCoord[0].xy + offx + offy))/ 9.0;
//gl_FragColor =(pixel ) * evaporate);
if (pixel.r < cutout)
{
pixel.r = 0.0;
}
if (pixel.g < cutout)
{
pixel.g = 0.0;
}
if (pixel.b < cutout)
{
pixel.b = 0.0;
}
gl_FragColor = pixel * evaporate;
}