From 9e0be4bca928f8df710b59416631fe3318c9af15 Mon Sep 17 00:00:00 2001 From: Yukari Hafner Date: Sat, 4 Jan 2025 11:35:51 +0100 Subject: [PATCH] Fix reinhard and schlick tone mappers --- data/tone-map/reinhard-extended.glsl | 2 +- data/tone-map/reinhard.glsl | 2 +- data/tone-map/schlick.glsl | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/data/tone-map/reinhard-extended.glsl b/data/tone-map/reinhard-extended.glsl index 811851956..a273f3928 100644 --- a/data/tone-map/reinhard-extended.glsl +++ b/data/tone-map/reinhard-extended.glsl @@ -4,5 +4,5 @@ uniform float c_white; vec3 tone_map(vec3 color){ float l_in = color_luminance(color); float l_out = (l_in / (1.0 + l_in / (c_white * c_white))) / (1.0 + l_in); - return color / l_in * l_out; + return (color / l_in) * l_out; } diff --git a/data/tone-map/reinhard.glsl b/data/tone-map/reinhard.glsl index ba38fcbdf..4d6ad23ce 100644 --- a/data/tone-map/reinhard.glsl +++ b/data/tone-map/reinhard.glsl @@ -2,5 +2,5 @@ vec3 tone_map(vec3 color){ float l_in = color_luminance(color); float l_out = l_in / (1.0 + l_in); - return color / l_in * l_out; + return (color / l_in) * l_out; } diff --git a/data/tone-map/schlick.glsl b/data/tone-map/schlick.glsl index 92c2b6a94..40dc119f0 100644 --- a/data/tone-map/schlick.glsl +++ b/data/tone-map/schlick.glsl @@ -3,6 +3,6 @@ uniform float p, hi_val; vec3 tone_map(vec3 color){ float l_in = color_luminance(color); - float l_out = (p * l_in) / (p * l_in - l_in + hi_val); - return color / l_in * l_out; + float l_out = (p * l_in) / (p * l_in + hi_val - l_in); + return (color / l_in) * l_out; }