KlassischeKeplerKriege/data/shader/postprocess.frag

26 lines
535 B
GLSL
Raw Normal View History

2016-10-05 18:53:37 +00:00
#version 120
2016-10-05 21:26:55 +00:00
uniform sampler2D tex;
2016-10-05 18:53:37 +00:00
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) {
2016-10-05 21:26:55 +00:00
color += gaussFilter[i] * texture2D(tex, texCoord).xyz;
2016-10-05 18:53:37 +00:00
texCoord += scale;
}
gl_FragColor = vec4(color, 1.0);
2016-10-05 21:26:55 +00:00
}