KlassischeKeplerKriege/data/shader/postprocess.frag
2016-10-05 23:26:55 +02:00

25 lines
535 B
GLSL

#version 120
uniform sampler2D tex;
varying vec3 vertex;
varying vec2 uv;
const int gaussRadius = 11;
const float gaussFilter[gaussRadius] = float[gaussRadius](
0.0402,0.0623,0.0877,0.1120,0.1297,0.1362,0.1297,0.1120,0.0877,0.0623,0.0402
);
uniform vec2 scale;
void main()
{
vec2 texCoord = uv.xy - float(int(gaussRadius/2)) * scale;
vec3 color = vec3(0.0, 0.0, 0.0);
for (int i=0; i<gaussRadius; ++i) {
color += gaussFilter[i] * texture2D(tex, texCoord).xyz;
texCoord += scale;
}
gl_FragColor = vec4(color, 1.0);
}