GLTF import and shaders - Multiple vertex color support (at some point)?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By GodotRobot

Wanted to see if we could get a COLOR_1, COLOR_2, COLOR_3 etc intrinsic shader variables for multiple vertex colors.

In looking at GLTF specs, it appears that vertex color can be an array like COLOR_0, COLOR_1, etc

If this is in fact true (GLTF supports multiple vertex colors), then I wanted to suggest the possibility of getting support in godot (at some point when funding available) for multiple vertex colors such that a shader program can make use of them as masks.

I hope this makes sense as I wrote it, but using Blender as an example, if you made multiple vertex paints, for instance, for some greyscale to use as masks in shader node graph. I’m not actually sure if blender exports all of them … (maybe)

But anyways, this would give shaders extra layering support without having to throw a pixel based texture at it (in a way where it can be painted and used as a 3d unpixelated mask).

I would think the industry would support this in general, but my knowledge of 3d is still fairly limited at this point in time. Is there something I’m overlooking here?

Actually, in thinking of this, there really are 4 “inherent” masks the COLOR field if the color isn’t itself isn’t used from the meshes vertex color.

Otherwise, another solution would be to use the decimal places (thinking logically - I know it’s 0-1 scale, but if converted to 0-255 scale, then take decimals) for more masks (if you have a program that would support such encoding). That way could be used in any shader regardless of how many vertex colors available. Idk, something like that could be done now with a blender plugin to export color values in such a way from multiple masks.

All that said (it can be done with right values), it would be real nice to have COLOR_1, COLOR_2, COLOR_3, etc

GodotRobot | 2022-01-02 11:58

I managed to use a second vertex color by converting them to uv and uv2 on blender.
uv1[0] =
uv1[1] =
uv2[0] =
On Godot, I made a shader that used the two uvs.

I tried your solution on the alpha but the values were getting messed up due to the forced linear color conversion.

admin | 2022-03-27 20:41