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

glTFast render shadow received by 3D model falsely when unity normal map encoding is DXT5nm on Android #694

Open
uncle-jerry opened this issue May 15, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@uncle-jerry
Copy link

Describe the bug
glTFast render shadow received by 3D model falsely when unity normal map encoding is DXT5nm on Android.

To Reproduce
Steps to reproduce the behavior:

  1. Set normal map encoding method to DXT5nm-style in Android Player Settings (which is default for Unity).
    image

Android (please complete the following information):

  • glTFast 6.4.0
  • Unity Editor version : 2021.3.26f1
  • Render Pipeline and version : Built-in
  • Platform: Android, Editor after switch build to Android
@uncle-jerry uncle-jerry added the bug Something isn't working label May 15, 2024
@HunterProduction
Copy link

I can confirm the problem. Switching back to XYZ encoding solves the issue.

@atteneder
Copy link
Owner

atteneder commented Jun 22, 2024

Thanks for reporting.

TIL: there's an alternative normal map encoding in Unity :)

Unfortunately glTF has XYZ normals on board (see glTF 2.0 spec). There's three solutions I can think of:

  1. Stick with XYZ. Proven to work (feel free to educate me what's the benefit of DXTnm. Appreciated)
  2. Convert XYZ normal map textures to NM textures at runtime. This would come at a certain performance cost though.
  3. Use NM normal maps in glTF, along with an extension that indicates that. I know, for example, that you can create two component normals KTX BasisLZ files (see --normal-mode parameter of the ktx CLI tool). Only a solution if you're in control of the glTFs and willing to edit them all.

In any case, a warning of some sorts would be helpful as well as a mention in the docs.

@atteneder atteneder added this to To do in glTFast development via automation Jun 22, 2024
@atteneder atteneder moved this from To do to Runtime Loading in glTFast development Jun 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Runtime Loading
glTFast development
Runtime Loading
Development

No branches or pull requests

3 participants