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

GPU implementation differences with texture anisotropy and NEAREST filtering #25067

Closed
hybridherbst opened this issue Dec 3, 2022 · 0 comments · Fixed by #25068
Closed

GPU implementation differences with texture anisotropy and NEAREST filtering #25067

hybridherbst opened this issue Dec 3, 2022 · 0 comments · Fixed by #25068

Comments

@hybridherbst
Copy link
Contributor

hybridherbst commented Dec 3, 2022

Describe the bug

Turns out #25015 has uncovered (not introduced!) a bug/inconsistency in drivers affecting three.js: when texture ansiotropy is != 1, the actual filtering mode is ignored in some implementations (but not others) and results in linear filtering being used. This is problematic for cases where NEAREST filtering was actually the intended result (e.g. pixel art). There doesn't seem to be a cross-platform way to get anisotropic NEAREST filtering; I can understand how that may be undefined.

More references:

Some comments from those:

The only thing we can recommend is avoiding them: use aniso only when it will give a desired quality boost vs plain LINEAR.

if you ask for anisotropic filtering but with NEAREST or maxAnisotropy = 1.0, you get what you get

So we'll probably want to avoid that anisotropy is ever used if the filtering is NEAREST.
I'm happy to make a PR: I would probably check here

To Reproduce

  • Set Texture.DEFAULT_ANISOTROPY to 4 (or set loaded texture's ansio to 4)
  • Load this texture with NEAREST filtering:
    pixelArt
  • or this glb which contains the same:
    PixelArt.zip

Expected behavior

Point filtering stays point filtering, even with anisotropy enabled, users shouldn't have to know about hardware implementation bugs.

Platform:

  • Device: [Desktop]
  • OS: [Windows]
  • Browser: [Chrome, Firefox, Safari, Edge]
  • Three.js version: [dev]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants