Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

V-Optimizer

Mesh optimizer for MagicaVoxel, Goxel and Kenshape files · By Vailor1

GLB_CHUNK_LENGTH_UNALIGNED error on GLTF files...

A topic by 2indy created Jan 13, 2023 Views: 275 Replies: 5
Viewing posts 1 to 8

Hi,

You've made a pretty fantastic tool here - much appreciated! 

I'm receiving the following GLTF validation error from about 50% of the optimised GLB files originating from Goxel files. 

  "code": "GLB_CHUNK_LENGTH_UNALIGNED",                 "message": "Length of 0x4e4f534a chunk is not aligned to 4-byte boundaries.",

It's a pity I can't attached an example file for you to examine, however it should be pretty easy to replicate considering how frequently I'm seeing the error.

If you provide your email address I'm happy to send you an example file!

Cheers!

Developer (2 edits)

Hi,

thanks for the bug report. If you could upload the file(s) at this link, would be nice. As a disclaimer I will use the files to fix the bug and then I will delete all files.

P.S.: Which program/game engine gave this error?

Cheers!

Vailor1

Hi Vailor1,

I've submitted the GOX file via the link above as requested. When this GOX file is optimized (either standard or greedy algos) & saved to GLTF or GLB- the resulting file is invalid file to  due to misalignment with 4 byte boundaries (more details below). You can verify that the file is invalid here: https://github.khronos.org/glTF-Validator/

I'm receiving this error when loading the GLB via Pixi3D (pixi3d.org), however I've noted that this error isn't handled the same in libraries such as Three.JS because contributors have "softened" reading the GLTF file-format because many GLTF exporters (including Blender) early on ignored the 4 byte boundary rule.

In the case you're not across what this means - to save you some time here is the link to the spec: https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html. Details on data-alignment can be found under section 3.6.2.4 (Data Alignment) where it's stated: "For performance and compatibility reasons, each element of a vertex attribute MUST be aligned to 4-byte boundaries inside a bufferView (i.e., accessor.byteOffset and bufferView.byteStride MUST be multiples of 4)."

I've found a hacky & painful workaround by loading the exported model into the ThreeJS web editor and exporting from here; it works - however this creates other issues and warnings - so it's not ideal by any means. Right now this is my go-to-solution, and I'd *really* appreciate a fix for v-optimiser - it would make life much easier ATM. :-) 

Anyhow, thanks very much for your quick reply - hopefully it all makes sense to you!

Cheers,

-R

Developer

Hi,

I fixed the alignment issue. The new version 0.0.6 contains the fix. If the problem persists, please report it to me.

Cheers!

Vailor1

Great news! Thanks very much!

Cheers!

-R

Developer

You're welcome!

Developer archived this topic
Developer unarchived this topic