PixarAnimationStudios / OpenUSD

Universal Scene Description
http://www.openusd.org
Other
5.99k stars 1.18k forks source link

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

Open DDoS opened 1 month ago

DDoS commented 1 month ago

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:

Steps to Reproduce

N/A

System Information (OS, Hardware)

N/A

Package Versions

N/A

Build Flags

N/A

jesschimein commented 1 month ago

Filed as internal issue #USD-9898