From 5f66b792c787e46aea15895f2558aca3bee60928 Mon Sep 17 00:00:00 2001 From: Edgaru089 Date: Sun, 6 Mar 2022 12:36:21 +0800 Subject: [PATCH] fix exposure settings on output --- internal/asset/shader/world/output.frag | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/internal/asset/shader/world/output.frag b/internal/asset/shader/world/output.frag index 70d5b9c..9b4a39f 100644 --- a/internal/asset/shader/world/output.frag +++ b/internal/asset/shader/world/output.frag @@ -11,5 +11,11 @@ void main() { if (texColor.a < 1e-4) discard; - outputColor = vec4(pow(texColor.rgb * exposure, vec3(1.0/gamma)), 1.0f); + 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); }