Set Connected Vertex Colors

I made small addon for Blender 2.83+ (2.83.0 - 4.2.0).
You can easily generate random vertex colors for connected meshes of object.
The grayscale color palette is also supported.
Optionally you can control by selection which part of model will be colored.

Usage:

  • fast controlled random coloring of model parts
  • simple generation of ID masks
  • creating random vertex colors for modifiers
  • creating random vertex colors for simulations
  • creating random vertex colors for particle generators
  • creating random vertex colors exported for other apps

The addon is free and if you like it, you can support me and my future projects at Gumroad

Addon download link: https://gum.co/PtjXN

Preview in action:
https://youtu.be/jrPNCjVst8Q

Changelog:

v1.1.0

  • Backwards compatibility starts with Blender 2.83
  • Compatibility with Blender 3.2+ Color Attributes
  • Added support for Vertex Domain Color Attributes
  • Huge performance boost by using Vertex Domain Color Attributes
  • Compatibility with Blender 4.2+
  • Adjusted Defaults
2 Likes

Is there a way to apply Random Vertex Color according to Material Assignment?

Say instead of random colors for each object in a mesh, instead you have one mesh with many materials already assigned. Is there to use that grouping to derive the random vertex colors?

This is practically not possible because the materials are assigned to the faces and the vertex colors to the vertices. If you split the edges, you can almost achieve this, but there may be some problems with the normals. If you want to use this add-on, it is best to split the mesh.

(Edited in 2024)
My answer was wrong. It’s possible, but the add-on doesn’t have that feature now.

Hi, since vertex_colors is deprecated I made a small update/change.
vertex_colors

From line 98 to 102

Old:

        vertex_colors_maps = mesh.vertex_colors
        if len(vertex_colors_maps) == 0:
            vertex_colors_maps.new(name="Connected")

        active_vertex_colors = mesh.vertex_colors.active.data

New:

        vertex_colors_maps = mesh.color_attributes
        if len(vertex_colors_maps) == 0:
            vertex_colors_maps.new(name="Connected", type="BYTE_COLOR", domain="CORNER")
        
        active_vertex_colors = mesh.color_attributes.active_color.data

I hope its ok, thanks for this addon.

SetConnectedVertexColors.py (4.5 KB)

Hey Konstantinos,
Vertex Colors API is deprecated, but it still works fine in current Blender versions. However, I’ve modified the Set Connected Vertex Colors add-on to support this new data structure introduced in Blender 3.2 with maintaining backwards compatibility with older Blender versions.
For better performance, I recommend using the Vertex Domain Color Attributes that the add-on creates by default if there is no active color attribute. Be aware that Blender’s Vertex Paint mode creates a Face Corner Color Attribute by default.
I’ve also added support for the new Extensions system, which is necessary for the latest version of Blender 4.2.
This new add-on version 1.1.0 is now available on my Gumroad for free.

1 Like