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

gltf: Fix validation errors due to chunk padding and empty skins. #54249

Merged
merged 1 commit into from
Oct 26, 2021

Conversation

lyuma
Copy link
Contributor

@lyuma lyuma commented Oct 26, 2021

Related to #51132

GLB chunk padding length calculation was backwards: The old code did % 4 which would give 1 byte of padding for a 1 byte chunk, and 3 bytes of padding for a 3 byte chunk.

Additionally, Godot was not adding any padding for the BIN chunk (nul bytes according to the spec),

See the relevant section of spec here: https://www.khronos.org/registry/glTF/specs/2.0/glTF-2.0.html#structured-json-content

Also fixed error caused by "skins":[] when no skins were present.

Validation errors fixed by this change:

GLB_CHUNK_LENGTH_UNALIGNED Length of 0x004e4942 chunk is not aligned to 4-byte boundaries.  
EMPTY_ENTITY Entity cannot be empty. /skins

Added a change to fix #54251 by encoding animations before textures.

Bugsquad edit: Fixes #51132, fixes #54251.

@fire
Copy link
Member

fire commented Oct 26, 2021

Does this fix #51132 ?

GLB chunk padding length calculation was backwards and missing for the BIN chunk.
Fixed error caused by "skins":[] when no skins were present.
Finally, encode animations before textures to avoid accessor misalignment due to texture byteLength.
@lyuma
Copy link
Contributor Author

lyuma commented Oct 26, 2021

Correct. It fixes #51132. I was just scared to say the magic words because github.

Also added a fix for #54251: animation accessor misalignment which I just filed to document the issue.

@akien-mga akien-mga added this to the 4.0 milestone Oct 26, 2021
@akien-mga akien-mga merged commit ba23ef9 into godotengine:master Oct 26, 2021
@akien-mga
Copy link
Member

Thanks!

@lyuma lyuma deleted the gltf_padding_fix branch May 19, 2023 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants