bevy
bevy copied to clipboard
Gltf texture not rendering properly
Bevy version
Bevy main.
AdapterInfo { name: "NVIDIA GeForce 3060", device_type: DiscreteGpu, }
What you did
Tried to use a glb scene exported from unreal.
What went wrong
I tried to use it in bevy and the textures looks odd. Have tried in scene-viewer as well. But in GLTF viewer & blender it works well.
Additional information
In bevy:
In GLTF viewer
Can you upload the glb file as an attachment to this issue so we can reproduce and investigate? You may need to zip it first.
The link to file https://github.com/hchockarprasad/trybv/blob/main/assets/wall.glb
You can make better image (I mean colors) if you play with key L (which switches animation of light direction) in bevy scene viewer, because darkness of wall is light problem. Looks like issue problem relates to coordinates of texture (uv?)
And if you export this glb to gltf (by blender for example), you will see, that texture is same as in bevy scene viewer
some how blender knows that not all texture should be placed on face surface, but only quarter
I ensured that no KHR_texture_transform extension in this file. Blender plugin doesnt see it also. gltf crate inside bevy reads TEX_COORS without modifications (it's equal to coresponding buffer data from exported bin-file after read). Looks like some postprocessing is missing. For this file exact quarter .map(|[u, v]| [u / 2.0 + 0.5, v / 2.0]) works pretty well but is too strange and ugly.
The glTF Validator reports TEXCOORD_0 is not used. The materials in that file are using TEXCOORD_1 instead. But the gltf loader ignores that: https://github.com/bevyengine/bevy/blob/ade70b3925b27f76b669ac5fd9e2c31f824d7667/crates/bevy_gltf/src/loader.rs#L825
Because bevy_pbr always uses TEXCOORD_0 for all textures (except for lightmaps).
Got such view with #13153 change