22 lines
419 B
GLSL
22 lines
419 B
GLSL
#version 330
|
|
|
|
uniform sampler2D tex;
|
|
uniform float gamma, exposure;
|
|
|
|
in vec2 fragPosScreen;
|
|
out vec4 outputColor;
|
|
|
|
void main() {
|
|
vec4 texColor = texture(tex, fragPosScreen);
|
|
if (texColor.a < 1e-4)
|
|
discard;
|
|
|
|
vec3 mapped = texColor.rgb;
|
|
if (exposure < 1e-4)
|
|
mapped = mapped / (mapped + vec3(1.0));
|
|
else
|
|
mapped = vec3(1.0) - exp(-mapped * exposure);
|
|
|
|
outputColor = vec4(pow(mapped, vec3(1.0/gamma)), 1.0f);
|
|
}
|