Space-Project/shaders/shader_bloom.frag
2021-02-04 01:56:17 +01:00

18 lines
453 B
GLSL

#version 330 core
out vec4 FragColor;
in vec2 vTexCoords;
uniform sampler2D scene;
uniform sampler2D bloomBlur;
void main()
{
const float gamma = 0.8;
vec3 hdrColor = texture(scene, vTexCoords).rgb;
vec3 bloomColor = texture(bloomBlur, vTexCoords).rgb;
hdrColor += bloomColor;
vec3 result = vec3(1.0) - exp(-hdrColor * 1.0f);
result = pow(result, vec3(1.0 / gamma));
FragColor = vec4(result, 1.0);
}