1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-06 12:20:30 +00:00

Automatically use negative mipmap LOD bias when TAA and/or FXAA are enabled

This improves texture sharpness when TAA and/or FXAA are enabled,
without requiring manual user intervention.
This commit is contained in:
Hugo Locurcio
2022-08-10 16:46:26 +02:00
parent 03ec5d7005
commit 45bc1a3790
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();