Open Calinou opened 3 years ago
Was this prototyped? Wanted to poke it.
Was this prototyped? Wanted to poke it.
I haven't had time to prototype it, so feel free to look into it :slightly_smiling_face:
We discussed this in a proposal review meeting and we're fine with this proposal being implemented. It's fairly low priority as the visual improvement seems relatively minor, and we'd have to see if Kaiser is actually worth it compared to Box in real life use cases.
If someone wants to implement it, we can review the implementation, and see if it's worth making the new default, or merging as an option.
Describe the project you are working on
The Godot editor :slightly_smiling_face:
Describe the problem or limitation you are having in your project
Texture mipmaps could look better than they currently do. Right now, I believe box filtering is used for mipmap generation. It's fast to generate, but it can introduce a fair amount of blurriness in the mipmaps. This makes distant textures lose their details quickly, especially if anisotropic filtering is disabled (which is often the case on mobile to save on GPU memory bandwidth).
Implementing an improved filtering method can enhance the appearance of 3D scenes at no performance cost. On top of that, this will work with any rendering backend.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Add an option to use Kaiser filtering for mipmap generation instead of a box filter. There are some alternatives out there such as Lanczos, but Kaiser seems to have greater adoption in game development overall.
See the Kaiser-filtered Mipmaps section of this article for more information.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
Add a checkbox to the Import dialog to enable Kaiser filtering when generating mipmaps.
I'm not up-to-date on how Godot stores mipmaps in imported textures. Are they stored only in VRAM-compressed textures, or do the lossless formats also support storing precomputed mipmaps? If storing mipmaps is only supported in VRAM-compressed textures, we may have to restrict this feature to VRAM-compressed textures.
We could also expose a way to generate mipmaps at run-time with Kaiser filtering, although this is slower than a simple box filter. (Run-time performance is identical, but the mipmaps take more time to generate.)
Edit (2021-04-07): If anyone is interested in implementing this, I've made a demo you can use to compare mipmapping efficiency: https://github.com/Calinou/godot-mipmaps-test
If this enhancement will not be used often, can it be worked around with a few lines of script?
This can be worked around by importing DDS files which can contain custom mipmaps. However, it's not particularly convenient, and most people aren't even aware of this functionality. Likewise, many people don't know that you can use improved mipmapping algoritms over the default box filter.
Is there a reason why this should be core and not an add-on in the asset library?
See above.