armory/Shaders/bloom_pass/bloom_pass.frag.glsl

32 lines
754 B
Plaintext
Raw Normal View History

2016-04-01 01:48:18 +02:00
#version 450
#ifdef GL_ES
precision mediump float;
#endif
#include "../compiled.glsl"
2016-10-17 17:39:40 +02:00
//const float bloomTreshold = 3.0;
2016-04-01 01:48:18 +02:00
uniform sampler2D tex;
2016-10-21 19:36:08 +02:00
uniform vec2 texStep;
2016-04-01 01:48:18 +02:00
in vec2 texCoord;
2016-10-12 17:52:27 +02:00
out vec4 fragColor;
2016-04-01 01:48:18 +02:00
void main() {
2016-10-21 19:36:08 +02:00
// vec4 col = texture(tex, texCoord);
vec4 col = vec4(0.0);
col += texture(tex, vec2(texCoord.x - texStep.x * 1.5, texCoord.y));
col += texture(tex, vec2(texCoord.x + texStep.x * 1.5, texCoord.y));
col += texture(tex, vec2(texCoord.x, texCoord.y - texStep.y * 1.5));
col += texture(tex, vec2(texCoord.x, texCoord.y + texStep.y * 1.5));
col /= 4.0;
2016-06-03 17:18:38 +02:00
float brightness = dot(col.rgb, vec3(0.2126, 0.7152, 0.0722));
if (brightness > bloomTreshold) {
2016-10-12 17:52:27 +02:00
fragColor.rgb = vec3(col.rgb);
2016-06-03 17:18:38 +02:00
return;
}
2016-10-12 17:52:27 +02:00
fragColor.rgb = vec3(0.0);
2016-04-01 01:48:18 +02:00
}