mgsx-dev/gdx-gltf

Error loading vertex-attribute-colors of all Blender-exported GLTF models

PrimevalAngel opened this issue · 3 comments

  1. If I use Vertex Paint in Blender 2.91.0 to color my model, and export it as GLTF, the rendered colors are very wrong (either red, blue, magenta or black, instead of tints of orange, green, etc.).
  2. If I use a model with vertex colors, downloaded from Google Poly (which offers 2 GLTF versions for download: https://poly.google.com/view/d6STyhH76Qe), the model is rendered with the correct colors (green). But if I import it in Blender and just export it as GLTF without modifying it, the Blender-exported model is rendered with some magenta colors, instead of green. Trying to debug the issue, it seems some of the a_color floats in the mesh are NaN(!). This is the first vertex color (4 floats) loaded by this gdx-gltf library into the Mesh vertices:
    -original model: 0.26317474, 0.5542271, 0.065753885, 1.0
    -same Blender-exported model: -6.417576E-31, NaN, -6.417576E-31, NaN

Blender_color_vertex_attribute_error_test_model.zip

I need my models with vertex colors. How do I fix this?

Thank you for the detailed report. I'm able to reproduce the issue with recent Blender versions. Blender GLTF exporter changed the way they store vertex color, before it was 4 floats, now it's 4 unsigned shorts. This format is not supported by gdx-gltf right now. I'll try to fix it ASAP.

It should be OK now, let me know if it's OK for you.

I confirm it works ok for me as well. Thank you so much for the quick fix!