select face by vertex color

can anyone help me find a way to select the face of an object by vertex color

Welcome to BA :slight_smile:
While not possible in vanilla Blender, there are some workarounds. For example, this script:

Or this, updated, script:

There’s also this add-on:

And this add-on:

Of the two add-ons, the second one will probably work better, as the first one seems to be having some kind of error, and the second one is a 2.8+ specific fork.

thanks Joseph for such a good welcome in the community!!!
I’m trying to select polygons with a specific color!! I want to note that object is imported from quill.and therefore I want to give different shaders to different parts!

i tried your script and nothing happens :((( maybe i’m doing something wrong

image

P.S.
this add-on is not active for purchase

That’s unfortunate :thinking: I haven’t actually personally used that script, I will download it and give it a shot, see if I can figure it out.

this ball is an example! Let’s say I want to delete green objects!

ball_color.blend (3.0 MB)

maybe I can get the vertex color using the geometry nodes? @joseph

I’m sure you can try :slight_smile:

trying to find it! but no results :frowning:

In case anyone else stumbles across this thread :slight_smile:
In 3.6.3 at least, in Geometry Nodes

Add-> Geometry-> Read-> Named Attribute

allows access to ā€˜Col’ or any piece of data in your model’s spreadsheet.

Two years later, none of these links work or produce a result in Blender 4.0… :face_with_diagonal_mouth:

I don’t think geo nodes solutions work for me, because I just need a selection.

You can totally use a GN tool for that:


Good luck.

Ah right, the new tools… ok, but regardless if I input ā€œColā€ as suggested above or ā€œAttributeā€ as some other places I found suggest, the following setup always selects everything:

Anyone know what I am doing wrong?

Also, sharing this involves a number of extra steps (and even requires an add-on like this just to save the node only to a new file, right?)… but attempting to modify those python scripts are even more difficult… I tried looking up bmesh but it’s above my head so far.

Go read this.

You can’t use Attribute statistics in this case as it outputs a constant and you need fields.

What’s wrong with my suggestion?

I didn’t notice that Attribute Statistic didn’t have field outputs (since it has field inputs)… and Capture Attribute doesn’t seem to have the inputs required.

Your suggestion doesn’t grab the target color from the selection, I think? Besides, I don’t like the convoluted process of sharing and re-using geometry nodes. Maybe if they could be saved in the equivalent of a .gn file (like with .py).

But I’m not doing too well in Python either… loops.layers.color.items in Bmesh/BMFace seems to have 0 length even though I have baked down a color attribute on my mesh and I can see it in both the details panel and the viewport.

I was doing some code hacking with python a few months ago involving vertex color assignment; I’ll see if I can backtrack my findings on that and see if selection was something I’d worked out.

(I definitely would want to avoid resorting to geonodes for such a thing.)

ETA - you might find this useful.

Ok, finally managed to make this…

Some notes for anyone who finds this in the future:

  • Blender can record vertex color in two different ways (which is what made finding examples of code that worked so difficult). I’ve only tested the first way here since that’s what I had, so the other branch of the code might not work.
  • You won’t actually see your selection, because update_edit_mesh throws an error for some reason, and none of the other ways of updating that I found seems to work, but the selection is getting made.
  • The code might be slow because I’m looping through everything twice. I couldn’t figure out the numpy selection optimizations people were doing, and not having an easy way to get the selected things seem to be a long standing issue.

Funny that you mention that thread, as it was also one that I was going through this summer trying to determine a pathway to getting some code to work.

I’m normally not one to invoke the term ā€œman-splainingā€, but that thread was a perfect example of it unfortunately.