summaryrefslogtreecommitdiff
path: root/src/renderergl2/glsl/tonemap_fp.glsl
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2016-04-09 17:57:28 +0100
committerTim Angus <tim@ngus.net>2016-04-09 17:57:28 +0100
commitf45fbef604e05144057dec8d1dbfc5d4f5a2a822 (patch)
tree152d2a428b078f7a89756ea9e156695fc69f1686 /src/renderergl2/glsl/tonemap_fp.glsl
parent7f9e97d611b4b267d9dd913144cb9632f96c90c2 (diff)
parent87abdd914988724e164ffb16380ad26be8420b84 (diff)
Merge branch 'master' into gpp
Diffstat (limited to 'src/renderergl2/glsl/tonemap_fp.glsl')
-rw-r--r--src/renderergl2/glsl/tonemap_fp.glsl11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/renderergl2/glsl/tonemap_fp.glsl b/src/renderergl2/glsl/tonemap_fp.glsl
index 1368c5bd..9e24e24a 100644
--- a/src/renderergl2/glsl/tonemap_fp.glsl
+++ b/src/renderergl2/glsl/tonemap_fp.glsl
@@ -28,8 +28,8 @@ void main()
{
vec4 color = texture2D(u_TextureMap, var_TexCoords) * u_Color;
-#if defined(r_framebufferGamma)
- color.rgb = pow(color.rgb, vec3(r_framebufferGamma));
+#if defined(USE_PBR)
+ color.rgb *= color.rgb;
#endif
vec3 minAvgMax = texture2D(u_LevelsMap, var_TexCoords).rgb;
@@ -46,9 +46,12 @@ void main()
color.rgb = clamp(color.rgb * var_InvWhite, 0.0, 1.0);
-#if defined(r_tonemapGamma)
- color.rgb = pow(color.rgb, vec3(1.0 / r_tonemapGamma));
+#if defined(USE_PBR)
+ color.rgb = sqrt(color.rgb);
#endif
+ // add a bit of dither to reduce banding
+ color.rgb += vec3(1.0/510.0 * mod(gl_FragCoord.x + gl_FragCoord.y, 2.0) - 1.0/1020.0);
+
gl_FragColor = color;
}