summaryrefslogtreecommitdiff
path: root/src/renderergl2/glsl/tonemap_fp.glsl
diff options
context:
space:
mode:
Diffstat (limited to 'src/renderergl2/glsl/tonemap_fp.glsl')
-rw-r--r--src/renderergl2/glsl/tonemap_fp.glsl7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/renderergl2/glsl/tonemap_fp.glsl b/src/renderergl2/glsl/tonemap_fp.glsl
index 5d8841d6..9e24e24a 100644
--- a/src/renderergl2/glsl/tonemap_fp.glsl
+++ b/src/renderergl2/glsl/tonemap_fp.glsl
@@ -29,7 +29,7 @@ void main()
vec4 color = texture2D(u_TextureMap, var_TexCoords) * u_Color;
#if defined(USE_PBR)
- color.rgb = pow(color.rgb, vec3(2.2));
+ color.rgb *= color.rgb;
#endif
vec3 minAvgMax = texture2D(u_LevelsMap, var_TexCoords).rgb;
@@ -47,8 +47,11 @@ void main()
color.rgb = clamp(color.rgb * var_InvWhite, 0.0, 1.0);
#if defined(USE_PBR)
- color.rgb = pow(color.rgb, vec3(1.0 / 2.2));
+ 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;
}