Can one access vertex colors when using `*.blend` extension?

Godot Version

4.5.1

Question

I am trying to access the vertex colors of a mesh i made in blender in a shader.
This is the mesh I have applied the colors to (mostly just to test if this works at all)


This works pretty well when exporting it as an *.obj file. Unfortunately, obj export is not enough for my usecase, as I also want to use the CUSTOM0, CUSTOM1, [...] additional vertex info for texture blending ontop of baked vertex lighting from blender.
With the *.blend exported file, the vertex colors are simply white:

Both objects have this material_override ShaderMaterial applied:

shader_type spatial;


varying vec4 VERT_COLOR;

void vertex() {
	VERT_COLOR = COLOR;
}

void fragment() {
	ALBEDO = VERT_COLOR.rgb;
}

I also tried exporting to *.gltf (which ended up as a *.glb instead) and that one was missing the colors too, just like *.blend.

What’s your vertex color export setting in gltf export options?

interesting! i had all the checkboxes checked, but now i switched the “use vertex colors” dropdown to active:


which always selects the currently viewed vertex colors in this field

(indicated by the camera icon).

So now vertex colors work for *.gltf files, just like for *.objs!

Thank you for bringing those settings to my attention!

Does the gltf format also support exporting multiple color attributes (like seen in the image above, the second color attribute Color)?

I haven’t used it in practice but I think it should support it. Also note that .blend importing just does gltf export/import under the hood by invoking Blender without the gui.