Skip to content

Commit cf8ef76

Browse files
load zeroed UVs as fallback in gltf loader (#1803)
fixes a lot of gltf loading failures (see #1802)
1 parent 73ae6af commit cf8ef76

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

crates/bevy_gltf/src/loader.rs

+5
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,11 @@ async fn load_gltf<'a, 'b>(
140140
.map(|v| VertexAttributeValues::Float32x2(v.into_f32().collect()))
141141
{
142142
mesh.set_attribute(Mesh::ATTRIBUTE_UV_0, vertex_attribute);
143+
} else {
144+
let len = mesh.count_vertices();
145+
let uvs = vec![[0.0, 0.0]; len];
146+
bevy_log::debug!("missing `TEXCOORD_0` vertex attribute, loading zeroed out UVs");
147+
mesh.set_attribute(Mesh::ATTRIBUTE_UV_0, uvs);
143148
}
144149

145150
if let Some(vertex_attribute) = reader

0 commit comments

Comments
 (0)