Component type for paint in glb file

I get bad colors importing glb files (using the tiny_gltf library GitHub - syoyo/tinygltf: Header only C++11 tiny glTF 2.0 library)

Vertex paint is of type VEC3 in the json part of Nomad glb’s, in the actual data it seems to be of type VEC4 (3 floats + 1 zero). Import works fine if I edit the glb to VEC4.

Note it could also be a bug in the tiny_gltf library (which might be adding the extra 0) .

A good way to quickly test:

Concerning colors in layers, gltf-validator has a bug on their side (I told them so but I think they forgot about it). The khronos viewer had the same bug but it has been fixed.

Otherwise if it’s a recent Nomad file with no issue, yes it’s a bug in tinygltf.

VEC3 is the accessor, but it’s the “byteStride” that drives the padding between elements.
Plus, in Nomad’s case I export COLOR_0 in 16bit (not float) so the glTF spec forces me to add an extra padding element for 32 for alignment purpose.


Thanks! The bug is probably in the importer that used tinygltf. Reported here