armory/Shaders/blur_gaus_pass/blur_gaus_pass.frag.glsl

41 lines
1.7 KiB
Plaintext
Raw Normal View History

2016-08-09 23:51:40 +02:00
// Exclusive to bloom for now
2016-06-03 17:18:38 +02:00
#version 450
2017-12-13 14:21:42 +01:00
#include "compiled.glsl"
2016-08-07 01:43:21 +02:00
2016-06-03 17:18:38 +02:00
uniform sampler2D tex;
uniform vec2 dir;
2017-11-16 08:52:42 +01:00
uniform vec2 screenSize;
2016-06-03 17:18:38 +02:00
in vec2 texCoord;
2016-10-12 17:52:27 +02:00
out vec4 fragColor;
2016-06-03 17:18:38 +02:00
2017-11-16 08:52:42 +01:00
const float weight[10] = float[] (0.132572, 0.125472, 0.106373, 0.08078, 0.05495, 0.033482, 0.018275, 0.008934, 0.003912, 0.001535);
2016-06-03 17:18:38 +02:00
void main() {
2017-11-16 12:46:08 +01:00
vec2 step = (dir / screenSize.xy) * bloomRadius;
2016-06-03 17:18:38 +02:00
2017-03-11 01:50:47 +01:00
fragColor.rgb = texture(tex, texCoord).rgb * weight[0];
2016-10-21 19:36:08 +02:00
2017-03-11 01:50:47 +01:00
fragColor.rgb += texture(tex, texCoord + step * 1.5).rgb * weight[1];
fragColor.rgb += texture(tex, texCoord - step * 1.5).rgb * weight[1];
fragColor.rgb += texture(tex, texCoord + step * 2.5).rgb * weight[2];
fragColor.rgb += texture(tex, texCoord - step * 2.5).rgb * weight[2];
fragColor.rgb += texture(tex, texCoord + step * 3.5).rgb * weight[3];
fragColor.rgb += texture(tex, texCoord - step * 3.5).rgb * weight[3];
fragColor.rgb += texture(tex, texCoord + step * 4.5).rgb * weight[4];
fragColor.rgb += texture(tex, texCoord - step * 4.5).rgb * weight[4];
fragColor.rgb += texture(tex, texCoord + step * 5.5).rgb * weight[5];
fragColor.rgb += texture(tex, texCoord - step * 5.5).rgb * weight[5];
fragColor.rgb += texture(tex, texCoord + step * 6.5).rgb * weight[6];
fragColor.rgb += texture(tex, texCoord - step * 6.5).rgb * weight[6];
fragColor.rgb += texture(tex, texCoord + step * 7.5).rgb * weight[7];
fragColor.rgb += texture(tex, texCoord - step * 7.5).rgb * weight[7];
fragColor.rgb += texture(tex, texCoord + step * 8.5).rgb * weight[8];
fragColor.rgb += texture(tex, texCoord - step * 8.5).rgb * weight[8];
fragColor.rgb += texture(tex, texCoord + step * 9.5).rgb * weight[9];
fragColor.rgb += texture(tex, texCoord - step * 9.5).rgb * weight[9];
2016-10-21 19:36:08 +02:00
2017-11-16 12:46:08 +01:00
fragColor.rgb *= bloomStrength / 5;
2016-06-03 17:18:38 +02:00
}