Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a negative mipmap LOD bias automatically if FXAA and/or TAA are enabled to improve sharpness #4657

Closed
Calinou opened this issue Jun 12, 2022 · 1 comment · Fixed by godotengine/godot#64223

Comments

@Calinou
Copy link
Member

Calinou commented Jun 12, 2022

Related to #3134 (both proposals can be implemented independently).

Describe the project you are working on

The Godot editor 🙂

Describe the problem or limitation you are having in your project

Distant textures or textures viewed at an oblique angle look blurry, especially when anisotropic filtering is not used on them. Anisotropic filtering improves the appearance of textures viewed at an oblique angle, but it doesn't improve the appearance of distant textures viewed from upfront.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

General mipmapped texture appearance could be improved by using a negative mipmap LOD bias, especially when temporal antialiasing (TAA) or FXAA is enabled. This is especially helpful to counteract the added blurriness of TAA or FXAA.

TAA in particular makes it possible to decrease mipmap LOD bias more significantly without introducing graininess, thanks to its temporal nature. It's similar in fashion to how TAA combats specular aliasing. FXAA does not combat this kind of shimmering, but it still helps a little in those scenarios. We can still exploit this to reduce the blurriness added by FXAA (which is a common complaint about FXAA, especially at 1080p and below).

Note that this proposal requires godotengine/godot#61953 to be implemented, as the mipmap LOD bias needs to be customizable regardless of the scaling mode used.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

FSR 2.0 seems to quite quite aggressive LOD bias. We can probably do the same with TAA at native resolution (but with more conservative LOD bias).

Therefore, I propose the following:

  • When the screen-space antialiasing method is set to FXAA, subtract -0.25 from the existing mipmap LOD bias.
  • When TAA is enabled, subtract -1.0 from the existing mipmap LOD bias.
    • If this introduces graininess on some textures in a typical realistic scene, we can settle for a more conservative bias like -0.75 or even -0.5.
  • When both FXAA and TAA is enabled, combine both subtractions together.
    • With the default mipmap LOD bias, this would be a final LOD bias of -1.25.
  • When FSR 1.0 scaling is used, use the final LOD bias (modified by the above checks) as a baseline for automatic adjustments.
Old version
  • Use a negative mipmap LOD bias of -0.25 by default. This is a safe value that should introduce little to no visible graininess during gameplay.
  • When the screen-space antialiasing method is set to FXAA, subtract -0.25 from the existing mipmap LOD bias.
    • With the default mipmap LOD bias, this would be a final LOD bias of -0.5.
  • When TAA is enabled, subtract -0.5 from the existing mipmap LOD bias.
    • With the default mipmap LOD bias, this would be a final LOD bias of -0.75.
  • When both FXAA and TAA is enabled, combine both subtractions together.
    • With the default mipmap LOD bias, this would be a final LOD bias of -1.0.
  • When FSR 1.0 scaling is used, use the final LOD bias (modified by the above checks) as a baseline for automatic adjustments.

For users that don't want automatic adjustments to occur, we could probably add a boolean property (true by default) that controls whether automatic mipmap LOD adjustments are performed.

If this enhancement will not be used often, can it be worked around with a few lines of script?

Yes, but it's not exactly obvious how mipmap LOD bias interacts with 3D rendering, especially for people less knowledgeable with 3D rendering.

Is there a reason why this should be core and not an add-on in the asset library?

This is about changing a default setting, and automatically adjusting values to improve out of the box image quality.

@Calinou Calinou added this to the 4.0 milestone Jun 12, 2022
@Calinou Calinou changed the title Use a slight negative mipmap LOD bias by default Use a slight negative mipmap LOD bias by default (and adjust it further if TAA or FXAA are enabled) Jun 12, 2022
@clayjohn
Copy link
Member

2 thoughts:

  1. I think adding an automatic adjustment for FXAA and TAA is a good idea (we already do it for FSR)
  2. I don't think we should default to -0.25 always. That is a choice that should be made by users as it will result in a stylistic change to games using Godot (most noticeably will be an increase in perceived graininess of all textures)

@Calinou Calinou changed the title Use a slight negative mipmap LOD bias by default (and adjust it further if TAA or FXAA are enabled) Use a negative mipmap LOD bias automatically if FXAA and/or TAA are enabled to improve sharpness Jul 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants