add tonemapping shaders
This commit is contained in:
20
shader/ToneMap/Uncharted2.glsl
Normal file
20
shader/ToneMap/Uncharted2.glsl
Normal 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);
|
||||
}
|
Reference in New Issue
Block a user