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
Clean up texture filtering settings #13683
Conversation
Oh no, the CI failed with a vcpkg download error again ☠️ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works. Thanks!
Just have a small suggestion to make NEAREST_MIPMAP_LINEAR
available. Feel free to dismiss.
Should we maybe enable mipmapping and anisotropic filtering by default. At least on my machine there's no noticeable performance penalty through these in minetest. (Should be another PR though.) |
I'm one of those who always uses this option. Not every game/texture pack uses pixel art, and even when it's the case, it's still useful to enable texture filtering along with cranking up the current |
After this PR, the "bilinear filtering", "trilinear filtering" and "anisotropic filtering" settings will still help against aliasing as much as before. They're still applied during minification, where they prevent aliasing. They're just not applied during magnification anymore, where bilinear filtering causes blurriness and is usually used as a stylistic device rather than to avoid aliasing. Because of technical limitations in Irrlicht, Minetest could until recently only enable bilinear filtering on both minification and magnification together. It's true that some games made with Minetest may want to enable bilinear filtering on magnification as a part of their (non-pixel art) style, but that's something for another PR. |
This reverts commit 72ef908. The reverted commit caused several regressions in rendering textures using bilinear, trilinear or anisotropic filtering. In particular: • Textures with a height or width lower than “texture_min_size” were no longer first upscaled and then filtered. This change affected how all small textures (i.e. almost all Minetest textures) looked if filtering was enabled – they were not filtered at all. To users this looked like bilinear and trilinear filtering no longer working. Anisotropic filter effects were affected in differently, depending on vendor (see below). • On Intel GPUs (and possibly others), anisotropic filtering would blur textures with small height or width extremely due to GL_NEAREST being set. The effect of that combination depends on driver internals – see <KhronosGroup/Vulkan-Docs#1361> and Vulkan 1.3.249 spec update for details. Note that Khronos Group explicitly warned against using GL_NEAREST in this scenario, as it can not be expected to result in a consistent look with different GPUs, ever.
This reverts commit 72ef908. The reverted commit caused several regressions in rendering textures using bilinear, trilinear or anisotropic filtering. In particular: • Textures with a height or width lower than “texture_min_size” were no longer first upscaled and then filtered. This change affected how all small textures (i.e. almost all Minetest textures) looked if filtering was enabled – they were not filtered at all. To users this looked like bilinear and trilinear filtering no longer working. Anisotropic filter effects were affected in differently, depending on vendor (see below). • On Intel GPUs (and possibly others), anisotropic filtering would blur textures with small height or width extremely due to GL_NEAREST being set. The effect of that combination depends on driver internals – see <KhronosGroup/Vulkan-Docs#1361> and Vulkan 1.3.249 spec update for details. Note that Khronos Group explicitly warned against using GL_NEAREST in this scenario, as it can not be expected to result in a consistent look with different GPUs, ever.
This reverts commit 1d4672b. The “now unused” code is needed again, as the Minetest PR that obsoleted it <minetest/minetest#13683> had to be reverted due to causing several regressions in Minetest's texture filtering.
This reverts commit 72ef908. The reverted commit caused several regressions in rendering textures using bilinear, trilinear or anisotropic filtering. In particular: • Textures with a height or width lower than “texture_min_size” were no longer first upscaled and then filtered. This change affected how all small textures (i.e. almost all Minetest textures) looked if filtering was enabled – they were not filtered at all. To users this looked like bilinear and trilinear filtering were no longer working. Anisotropic filter effects were affected in different ways, depending on vendor. • On Intel GPUs (and possibly others), anisotropic filtering would blur textures with small height or width extremely due to GL_NEAREST being set. The effect of that combination depends on driver internals – see <KhronosGroup/Vulkan-Docs#1361> and Vulkan 1.3.249 spec update for details. Note that Khronos Group explicitly warned against using GL_NEAREST in this scenario, as it can not be expected to result in a consistent look with different GPUs, ever.
This reverts commit 72ef908. The reverted commit caused several regressions in rendering textures using bilinear, trilinear or anisotropic filtering. In particular: • Textures with a height or width lower than “texture_min_size” were no longer upscaled and then filtered – textures were not filtered at all when being upscaled instead, to achieve a crisper look. To users this looked like bilinear and trilinear filtering options were not working, as most textures in Minetest are rather small and thus often upscaled. Anisotropic filter effects were affected in different ways; depending on vendor filtering could happen when upscaling textures (see below). • On Intel GPUs (and possibly others), anisotropic filtering would blur textures with small height or width extremely due to GL_NEAREST being set. The effect of that combination depends on driver internals – see <KhronosGroup/Vulkan-Docs#1361> and Vulkan 1.3.249 spec update for details. Note that Khronos Group explicitly warned against using GL_NEAREST in this scenario, as it can not be expected to result in a consistent look with different GPUs, ever.
Closes #13108, probably closes #8171. This PR makes the following changes:
Bilinear filtering is no longer applied when scaling textures up, because:
GL_TEXTURE_MAG_FILTER
is now always set toGL_NEAREST
. This was made possible by Refactor parts of the material system and set min filter to bilinear for 2D graphics irrlicht#204 and Refactor parts of Irrlicht's material system #13622.Since there is no longer the possibility for textures to be upscaled with bilinear filtering, the
texture_min_size
setting is no longer needed. However, it hasn't been removed completely because it's still being (ab)used for another purpose.The
texture_clean_transparent
setting has been removed. Instead, whether to clean transparent textures or not is now decided automatically.I decided against exposing
GL_NEAREST_MIPMAP_LINEAR
in this PR because the terms "bilinear filtering" and "trilinear filtering" seem to be relatively well known. I didn't see enough additional value inGL_NEAREST_MIPMAP_LINEAR
to justify making the settings more complicated for players.To do
This PR is a Ready for Review. After this PR is merged, the
SMaterialLayer::setFiltersMinetest
method should be removed from IrrlichtMt.How to test
For example: Enable bilinear or trilinear filtering and verify that nothing appears blurry when magnified anymore.