KlassischeKeplerKriege/data/shader/postprocess.frag
2016-10-05 20:53:37 +02:00

26 lines
No EOL
560 B
GLSL

#version 120
uniform sampler2D tex0;
uniform sampler2D tex1;
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(tex0, texCoord).xyz;
texCoord += scale;
}
gl_FragColor = vec4(color, 1.0);
}