diff options
author | Tim Angus <tim@ngus.net> | 2013-02-15 23:46:37 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-02-16 21:55:58 +0000 |
commit | 1fba10104e76e937eeac60bc207a74012ab936dc (patch) | |
tree | 7bcb5507cd1aa13e6f07b74c008e9391abbf26ae /src/rend2/glsl/tonemap_fp.glsl | |
parent | c1ad10c57be23f89f658a13729e4349b400a8734 (diff) |
renderer -> renderergl1, rend2 -> renderergl2
Diffstat (limited to 'src/rend2/glsl/tonemap_fp.glsl')
-rw-r--r-- | src/rend2/glsl/tonemap_fp.glsl | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/src/rend2/glsl/tonemap_fp.glsl b/src/rend2/glsl/tonemap_fp.glsl deleted file mode 100644 index 9b18de8a..00000000 --- a/src/rend2/glsl/tonemap_fp.glsl +++ /dev/null @@ -1,48 +0,0 @@ -uniform sampler2D u_TextureMap; -uniform sampler2D u_LevelsMap; - -uniform vec4 u_Color; - -uniform vec2 u_AutoExposureMinMax; -uniform vec3 u_ToneMinAvgMaxLinear; - -varying vec2 var_TexCoords; - -const vec3 LUMINANCE_VECTOR = vec3(0.2125, 0.7154, 0.0721); //vec3(0.299, 0.587, 0.114); - -vec3 FilmicTonemap(vec3 x) -{ - const float SS = 0.22; // Shoulder Strength - const float LS = 0.30; // Linear Strength - const float LA = 0.10; // Linear Angle - const float TS = 0.20; // Toe Strength - const float TAN = 0.01; // Toe Angle Numerator - const float TAD = 0.30; // Toe Angle Denominator - - vec3 SSxx = SS * x * x; - vec3 LSx = LS * x; - vec3 LALSx = LSx * LA; - - return ((SSxx + LALSx + TS * TAN) / (SSxx + LSx + TS * TAD)) - TAN / TAD; - - //return ((x*(SS*x+LA*LS)+TS*TAN)/(x*(SS*x+LS)+TS*TAD)) - TAN/TAD; - -} - -void main() -{ - vec4 color = texture2D(u_TextureMap, var_TexCoords) * u_Color; - vec3 minAvgMax = texture2D(u_LevelsMap, var_TexCoords).rgb; - vec3 logMinAvgMaxLum = clamp(minAvgMax * 20.0 - 10.0, -u_AutoExposureMinMax.y, -u_AutoExposureMinMax.x); - - float avgLum = exp2(logMinAvgMaxLum.y); - //float maxLum = exp2(logMinAvgMaxLum.z); - - color.rgb *= u_ToneMinAvgMaxLinear.y / avgLum; - color.rgb = max(vec3(0.0), color.rgb - vec3(u_ToneMinAvgMaxLinear.x)); - - vec3 fWhite = 1.0 / FilmicTonemap(vec3(u_ToneMinAvgMaxLinear.z - u_ToneMinAvgMaxLinear.x)); - color.rgb = FilmicTonemap(color.rgb) * fWhite; - - gl_FragColor = clamp(color, 0.0, 1.0); -} |