diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-10-19 23:18:24 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-19 23:18:24 +0200 |
commit | cf3a4cb09132f151a046da3ae827f7c9fbcbf69c (patch) | |
tree | 42d4e98f42e0375dc7925eb13e27e0243abab792 /servers/rendering/rasterizer_rd/shaders | |
parent | 50b6050984ab56dbc1467f086f61eb851a0e257e (diff) | |
parent | 15d033e25f867d4a96610dde8e8aa91fd36df3b0 (diff) |
Merge pull request #42913 from Calinou/debanding-fix-brightness
Fix debanding slightly brightening the whole viewport
Diffstat (limited to 'servers/rendering/rasterizer_rd/shaders')
-rw-r--r-- | servers/rendering/rasterizer_rd/shaders/tonemap.glsl | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/servers/rendering/rasterizer_rd/shaders/tonemap.glsl b/servers/rendering/rasterizer_rd/shaders/tonemap.glsl index a464048ebd..2a13db4cd1 100644 --- a/servers/rendering/rasterizer_rd/shaders/tonemap.glsl +++ b/servers/rendering/rasterizer_rd/shaders/tonemap.glsl @@ -311,7 +311,8 @@ vec3 screen_space_dither(vec2 frag_coord) { vec3 dither = vec3(dot(vec2(171.0, 231.0), frag_coord)); dither.rgb = fract(dither.rgb / vec3(103.0, 71.0, 97.0)); - return dither.rgb / 255.0; + // Subtract 0.5 to avoid slightly brightening the whole viewport. + return (dither.rgb - 0.5) / 255.0; } void main() { @@ -338,7 +339,8 @@ void main() { color = do_fxaa(color, exposure, uv_interp); } if (params.use_debanding) { - // Debanding should be done before tonemapping. + // For best results, debanding should be done before tonemapping. + // Otherwise, we're adding noise to an already-quantized image. color += screen_space_dither(gl_FragCoord.xy); } color = apply_tonemapping(color, params.white); |