Is there a way to use vertex coloring on only part of a mesh?

I am working on a small kit of meshes that can be combined to create modular weapons, such as this one.

image

I want different teams to be able to use the same weapons, but for each team the weapon will be recolored to that team’s color. Normally I use vertex coloring in Blender, where I give certain parts of the mesh a darker or lighter shade and then I can recolor the mesh in studio. This approach has limited functionality however, as recoloring the mesh in studio will affect the whole mesh, as seen in the image below.

image

This behavior is not desired if I want to make weapons I can recolor. I would like certain parts to have a consistent color that is not affected by the mesh’s color in studio. So in a way I would like to ‘lock’ the color of certain parts of the mesh.

One solution would be to split the mesh into multiple parts so I can pick the color for each part individually. However, the weapons will already be created by combining smaller meshes, so this would get very messy.

Is there a way to make it so recoloring the mesh in studio will only recolor a certain section of the mesh?

As far as I am aware, this is not possible. However, what might work is having one texture with a color palette, including a transparent square, and uv unwrap your mesh to this texture. Any section of the mesh that you want to be affected by the part’s color would be mapped to the transparent section of the texture. Then all you’d need to do is use a SurfaceAppearance object on your mesh with its AlphaMode set to Overlay and its ColorMap set to the color palette texture.

I haven’t personally tested this, but I believe it would accomplish what you are wanting.

1 Like

Worked like a charm, thank you!

Not to mention that I can now also reuse this texture for many different meshes.

1 Like