add tonemapping shaders

This commit is contained in:
2020-05-22 19:59:34 +08:00
parent eb0b29275e
commit 23685cd868
18 changed files with 606 additions and 59 deletions

View File

@@ -0,0 +1,20 @@
// Uncharted 2 tone map
// see: http://filmicworlds.com/blog/filmic-tonemapping-operators/
vec3 toneMapUncharted2Impl(vec3 color)
{
const float A = 0.15;
const float B = 0.50;
const float C = 0.10;
const float D = 0.20;
const float E = 0.02;
const float F = 0.30;
return ((color*(A*color+C*B)+D*E)/(color*(A*color+B)+D*F))-E/F;
}
vec3 ToneMapping(vec3 color)
{
const float W = 11.2;
color = toneMapUncharted2Impl(color * 2.0);
vec3 whiteScale = 1.0 / toneMapUncharted2Impl(vec3(W));
return linearTosRGB(color * whiteScale);
}