summaryrefslogtreecommitdiff
path: root/servers/rendering/renderer_rd/shaders
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2022-09-27 09:54:45 +0200
committerRémi Verschelde <rverschelde@gmail.com>2022-09-27 09:54:45 +0200
commit5ecaa676ccf56e90b72535e5c344e8b7c2b719f0 (patch)
tree0d7f9fad20dc30b93fc17e33b67f12b745841a50 /servers/rendering/renderer_rd/shaders
parent92371880bd10041a6924e271147258ad47e81c4e (diff)
parentfe69fedc1aebf6998488f03f98ea2383c986d3d8 (diff)
Merge pull request #66317 from clayjohn/debanding-bug
Move deband to end of tonemapping.
Diffstat (limited to 'servers/rendering/renderer_rd/shaders')
-rw-r--r--servers/rendering/renderer_rd/shaders/effects/tonemap.glsl12
1 files changed, 6 insertions, 6 deletions
diff --git a/servers/rendering/renderer_rd/shaders/effects/tonemap.glsl b/servers/rendering/renderer_rd/shaders/effects/tonemap.glsl
index e459756c6a..a1836e3455 100644
--- a/servers/rendering/renderer_rd/shaders/effects/tonemap.glsl
+++ b/servers/rendering/renderer_rd/shaders/effects/tonemap.glsl
@@ -462,12 +462,6 @@ void main() {
}
#endif
- if (params.use_debanding) {
- // For best results, debanding should be done before tonemapping.
- // Otherwise, we're adding noise to an already-quantized image.
- color.rgb += screen_space_dither(gl_FragCoord.xy);
- }
-
color.rgb = apply_tonemapping(color.rgb, params.white);
color.rgb = linear_to_srgb(color.rgb); // regular linear -> SRGB conversion
@@ -498,5 +492,11 @@ void main() {
color.rgb = apply_color_correction(color.rgb);
}
+ if (params.use_debanding) {
+ // Debanding should be done at the end of tonemapping, but before writing to the LDR buffer.
+ // Otherwise, we're adding noise to an already-quantized image.
+ color.rgb += screen_space_dither(gl_FragCoord.xy);
+ }
+
frag_color = color;
}