I have a model that was imported from an erronous file where each triangle was disconnected from the others. After "reconnecting" it via removing duplicate vertices and exporting (to .ply with vertex paint) I still have some disconnected pieces along the seam of a vertex paint stroke.

How do I connect these faces to the rest of the mesh?

To make it clear: Blender has it fully connected but the exported file does not because vertices are split.

The actual problem boils down to: How do I merge the vertex color of a vertex that has differing colors in its incident faces?


To avoid confusion: The mesh is fully connected inside Blender (if I select one vertex and then "select connected", all vertices/edges/faces are selected) after the "remove duplicates". However in the exported file the mesh is disconnected at the vertex paint stroke boundary.

Clearly visible seam of the vertex paint stroke splits the mesh

  • $\begingroup$ Keep in mind that all verts can be connected and you can still have duplicates. $\endgroup$ – gandalf3 Nov 14 '13 at 7:43
  • $\begingroup$ While that might be true for degenerate meshes the mesh I am handling right now has only exact duplicates and as such all of them should have been removed by the "remove duplicates" operation. $\endgroup$ – Nobody Nov 14 '13 at 7:44
  • $\begingroup$ However, note that there are visible cracks in the vertex painting which means that two triangles that have the same vertex have two differing vertex colors attached to it. $\endgroup$ – Nobody Nov 14 '13 at 7:53
  • $\begingroup$ Well, how am I supposed to note that if there is no image of it? ;) Perhaps you could upload some images or a .blend? $\endgroup$ – gandalf3 Nov 14 '13 at 7:57
  • $\begingroup$ @gandalf3: You are right I wanted to add an image but forgot it yesterday and now I have no access. I will try to add it later. $\endgroup$ – Nobody Nov 14 '13 at 7:59

There is a threshold value you can change when working with remove doubles.

There is two ways to change it. Both are (as blender standard) after you use the tool.

So first select all vertices (if you only want to join some, feel free to select a subset).

Separated cube with selected mesh

Now do Remove doubles. Probably nothing will happend because the threshold is way low by default. But in the toolbar (toggle it with T), at the bottom are the options for the last used tool. In this case it will look like this:

Remove doubles 1

Simply change the Merge distance to snap together the desired vertices.

Remove doubles 2

The second way to change this options is to press F6 directly after the tool. This brings up a dialog to do the same. It's a matter of personal taste what method you want to use. They are exactly the same in all other aspects.

F6 dialog

| improve this answer | |
  • $\begingroup$ Maybe my question was a bit confusing: I did the remove doubles with a sufficient threshold. The mesh is fully connected inside blender. But when I export it into a ply file with vertex paint enabled the resulting file has disconnected parts and the disconnection happens at the border of the vertex paint stroke. $\endgroup$ – Nobody Nov 14 '13 at 7:39

I think I understood your question wrong, I'm giving it another try:

In Blender, vertex colors aren't strictly what they say. If, for instance, you paint from a perspectve where you don't see a certain face, the vertex color is set 'only for the faces you see'. You can even restrict the vertex paint to certain faces, just by unchecking the 'all faces' option in the tool shelf.

This is quite a special behaviour of Blender, as one vertex can "have several colors at the same time" this way.

Exporters don't like this, because they have to give a vertex one single color, just as the data format exspects. The workaround for the exporter is: to split up the vertex in two (or more), and give each one it's appropriate color.

What you can do against it:

paint the vertex again, and make sure that none of the adjacent faces are invisible for perspective reasons.... in other words: rotate the mesh so that the vertex points at you and, after painting, check that there's no hard color transition on any edge. You can also try a "smooth" brush to fix things.

Best greetings, Michael

| improve this answer | |
  • $\begingroup$ You described exactly what is my understanding of the problem. However, I was searching for a better solution than: Just paint it correctly by hand. Not only is it tedious but I am also not able to see if everything went as it should. Is there any tool that automagically sets the same color on each corner (a vertex in a face) that belongs to the same vertex? $\endgroup$ – Nobody Nov 14 '13 at 21:36
  • $\begingroup$ Yes, you're right. The vertex painting functionality is a little basic, and I've spent way too much time painting away such problems... I think it could be solved by a python script, but I'm afraid I'm don't know the api well enough to know how. $\endgroup$ – Mayqel Nov 15 '13 at 19:10

After the conversation with Mayqel I decided to roll my own Addon for this problem. Here is the Code:

bl_info = {
"name" : "Vertex Paint Merger",
"description" : "Merges differing colors per face on one vertex into one",
"author" : "Nobody",
"version" : (1, 0),
"category" : "Mesh"

import bpy
from mathutils import Color

def mapColorsToOne(colors):
    if colors:
        return sum(colors, Color()) / len(colors)
        return Color()

class MergeVertexColors(bpy.types.Operator):
    bl_idname = "object.merge_vertex_colors"
    bl_label = "Merge Vertex Colors"
    bl_options = {'REGISTER', 'UNDO'}

    def execute(self, context):
        scene = context.scene
        for obj in scene.objects:
            #only work on meshes
            if obj != None and obj.type == 'MESH':
                me = obj.data
                #skip meshes without vertex colors
                if 'Col' in me.vertex_colors:
                    vColors = me.vertex_colors['Col'].data
                    colors = [[] for i in range(len(me.vertices))]
                    #gather the loops' colors on vertices
                    for loop in me.loops:
                    #average the colors
                    colors = list(map(mapColorsToOne, colors))
                    #distribute the new color to all participating loops
                    for loop in me.loops:
                        if me.vertices[loop.vertex_index].select:
                            vColors[loop.index].color = colors[loop.vertex_index]
        return {'FINISHED'}

def register():

def unregister():

if __name__ == "__main__":

All it does is accumulate all colors that are registered for one vertex and then call mapColorsToOne with a list of all those colors and stores the result on the vertex. Currently the average is used but basically anything that maps the input colors to one output.

This transformation is only applied to selected vertices.

The function can be found under "Merge Vertex Colors".

| improve this answer | |

The reason why the mesh gets disconnected has to do with the conventions of storing vertex color in many file formats and rendering systems. It is because you applied vertex color with a mask (or used your camera to hide the other faces). Because the underlying file can only store a color per vertex, it needs to split the faces and duplicate the vertex so it can store the disparate vertex colors for the two different adjoining faces. Blender doesn't represent it this way internally so you still see your vertices connected the way you want.

I think you basically have a black-and-white choice here -- do you want the faces to be connected or do you want the colors to be disjointed.

| improve this answer | |
  • $\begingroup$ You are right. My question actually is how to make the choice for letting the faces be connected. As far as I saw there was no possibility to draw on the vertices (form certain angles) without making them disconnected. $\endgroup$ – Nobody Mar 1 '15 at 16:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.