Assign id by point point colors

   1361   2   0
User Avatar
Member
90 posts
Joined: 3月 2013
Offline
Anyone know how to go about getting all points sorted by their color into an id attribute? Thanks in advance.
User Avatar
Member
4730 posts
Joined: 2月 2012
Offline
Hi,

You can convert your colors into IDs like this using an Attribute Wrangle:

i@color = floor ( @Cd.r * 1e6 + @Cd.g * 1e3 + @Cd.b );

If you want to consolidate the IDs to be ordered without holes, you can add another wrangle like so:

int colors [ ] = uniquevals ( 0, "primitive", "color" );
@id = find ( colors, i@color );
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]

youtube.com/@pragmaticvfx | patreon.com/animatrix | pragmaticvfx.gumroad.com
User Avatar
Member
90 posts
Joined: 3月 2013
Offline
Oh nice!. Thank you for this. This is very helpful.
  • Quick Links