Auria provided tonemap coefficients

This commit is contained in:
vlj 2014-04-26 02:00:50 +02:00
parent 3e4254b3a7
commit 2ca11c3166

View File

@ -24,13 +24,15 @@ void main()
vec3 Cw = getCIEYxy(col.xyz); vec3 Cw = getCIEYxy(col.xyz);
float Lw = Cw.y; float Lw = Cw.y;
/* float L = Lw * exposure / avgLw; /* Reinhard, for reference */
float Ld = L * (1. + L / (Lwhite * Lwhite)); // float L = Lw * exposure / avgLw;
Ld /= (1. + L);*/ // 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); // Uncharted2 tonemap with Auria's custom coefficients
Ld = pow(Ld, 2.2); vec4 perChannel = (col * (6.9 * col + .5)) / (col * (5.5 * col + 1.7) + 0.06);
perChannel = pow(perChannel, vec4(2.2));
FragColor = vec4(Ld * pow(col.xyz / Lw, vec3(saturation)), 1.); FragColor = vec4(perChannel.xyz, 1.);
} }