35 lines
1.0 KiB
Plaintext
35 lines
1.0 KiB
Plaintext
#version 120
|
|
uniform sampler2D screen;
|
|
varying vec2 uv;
|
|
|
|
const float blurStep = 0.001;
|
|
const vec3 gray = vec3(0.50, 0.50, 0.50);
|
|
const float desaturateLevel = 0.6;
|
|
|
|
void main()
|
|
{
|
|
//Blur the pixel
|
|
vec4 color = texture2D(screen, uv);
|
|
color += texture2D(screen, uv + vec2(-blurStep, -blurStep));
|
|
color += texture2D(screen, uv + vec2(0, -blurStep));
|
|
color += texture2D(screen, uv + vec2(+blurStep, -blurStep));
|
|
|
|
color += texture2D(screen, uv + vec2(-blurStep, 0));
|
|
color += texture2D(screen, uv + vec2(+blurStep, 0));
|
|
|
|
color += texture2D(screen, uv + vec2(-blurStep, +blurStep));
|
|
color += texture2D(screen, uv + vec2(0, +blurStep));
|
|
color += texture2D(screen, uv + vec2(+blurStep, +blurStep));
|
|
color /= 9.0;
|
|
|
|
//Desaturate the pixel
|
|
color.rgb = mix(vec3(dot(gray, color.rgb)), color.rgb, desaturateLevel);
|
|
|
|
//Darkened edge
|
|
float dist = length(uv - vec2(0.5, 0.5));
|
|
if(dist > 0.4)
|
|
color.rgb = mix(color.rgb, vec3(0.0, 0.0, 0.0), (dist - 0.4)/0.3);
|
|
|
|
gl_FragColor = color * gl_Color;
|
|
}
|