summaryrefslogtreecommitdiff
path: root/servers
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-08-26 23:11:25 +0200
committerGitHub <noreply@github.com>2022-08-26 23:11:25 +0200
commit4808d01b2bcda54db15e1e2649e0a38c37886ee1 (patch)
treee9eb38a150ce591bd6c54147df47b7533a514777 /servers
parent046c69b2a567ce84fa53959615eed40c380730b5 (diff)
parent45bc1a379021017a841bc6a2f6afe03c6eb8040f (diff)
Merge pull request #64223 from Calinou/taa-fxaa-use-negative-mipmap-lod-bias
Automatically use negative mipmap LOD bias when TAA and/or FXAA are enabled
Diffstat (limited to 'servers')
-rw-r--r--servers/rendering/renderer_rd/renderer_scene_render_rd.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp b/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp
index dd42271c95..7adc36c57c 100644
--- a/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp
+++ b/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp
@@ -2459,6 +2459,19 @@ void RendererSceneRenderRD::render_buffers_configure(RID p_render_buffers, RID p
p_internal_width = p_width;
}
+ if (p_use_taa) {
+ // Use negative mipmap LOD bias when TAA is enabled to compensate for loss of sharpness.
+ // This restores sharpness in still images to be roughly at the same level as without TAA,
+ // but moving scenes will still be blurrier.
+ p_texture_mipmap_bias -= 0.5;
+ }
+
+ if (p_screen_space_aa == RS::VIEWPORT_SCREEN_SPACE_AA_FXAA) {
+ // Use negative mipmap LOD bias when FXAA is enabled to compensate for loss of sharpness.
+ // If both TAA and FXAA are enabled, combine their negative LOD biases together.
+ p_texture_mipmap_bias -= 0.25;
+ }
+
material_storage->sampler_rd_configure_custom(p_texture_mipmap_bias);
update_uniform_sets();