PlanetEditor/grk/cw 6/shaders/shader_FBO.frag

21 lines
456 B
GLSL
Raw Normal View History

2024-01-22 12:38:19 +01:00
#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);
FragColor.rgb = pow(toneMapped, vec3(1.0f / gamma));
}