-
-
Notifications
You must be signed in to change notification settings - Fork 23.3k
Enable anisotropic filtering for 3D materials by default on desktop platforms #37847
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
base: master
Are you sure you want to change the base?
Enable anisotropic filtering for 3D materials by default on desktop platforms #37847
Conversation
Why is it not merged? |
@Logharaa reduz said on IRC he'd prefer this to be implemented in a more fine-grained fashion. |
@Calinou Oh ok thanks for the info! |
Mobile cant deal with this as well, and it needs to be tested on lower end devices too, so lets wait a bit on this one |
f5764fd
to
ebf43c9
Compare
I amended the pull request to use 8× anisotropic filtering on desktop and 1× on mobile (which effectively disables it there). |
ebf43c9
to
26bfca0
Compare
26bfca0
to
391a922
Compare
94a406e
to
dd0dd5c
Compare
dd0dd5c
to
f60ac01
Compare
f60ac01
to
044ed04
Compare
5152d5a
to
1d56552
Compare
This needs testing on low end desktop devices to ensure it makes a difference in performance or not. |
I salvaged the PR, but I'll let it simmer in my branch of Godot Engine for a bit until I submit it. |
1d56552
to
0a69239
Compare
Rebased and tested again (using @fire's work as a base), it works as expected. I've also modified the glTF importer to handle this for material import (remember to reimport 3D scenes for this change to apply, e.g. by removing the |
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.
Codestyle checks out. Kinda surprised that anisotropic filtering wasn't already the default; always assumed it was a pretty free feature (maybe not for really low-end devices?)
I agree with reduz, this needs confirmation that it won't harm low end devices. I'm confident that it is a good change for most dedicated GPUs, but I suspect that many integrated GPUs will take a performance hit from this. Since this imposes a new default on all users, we need to be careful and validate these changes before we go ahead. |
I did some tests of https://github.com/Calinou/godot-sponza-4 on my laptop (on AC in balanced mode): PC specifications
The performance difference is very small on average, especially compared to the significant gain in quality. Limiting ourselves to 8x probably did the heavy lifting here, since it's basically twice as cheap as 16x with only a slight loss in visual quality. (Console versions of games often limit themselves to 8x AF for a similar reason, since CPU and GPU memory is shared.) Note that this is a scene with no post-processing effects applied, so scenes with post-processing will spend a greater time in areas other than anisotropic texture sampling (therefore reducing the % impact of anisotropic filtering). |
What about Android devices? They're the ones which are really low-end for Godot... |
I've tested 8x AF on my Samsung Galaxy Z Fold4 and couldn't spot a performance difference on its main screen (it always ran at a locked 120 FPS, also on Truck Town). However, this PR doesn't enable anisotropic filtering by default on mobile (since the |
The performance impact of anisotropic textures doesn't work like that. There is no inherent performance penalty from using it (except for on very old devices), the performance cost comes from the additional bandwidth needed to sample it. Mobile devices are often bottlenecked by reading from textures, so multiplying the cost of texture reads is prohibitive. Desktop devices are almost never bottlenecked by texture reads, so its a free quality improvement. Remember, taking more time for something that isn't the bottleneck is essentially free (until you optimize your existing bottleneck). Low end integrated devices struggle more with texture reads than dedicated GPUs do. So we need to test there to assess the realistic impact. Testing on a high end device or a dedicated GPU won't give you any useful information unfortunately |
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.
This seems good to bring Godot up to industry standard texture quality on PC platforms.
I was doing some performance profiling on macOS last week of the TPS demo and I found that anisotropic textures were a significant cause of high bandwidth in that demo. TBDR GPUs tend to get bandwidth limited fast, so increasing bandwidth is a big concern. It would be nice if this could be scoped to non-TBDR GPUs. I'm not sure if there is an easy way for us to do that. Unfortunately this means that this PR will likely hurt performance on any ARM-based laptops as well as all mobile devices. It might be a tradeoff worth making, but I'm not sure if it is |
We discussed a long time ago where known incompatible systems degrade to a more performant setting. Unknown systems assume to work better. |
If we had a way to use multiple feature tags at once in the Project Settings, we could use Maybe we can disable it for |
If your platform is a nintendo switch your platform provider probably wants a hook |
From my perspective this should be a pretty easy merge in its current state, as this gives a noticeable quality boost on default settings and primarily enables proper control over anisotropic filtering (via the existing project setting), meaning that the feature isn't forced on anyone and can be easily opted out of if it turns out to cause problems for a project. I don't think there's really a need for more override options, at least for the initial merge - on desktop anisotropic filtering is traditionally exposed as a setting to end users anyways, which those with a TBDR GPU could turn down manually if they get bottlenecked by it. |
Discussed in the rendering meeting this week. I am again confirming what reduz and I both say above. This has a huge impact on performance for all non-desktop GPUs. It should not be enabled by default. |
This results in better appearance for textures viewed from oblique angles. Many other engines now enable it by default. On today's desktop platforms, the performance impact is minimal if other effects are already taxing the GPU. The default value chosen (8x) is a good balance between performance and quality. Depending on the scene, you may be able to use 16x anisotropic filtering with little to no cost in terms of frame time. The anisotropic filtering quality can be configured as usual in the Project Settings. Setting it to 1x will disable it even if individual materials have it enabled, so this is easy to revert if you don't want it. This remains disabled by default on platforms with mobile (TBDR) GPUs for performance reasons, as texture reads are often the bottleneck there.
0a69239
to
ed59616
Compare
Rebased and tested again, it works as expected. I've changed the feature tag that disables anisotropic filtering from It may be possible to find better criteria and create an actual At the end of the day, there's no ideal solution here. What do other engines do by default in 2025? |
This results in better appearance for textures viewed from oblique angles. Many other engines now enable it by default. On today's desktop platforms, the performance impact is minimal if other effects are already taxing the GPU.
The anisotropic filtering quality can be configured as usual in the Project Settings. Setting it to 1 should disable it even if individual materials have it enabled, so this is easy to revert if you don't want it.
This remains disabled by default on platforms with mobile (TBDR) GPUs for performance reasons, as texture reads are often the bottleneck there.
I see screenshots of Godot projects not using anisotropic filtering too often – let's change that! 🙂
This closes godotengine/godot-proposals#3134.
Preview
I used this Sponza demo for the screenshots. Click to view at full size, look at the floor.
Before
After
Note: the screenshot below uses 4× anisotropic filtering, not 8× which is the new default on desktop platforms.