picklejar76 / kujata

Translates Final Fantasy 7 assets to web-friendly formats like JSON and glTF
https://picklejar76.github.io/kujata-webapp/
20 stars 4 forks source link

Exported GLTFs don't match GLTF spec #13

Open Runeii opened 5 years ago

Runeii commented 5 years ago

Great tool, works really well with Three.js. However, I'm currently trying to migrate over to Babylon.js and it seems to be a bit stricter on how it handles GLTF files.

It's outputting the following error:

Unable to load from ./model/aaaa.hrc.gltf: attempting to construct out-of-bounds TypedArray on ArrayBuffer

From a bit of digging, it looks like this happens when an accessor with type VEC3 uses a buffer view with a non-multiple-of-4 byte offset. As per the spec:

For performance and compatibility reasons, vertex attributes must be aligned to 4-byte boundaries inside bufferView (i.e., accessor.byteOffset and bufferView.byteStride must be multiples of 4).

I'd be happy to take a look at fixing this, but don't actually have a copy of the source files to hand to test it. Wanted to flag it, incase it was something you were aware of/were able to easily fix.

Thanks again.

picklejar76 commented 5 years ago

Nice catch! Thanks for taking the time to troubleshoot the root cause. I should add more validation; currently I'm just trying it in three.js but I guess that's not as strict. Sorry for the slow response, I'm taking a break from this project, and I'm not sure when I will get around to fixing it, but if/when I resume, I'll see if I can fix it.

Thanks again for taking the time to write this issue!