How do I select points based on their colour?

   2464   4   1
User Avatar
Member
13 posts
Joined: May 2014
Offline
Hi all, how would I select and group all of the 'blue' points/vertex colours on a mesh? all help appreciated!

Dave
User Avatar
Member
2540 posts
Joined: June 2008
Offline
You could try this inside a point wrangle.
// Using 0.9 instead of 1.0 to allow for a little error in the color.
if(v@Cd.b>0.9){i@group_all_blue = 1;}
NOTE: This wont "select" them in the interface, but it will add them to a group you can perform operations upon.

i@group_ is a built-in mechanism for assigning points/prims to groups. The group generated is not named "group_all_blue". The group the code will create is called "all_blue".

The flaw in the above code is that points with other red and green content might be included. You can extend this with more code checking...
int no_red = 1;
int no_green = 1;
float threshold_low = 0.1;
float threshold_high = 0.9;

if (v@Cd.r<threshold_low){no_red = 0;}
if (v@Cd.g<threshold_low){no_green = 0;}
if (no_red+no_green == 0){
    //Time to check for blue.
    if(v@Cd.b>0.9){i@group_all_blue = 1;}
}
Edited by Enivob - March 5, 2022 15:01:33

Attachments:
Untitled-1.jpg (340.2 KB)

Using Houdini Indie 20.0
Windows 11 64GB Ryzen 16 core.
nVidia 3050RTX 8BG RAM.
User Avatar
Member
1743 posts
Joined: May 2006
Offline
Strikes me that this shouldn't require vex. I thought maybe I could use the attribute adjust colour node as a basic keyer, isolate to a range of blues and export as a mask, but it doesn't quite fit the bill. Looked to see if there was something hiding in the 'mask by...' sops, but couldn't see one.

Worth an RFE? Or is there a method I'm missing? I think a 'mask by colour' sop or mode within mask by attribute/vector could be really handy.
http://www.tokeru.com/cgwiki [www.tokeru.com]
https://www.patreon.com/mattestela [www.patreon.com]
User Avatar
Member
13 posts
Joined: May 2014
Offline
Thank you both for taking the time to reply. I really need to spend some time to learn VEX!

Thanks again!
User Avatar
Member
731 posts
Joined: Dec. 2006
Offline
You could also use
@Cd.b>.9
in a group expression SOP. There really should be a lot more examples in the dropdown of this SOP, (this being one of them).
Sean Lewkiw
CG Supervisor
Machine FX - Cinesite MTL
  • Quick Links