From c2c80dd8aadadf2f22851e76a998f5ed5b1fddde Mon Sep 17 00:00:00 2001 From: Jakob Hellermann Date: Thu, 6 May 2021 03:08:53 +0000 Subject: [PATCH] load zeroed UVs as fallback in gltf loader (#1803) fixes a lot of gltf loading failures (see https://github.com/bevyengine/bevy/issues/1802) --- crates/bevy_gltf/src/loader.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/bevy_gltf/src/loader.rs b/crates/bevy_gltf/src/loader.rs index 1687569e314c9e..75e76077a58502 100644 --- a/crates/bevy_gltf/src/loader.rs +++ b/crates/bevy_gltf/src/loader.rs @@ -140,6 +140,11 @@ async fn load_gltf<'a, 'b>( .map(|v| VertexAttributeValues::Float32x2(v.into_f32().collect())) { mesh.set_attribute(Mesh::ATTRIBUTE_UV_0, vertex_attribute); + } else { + let len = mesh.count_vertices(); + let uvs = vec![[0.0, 0.0]; len]; + bevy_log::debug!("missing `TEXCOORD_0` vertex attribute, loading zeroed out UVs"); + mesh.set_attribute(Mesh::ATTRIBUTE_UV_0, uvs); } if let Some(vertex_attribute) = reader