Select face by texture color

Hi Blender community.

I apologise as I’m a bit of a newbie, and after wasting quite some time trying to figure out if what I’m attempting is possible, and seeing no solutions online I thought I would post.

I have one joined mesh, which is some building geometry imported from google earth. The mesh has been unwrapped and all of the textures from the building elevations have been combined into one large, combined texture. I am trying to see if it’s possible, to select the specific faces of a mesh, based on the color information of their texture (specifically in this case when it is one texture that has lots of color information in it). This would be by RGB or similar. For example, in this case, some of the buildings have a yellow brick texture as shown in the image, and I would like to select just the faces of the mesh, that have that color. If I select a face, select similar by material, it selects the whole model as it is one material.

Is this theoretically possible and could someone point me in the right direction if so? I’ve thought maybe its possible with a python script in blender, or maybe taking the mesh into Meshlab and filtering to faces by color, but i can’t get that to work either. Any guidance would be greatly appreciated. Thank you.

This one seems like a fairly tricky request, which may mean that I’m not the best person to respond, but I can give you some thoughts, or possibilities.

1 - The color you want to select and the faces it is on are not a 1:1 match, there will be some faces that are completely yellow, and others that will have only a small amount, do you want to end up selecting every face that has even a small amount of yellow, or do you only want to select the faces that are all yellow?

2 - Blender doesn’t really have ‘Select by Color’ or really any Image Editing selections whatsoever, so if you wanted that kind of feature you could edit the image in another program and output a mask that Blender could understand more easily. (Still not sure how that would work)

3 - As you noted, Blender can use Python scripts, which could add in features like ‘Select by Color’ using a library like OpenCV.

Theoretically, I think you could run an OpenCV color detection script that could examine the active image in Blender, note the screen coordinates of all the hits and then run function that uses those coordinates to make selections in the UV Editor.

I haven’t done this, and there may be a better way, but this is the only thing that has occurred to me so far!

Good luck, hopefully someone else can weigh in, too!

Thank you SpectralVectors.

I had thought about something similar; taking the full texture into Photoshop or Gimp and then selecting by colour range (or similar) and creating new textures as masks which I could then import, after which point i would create a script to see if the faces fall within the scope of each texture layer, as one possible option.

As a newb though, I thought that there might be some other way to do this that I wasn’t aware of, as the above seems like total overkill, if it needs to be done each time I want to do this process.

I may look to do it another way… as I’m trying to divide up meshes from lidar scans or point cloud data, it is likely easier to write a script to compare and select things by normal values or something. But yes, if anyone else can pitch in, I’m all ears.

Thanks again.