KlassischeKeplerKriege/data/shader/postprocess.frag

26 lines
560 B
GLSL
Raw Normal View History

2016-10-05 18:53:37 +00:00
#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);
}