diff options
Diffstat (limited to 'src/renderergl2/glsl/tonemap_fp.glsl')
-rw-r--r-- | src/renderergl2/glsl/tonemap_fp.glsl | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/renderergl2/glsl/tonemap_fp.glsl b/src/renderergl2/glsl/tonemap_fp.glsl index 9b18de8a..4c914aca 100644 --- a/src/renderergl2/glsl/tonemap_fp.glsl +++ b/src/renderergl2/glsl/tonemap_fp.glsl @@ -32,6 +32,11 @@ vec3 FilmicTonemap(vec3 x) void main() { vec4 color = texture2D(u_TextureMap, var_TexCoords) * u_Color; + + #if defined(r_framebufferGamma) + color.rgb = pow(color.rgb, vec3(r_framebufferGamma)); + #endif + vec3 minAvgMax = texture2D(u_LevelsMap, var_TexCoords).rgb; vec3 logMinAvgMaxLum = clamp(minAvgMax * 20.0 - 10.0, -u_AutoExposureMinMax.y, -u_AutoExposureMinMax.x); @@ -44,5 +49,9 @@ void main() vec3 fWhite = 1.0 / FilmicTonemap(vec3(u_ToneMinAvgMaxLinear.z - u_ToneMinAvgMaxLinear.x)); color.rgb = FilmicTonemap(color.rgb) * fWhite; + #if defined(r_tonemapGamma) + color.rgb = pow(color.rgb, vec3(1.0 / r_tonemapGamma)); + #endif + gl_FragColor = clamp(color, 0.0, 1.0); } |