Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import of gltf with blendshapes without tangents fails #86384

Closed
lyuma opened this issue Dec 21, 2023 · 3 comments · Fixed by #91372
Closed

Import of gltf with blendshapes without tangents fails #86384

lyuma opened this issue Dec 21, 2023 · 3 comments · Fixed by #91372

Comments

@lyuma
Copy link
Contributor

lyuma commented Dec 21, 2023

Tested versions

  • Not reproducible in 4.2beta5
  • Reproducible in 4.2beta6 through 4.2.1

System information

Godot v4.2.beta6 - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3090 (NVIDIA; 31.0.15.3713) - Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz (16 Threads)

Issue description

Importing a gltf file without tangents in the editor with Ensure Tangents unchecked will fail for all meshes containing blend shapes with the following error log:

  Blend shape format must match the main array format for Vertex, Normal and Tangent arrays.
  scene/resources/mesh.cpp:1802 - Condition "err != OK" is true.
  scene/resources/mesh.cpp:1923 - Index p_idx = -1 is out of bounds (surfaces.size() = 0).
  scene/resources/mesh.cpp:1943 - Index p_idx = -1 is out of bounds (surfaces.size() = 0).
  servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp:891 - Index p_shape = 0 is out of bounds ((int)mi->blend_weights.size() = 0).

The same thing happens at runtime. Since there is no option to enable Ensure Tangents for runtime that I can find, this is not possible to workaround for runtime import.

The issue affects the https://github.com/V-Sekai/godot-vrm/ project, however it happens with these models in the builtin gltf importer.

issues may be related:

Steps to reproduce

  1. Open the attached project.
  2. Clear the console and reimport Godette_vrm_v4.glb - this will produce errors.
  3. Open sample_scene.tscn and notice the models are all missing faces.
  4. Click play to run the project. This will run load_at_runtime_scene.tscn which loads a gltf at runtime. this is also missing the face and produces errors in the Debugger -> Errors tab.
  5. Optional: enable "Ensure Tangents" in the import dock and notice that the glb files now contain a face in the editor. This does not solve the runtime case.

Minimal reproduction project (MRP)

MeshTangents.zip

Adding an additional MRP from a companion issue #85960: https://github.com/godotengine/godot/files/13623984/resource_loader_test.zip

@lyuma
Copy link
Contributor Author

lyuma commented Dec 21, 2023

for runtime import, we found that using gltf_document.append_from_file(path, gltf_state, 8) works around the issue:

8 is the constant for EditorSceneFormatImporter.IMPORT_GENERATE_TANGENT_ARRAYS

Even though there is a workaround, I still think this is a bug: it only affects models with blend shapes.

@Calandiel
Copy link

Calandiel commented Jan 6, 2024

I think this is related to another issue I raised in #86698
Perhaps we could close the one I opened and add the MRP from it to this issue?

@clayjohn clayjohn moved this from Unassessed to Very Bad in 4.x Release Blockers Apr 28, 2024
@clayjohn clayjohn added this to the 4.3 milestone Apr 28, 2024
@clayjohn
Copy link
Member

I think this is related to another issue I raised in #86698 Perhaps we could close the one I opened and add the MRP from it to this issue?

#86698 is a different issue unfortunately, so we should leave it open

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Very Bad
Development

Successfully merging a pull request may close this issue.

3 participants