From 2ca11c316602960a50fdb68471b33e82efffe0db Mon Sep 17 00:00:00 2001 From: vlj Date: Sat, 26 Apr 2014 02:00:50 +0200 Subject: [PATCH] Auria provided tonemap coefficients --- data/shaders/tonemap.frag | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/data/shaders/tonemap.frag b/data/shaders/tonemap.frag index 4e414578c..b3c7d6905 100644 --- a/data/shaders/tonemap.frag +++ b/data/shaders/tonemap.frag @@ -24,13 +24,15 @@ void main() vec3 Cw = getCIEYxy(col.xyz); float Lw = Cw.y; -/* float L = Lw * exposure / avgLw; - float Ld = L * (1. + L / (Lwhite * Lwhite)); - Ld /= (1. + L);*/ + /* Reinhard, for reference */ +// float L = Lw * exposure / avgLw; +// float Ld = L * (1. + L / (Lwhite * Lwhite)); +// Ld /= (1. + L); +// FragColor = vec4(Ld * pow(col.xyz / Lw, vec3(saturation)), 1.); - float Ld = (Lw * (6.2 * Lw + .5)) / (Lw * (6.2 * Lw + 1.7) + 0.06); - Ld = pow(Ld, 2.2); - - FragColor = vec4(Ld * pow(col.xyz / Lw, vec3(saturation)), 1.); + // Uncharted2 tonemap with Auria's custom coefficients + vec4 perChannel = (col * (6.9 * col + .5)) / (col * (5.5 * col + 1.7) + 0.06); + perChannel = pow(perChannel, vec4(2.2)); + FragColor = vec4(perChannel.xyz, 1.); }