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

All Hgi implementations force maximum anisotropic filtering for all textures regardless of usage #3180

Open
DDoS opened this issue Jul 26, 2024 · 1 comment

Comments

@DDoS
Copy link
Contributor

DDoS commented Jul 26, 2024

Description of Issue

In all Hgi implementations, texture sampling is set to the maximum anisotropic filtering supported by the implementation, without any way to override it. See pxr/imaging/hgiGL/sampler.cpp, pxr/imaging/hgiGL/texture.cpp, pxr/imaging/hgiMetal/sampler.mm, pxr/imaging/hgiVulkan/sampler.cpp. This can be a significant performance issue, as it increases the texture memory bandwidth usage.
This is also done for every sampler, regardless of its usage. For example when enabling dome lighting, every sample on the pre-filtered light maps is done with anisotropic filtering, even if it's not a UV mapped texture (not applied to geometry). This can cause accuracy issues (because the sample is not on a fragment), but it's also completely wasted bandwidth.
Performance of anisotropic filtering is highly hardware dependent. Each vendor does it differently, and there are no standards (graphics API specs are very vague about how it should work). It's typically cheap on modern high performance hardware, but no so much on low spec hardware devices or software rasterizers.

A few simple changes could help fix most problems:

  • Expose maxAnisotropy in HgiSamplerDesc
  • Define an environment setting HGI_MAX_ANISOTROPY as an override for the implementation max anisotropy
  • Update current users of textures/samples to disable anisotropy when not needed (like dome lighting texture)

Steps to Reproduce

N/A

System Information (OS, Hardware)

N/A

Package Versions

N/A

Build Flags

N/A

@jesschimein
Copy link
Contributor

Filed as internal issue #USD-9898

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants