add tonemapping shaders
This commit is contained in:
11
shader/ToneMap/ACES.glsl
Normal file
11
shader/ToneMap/ACES.glsl
Normal file
@@ -0,0 +1,11 @@
|
||||
// ACES tone map
|
||||
// see: https://knarkowicz.wordpress.com/2016/01/06/aces-filmic-tone-mapping-curve/
|
||||
vec3 ToneMapping(vec3 color)
|
||||
{
|
||||
const float A = 2.51;
|
||||
const float B = 0.03;
|
||||
const float C = 2.43;
|
||||
const float D = 0.59;
|
||||
const float E = 0.14;
|
||||
return linearTosRGB(clamp((color * (A * color + B)) / (color * (C * color + D) + E), 0.0, 1.0));
|
||||
}
|
7
shader/ToneMap/HejlRichard.glsl
Normal file
7
shader/ToneMap/HejlRichard.glsl
Normal file
@@ -0,0 +1,7 @@
|
||||
// Hejl Richard tone map
|
||||
// see: http://filmicworlds.com/blog/filmic-tonemapping-operators/
|
||||
vec3 ToneMapping(vec3 color)
|
||||
{
|
||||
color = max(vec3(0.0), color - vec3(0.004));
|
||||
return (color*(6.2*color+.5))/(color*(6.2*color+1.7)+0.06);
|
||||
}
|
6
shader/ToneMap/Linear.glsl
Normal file
6
shader/ToneMap/Linear.glsl
Normal file
@@ -0,0 +1,6 @@
|
||||
vec3 ToneMapping(vec3 color)
|
||||
{
|
||||
color = clamp(u_Exposure * color, 0., 1.);
|
||||
|
||||
return linearTosRGB(color);
|
||||
}
|
8
shader/ToneMap/LumaBasedReinhard.glsl
Normal file
8
shader/ToneMap/LumaBasedReinhard.glsl
Normal file
@@ -0,0 +1,8 @@
|
||||
vec3 ToneMapping(vec3 color)
|
||||
{
|
||||
float luma = dot(color, vec3(0.2126, 0.7152, 0.0722));
|
||||
float toneMappedLuma = luma / (1. + luma);
|
||||
color *= toneMappedLuma / luma;
|
||||
|
||||
return linearTosRGB(color);
|
||||
}
|
6
shader/ToneMap/RomBinDaHouse.glsl
Normal file
6
shader/ToneMap/RomBinDaHouse.glsl
Normal file
@@ -0,0 +1,6 @@
|
||||
vec3 ToneMapping(vec3 color)
|
||||
{
|
||||
color = exp( -1.0 / ( 2.72*color + 0.15 ) );
|
||||
|
||||
return linearTosRGB(color);
|
||||
}
|
6
shader/ToneMap/SimpleReinhard.glsl
Normal file
6
shader/ToneMap/SimpleReinhard.glsl
Normal file
@@ -0,0 +1,6 @@
|
||||
vec3 ToneMapping(vec3 color)
|
||||
{
|
||||
color *= u_Exposure/(1. + color / u_Exposure);
|
||||
|
||||
return linearTosRGB(color);
|
||||
}
|
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);
|
||||
}
|
9
shader/ToneMap/WhitePreservingLumaBasedReinhard.glsl
Normal file
9
shader/ToneMap/WhitePreservingLumaBasedReinhard.glsl
Normal file
@@ -0,0 +1,9 @@
|
||||
vec3 ToneMapping(vec3 color)
|
||||
{
|
||||
float white = 2.;
|
||||
float luma = dot(color, vec3(0.2126, 0.7152, 0.0722));
|
||||
float toneMappedLuma = luma * (1. + luma / (white*white)) / (1. + luma);
|
||||
color *= toneMappedLuma / luma;
|
||||
|
||||
return linearTosRGB(color);
|
||||
}
|
Reference in New Issue
Block a user