PlanetEditor/grk/cw 6/shaders/shader_FBO.frag
2024-01-22 16:54:33 +01:00

22 lines
492 B
GLSL

#version 330 core
out vec4 FragColor;
in vec2 texCoords;
uniform sampler2D screenTexture;
uniform sampler2D bloomTexture;
uniform float gamma;
void main()
{
vec3 fragment = texture(screenTexture, texCoords).rgb;
vec3 bloom = texture(bloomTexture, texCoords).rgb;
vec3 color = fragment + bloom;
float exposure = 0.8f;
vec3 toneMapped = vec3(1.0f) - exp(-color * exposure);
toneMapped = pow(toneMapped, vec3(1.0f / gamma));
FragColor = vec4(toneMapped, 1.0);
}