gl01/internal/asset/shader/world/output.frag

22 lines
419 B
GLSL
Raw Normal View History

2022-01-20 21:58:50 +08:00
#version 330
2022-01-29 22:29:27 +08:00
uniform sampler2D tex;
2022-02-15 23:37:42 +08:00
uniform float gamma, exposure;
2022-01-20 21:58:50 +08:00
2022-01-22 23:06:41 +08:00
in vec2 fragPosScreen;
2022-01-20 21:58:50 +08:00
out vec4 outputColor;
void main() {
2022-02-21 14:01:09 +08:00
vec4 texColor = texture(tex, fragPosScreen);
2022-02-15 23:37:42 +08:00
if (texColor.a < 1e-4)
discard;
2022-03-06 12:36:21 +08:00
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);
2022-01-20 21:58:50 +08:00
}