atteneder / glTFast

Efficient glTF 3D import / export package for Unity
Other
1.24k stars 251 forks source link

Material Appearance Discrepancy between Windows and Android on glTFast #673

Open wangyanmeego opened 9 months ago

wangyanmeego commented 9 months ago

Description

There is a noticeable difference in the appearance of materials when viewing them on Windows versus Android platforms using glTFast. On Windows, the materials appear correctly. However, on Android, it looks like there's a layer of fog over the object's surface, which is not intended and differs from the expected rendering.

Steps to Reproduce

  1. Import a glTF model using glTFast in a Unity project.
  2. Build and run the application on a Windows machine.
  3. Observe the material rendering, which appears correct.
  4. Build and run the same application on an Android device.
  5. Notice the difference in material appearance, resembling a foggy overlay on the object's surface.

the image on windows: gltfast-rendering-in-windows

the image on Android: gltfast-rendering-in-android

wangyanmeego commented 9 months ago

Test on glTFast 5.0.0 and glTFast 6.0.1,Rendering Pipeline is URP 12.

wangyanmeego commented 9 months ago

Finally, I found the cause of the problem and tried methods to solve it. It was caused by normal map sampling, we were using the SampleTexture2D node to sample the normal map texture, which was not a problem in Windows, but would cause errors when switching to the Android platform, this should be a bug of Unity. I tried to change the node for sampling the normal map texture from SampleTexture2D to NormalFromTexture, and the result was that there was no problem. image

atteneder commented 4 months ago

Hi,

Is it possible that you've been using DXTnm normal map encoding on Android? That would certainly explain the problem, as glTF normal maps are always XYZ.

See #553