0 votes

In Blender (2.79), I can assign multiple sets of vertex colors to a single mesh. My current workflow is exporting as Collada (.dae) to import into Godot. From cracking open the .dae file in a text editor at least, I can see it correctly stores however many sets of vertex color data I've applied, complete with the proper names that I've set in Blender. But in Godot's shader language however, it doesn't look like there's a way to specify these separate sets?

void fragment() {
    // Assign vertex color to albedo color
    ALBEDO = COLOR.rgb;
}

In my experiments, the COLOR keyword only ever draws from the last set of vertex colors that were added in Blender. And unlike how we're given both UV and UV2 to differentiate multiple UV layers/unwraps, it seems there's no way to specify which of multiple sets of vertex colors that Godot draws from. This means that any other set other than the very last is inaccessible. Is there a way to access them that I'm missing here?

in Engine by (12 points)

1 Answer

+1 vote

Hi,
no, you cant. Godot only allows 1 set of vertex colors.

This is of what a Godot mesh is made of:

ARRAYVERTEX = 0 --- Array of vertices.
ARRAY
NORMAL = 1 --- Array of normals.
ARRAYTANGENT = 2 --- Array of tangents as an array of floats, 4 floats per tangent.
ARRAY
COLOR = 3 --- Array of colors.
ARRAYTEXUV = 4 --- Array of UV coordinates.
ARRAYTEXUV2 = 5 --- Array of second set of UV coordinates.
ARRAYBONES = 6 --- Array of bone data.
ARRAY
WEIGHTS = 7 --- Array of weights.
ARRAY_INDEX = 8 --- Array of indices.

you see ... two sets of uv data only one color

And no, you cant change or customize that, its a core component of the engine.
You can allways store additional data into textures. Blender also can bake into textures, so maybe this is your way to go.

by (3,922 points)

Huh... well that sucks. Thank you for the informative answer though! XD

I'm going for a very specific, N64-esque styling, where a single texture is multiplied over a vertex color. The idea was to have separate sets of vertex colors for times of day, such as day and night, and interpolating between the two sets to forego realtime lighting altogether. For that reason I'd rather avoid having to bake in and include separate lighting textures and UVs.

I wonder if it's possible to export two versions of the same mesh, each with its own set of unique vertex colors, and use a shader on one to draw from the color data from the other? Though I'm not sure if there's a way to access a separate mesh in the shader of another...

Hi

possible to export two versions of the same mesh, each with its own set of unique vertex colors, and use a shader on one to draw from the color data from the other?

No thats not possible

I suggest what you want is vertex lighting, Wich is allready built in. Just hit the Vertex lighting flag under flags in the spatial shader. You can then use the build in lights and change there color and intensity for your day and night cycle.

And dont worry for performance, you dont have to bake those informations into a color channel. Even on the lowest end hardeware vertexlighting is insanly fast.

Baking the lighting into a vertex is although not working for anything that rotates in the scene.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.