godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
89.57k stars 20.54k forks source link

Validation for gltf export fails #47120

Closed fire closed 2 years ago

fire commented 3 years ago

Godot version: https://github.com/godotengine/godot/commit/e57f6e2cca90d4c9e956fe1a7ddb3ca086521b42

OS/device including version: Nvidia RTX 3000 series on win 10

Issue description: glTF2 export should be loadable in Blender.

Steps to reproduce:

https://genshin.mihoyo.com/ja/news/detail/5885 Open lumine.

Load into Blender.

Install cats plugin.

Load mmd and click on the morph section to filter.

Convert material from mmd material to principled gltf.

Export as gltf.

Import into godot.

Export as glb.

Fail validation via https://github.khronos.org/glTF-Validator/.

Minimal reproduction project:

GLB that is export from Godot Engine.

mihoyo_lumine.zip

Godot Project.

Mihoyo Lumine Project.zip

mihoyo_lumine_report.zip

fire commented 3 years ago
            {
                "code": "GLB_CHUNK_LENGTH_UNALIGNED",
                "message": "Length of 0x004e4942 chunk is not aligned to 4-byte boundaries.",
                "severity": 0,
                "offset": 187164
            },
            {
                "code": "MESH_PRIMITIVE_ATTRIBUTES_ACCESSOR_INVALID_FORMAT",
                "message": "Invalid accessor format '{VEC4, FLOAT}' for this attribute semantic. Must be one of ('{VEC3, FLOAT}').",
                "severity": 0,
                "pointer": "/meshes/0/primitives/0/targets/0/TANGENT"
            },
  1. chunk is not aligned to 4-byte boundaries
  2. tangents are vec3
lyuma commented 2 years ago

The only validation error is this, repeated once per vertex:

            {
                "code": "ACCESSOR_WEIGHTS_NON_NORMALIZED",
                "message": "Weights accessor elements (at indices 0..3) have non-normalized sum: 0.9999849796295166.",
                "severity": 0,
                "pointer": "/meshes/0/primitives/0/attributes/WEIGHTS_0"
            },

I believe this is caused by the compression or quantization Godot uses on its in-memory format. 0.99998 seems close enough that it really shouldn't be an error, so I do not think this issue needs to be fixed...

But, if we feel this should be fixed, it could be by dividing by the sum of the weights on export as well (currently we only do this on import).

fire commented 2 years ago

Fixed by https://github.com/godotengine/godot/pull/54249