-
-
Notifications
You must be signed in to change notification settings - Fork 21.6k
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
Enable anisotropic filtering for 3D materials by default on desktop platforms #37847
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. |
@Calinou Do you think we can cover enough devices to turn this on by default? |
I salvaged the PR, but I'll let it simmer in my branch of Godot Engine for a bit until I submit it. https://github.com/V-Sekai/godot/tree/vsk-default-enable-anisotropic-filtering-4.4 |
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.
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 |
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.
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.