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
This commit is contained in:
Rémi Verschelde 2022-08-26 23:11:25 +02:00 committed by GitHub
commit 4808d01b2b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 4 deletions

View file

@ -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();