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

WebGLTextures: Only use anistropic filtering with certain minFilter/magFilter combinations. #25068

Merged
merged 2 commits into from
Dec 14, 2022

Conversation

hybridherbst
Copy link
Contributor

@hybridherbst hybridherbst commented Dec 3, 2022

Fixed #25067

Description

Fixes the above mentioned issue by not setting anisotropy if the texture has NEAREST magFilter.

I'm not sure: would this need to be applied on the new WebGPURenderer and so on as well?

This contribution is funded by Needle

@Mugen87
Copy link
Collaborator

Mugen87 commented Dec 3, 2022

Although it's technically possible I've thought you should always use anistropic filtering with mipmapping for performance reasons (see https://paroj.github.io/gltut/Texturing/Tut15%20Anisotropy.html). So we could also check for ( texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter ).

@hybridherbst
Copy link
Contributor Author

Makes sense. I hope I get to change this next week.

@elalish
Copy link
Contributor

elalish commented Dec 13, 2022

Good catch! I think I'll wait on google/model-viewer#4005 until this fix is in. If it can sneak into r148, that would be much appreciated!

@hybridherbst
Copy link
Contributor Author

I believe I got all cases right now; I compared behaviour with aniso=1 and =4 for a number of combinations of minFilter and magFilter (including some weird ones).

  • magFilter === Nearest must be excluded
  • only minFilter === NearestMipmapLinearFilter and minFilter === LinearMipmapLinearFilter are the remaining options where anisotropy makes sense

Test file:
TextureFiltering-Pixelgraphics.zip

@Mugen87 Mugen87 changed the title Fix: anisotropy got applied to textures with NEAREST filtering with inconsistent results WebGLTextures: Only use anistropic filtering with certain minFilter/magFilter combinations. Dec 14, 2022
@Mugen87 Mugen87 added this to the r148 milestone Dec 14, 2022
@Mugen87 Mugen87 merged commit f9403dc into mrdoob:dev Dec 14, 2022
@hybridherbst hybridherbst deleted the fix-aniso-applied-to-nearest-filter branch December 14, 2022 11:44
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

Successfully merging this pull request may close these issues.

GPU implementation differences with texture anisotropy and NEAREST filtering
3 participants