New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vertex colors not loaded in Gltf models #1871
Comments
at least with prb material you have to set BaseColor to vec4(1,1,1,1) if you want vertex color only. not at the pc so i cant test. looked at the shader code //add: seems should be 1,1,1,1 by default. |
I can confirm it is not working. Tried it with Unsahded, Lighting and PBRLighting materials but could not get vertex colors to work in any of them. I can confirm mesh has a color buffer on it. for unshaded material I used
for lighting material I used:
|
GLTF issues aside, I can assure you 100% that vertex colors work in the engine, definitely for Unshaded.j3md because I use that one all the time (unless it was broken very recently). So to whomever is looking at this, it would be worth checking what's in the color buffer. |
What's a colour buffer, and where would I find 'Unshaded.j3md'? |
Yeah, looks like buffer is corrupted. All of them are set to:
The gltf file can be viewed correctly without error on online viewers, so probably an issue with GltfLoader! |
I figured this change in gltf blender addon broked GltfLoader. KhronosGroup/glTF-Blender-IO#1169 If I revert that change I can successfully load vertex colors in JME. |
Lovely. Is there something in the GLTF that indicates the bad version versus the good version? Or are we stuck having to do some odd detection to find these cases? Either way, nice of them to break this for everyone. (Or maybe JME is reading these values in a dumb way. 50/50 chance.) |
Well, I guess it is detectable based on buffer type. In the old one, the vertex data was exported as a float buffer
jmonkeyengine/jme3-plugins/src/gltf/java/com/jme3/scene/plugins/gltf/GltfUtils.java Lines 98 to 99 in a2d639c
after the change, it is now exported as unsigned short buffer
jmonkeyengine/jme3-plugins/src/gltf/java/com/jme3/scene/plugins/gltf/GltfUtils.java Lines 94 to 95 in a2d639c
there is already a check in GltfLoader to unpack short back to a float buffer but it seems something goes wrong down the road. jmonkeyengine/jme3-plugins/src/gltf/java/com/jme3/scene/plugins/gltf/GltfLoader.java Lines 1293 to 1298 in a2d639c
|
I got this fixed, I'll submit a PR shortly. |
re: "Or maybe JME is reading these values in a dumb way. 50/50 chance." Edit: (and seems like it was probably a copy-pasta issue.) |
Fix #1871 (vertex colors not loaded in gltf models)
Thank you @Abstrusle for taking the time to report this. GLTF pipeline is very important and as such I'd say this bug is high priority level. |
Models coloured through vertex colours are not properly rendered in the application; various attempts in altering the formats and materials have resulted in null results. If a material isn't specified, the model is wholly white. Using the lighting material, even with "UseVertexColor" it's wholly black without details.
The following code is without utilizing any material, but it may be altered to set the 'Lighting.j3md' material. "UseVertexColor" does not appear to function as intended.
The model file is available here, for testing:
TestModel.zip
The text was updated successfully, but these errors were encountered: