GLTF Vertex Colors


I am wondering how BabylonJS is handling draco compressed GLTF Files. There seems to be an issue with vertex colors. I have been compressing my GLTF file with gltf-pipeline and the result is viewable in gltf-viewer by donmccurdy, but not in babylonjs. Vertex Colors are enabled on the mesh in babylon. Vertex Alpha is not enabled by default, but changing it, does not make a difference.

If you want to try out the file, you can download the zip containing the draco compressed Example.glb and the uncompressed ExampleCompressed.glb (274.3 KB)

Adding @bghgary

This looks awfully similar to this issue: Lighting issue with draco compressed mesh - Bugs - Babylon.js

Can you see if you’ve marked the vertex colors as float data in gltf-pipeline? If so, there is supposedly a way to not do that, and then it will work properly.

The vertex colors need to be set as floating point when the initial glb is made (in Blender in this case). There isn’t an option in gltf-pipeline (that I could find) to change it after the fact.

Oh, I thought it was gltf-pipeline. It seems like a bug in gltf-pipeline if it outputs bad gltf files then

Edit: Or maybe the output from blender was already bad, in which case the blender exporter needs a fix.

I think it must be at Blenders end. When I export the asset from blender with draco compression, the same issue appears. So either Blender is using wrong vertex colors on export and both gltf-pipeline as well as blender internal draco compression compress it wrong or both compression algorithms handle the vertex color wrong. I guess its rather an issue of Blender export.

I will look more into it. But is there an option in blender to change vertex colors to floating points?

As stated here Blender is exporting UInt16Array and not Float32Array - so its the the Blender exporter. The link shows a workaround.