bevyengine / bevy

A refreshingly simple data-driven game engine built in Rust
https://bevyengine.org
Apache License 2.0
33.47k stars 3.26k forks source link

Textures not displaying properly if normal/base texture transforms don't align #13484

Open GitGhillie opened 1 month ago

GitGhillie commented 1 month ago

Bevy version

latest main (4dbfdcf)

Relevant system information

Windows 10

AdapterInfo { name: "AMD Radeon RX 7900 XT", vendor: 4098, device: 29772, device_type: DiscreteGpu, driver: "", driver_info: "", backend: Dx12 }

What you did

Export object from Unreal to gltf, with texture transforms enabled. Load gltf with Bevy.

What went wrong

Using a gltf viewer it looks good: image However, in Bevy things look severely distorted: image

Additional information

I've trimmed down the gltf and made a reproduction here: https://github.com/GitGhillie/bevy_repro/tree/broken-texture. In Blender the shader for the material looks like this: image If you remove the Mapping node or copy it to the normal map such that both have equal transforms, everything looks as expected (except you destroy the art in the process).

There is a note in https://github.com/bevyengine/bevy/pull/11904 saying "Note the gltf crate doesn't expose the texture transform for the normal and occlusion textures, which it should, so I just ignored those for now". I'm 90% sure that's the issue but I don't have the experience to say for sure.

janhohenheim commented 5 days ago

Yep, pretty sure the missing fields in the gltf crate are at fault here. Marking as blocked for now.

GitGhillie commented 4 days ago

This one right? https://github.com/gltf-rs/gltf/pull/412

janhohenheim commented 4 days ago

Exactly. Thanks for linking :)