I have several groups of primitives and I want to select the one with the largest value (@foo) in each group.
I figure I can use a for next to iterate over each group but how might I go about isolating the one with the largest value in each group?
thanks in advance
select the largest in each group
3890 4 1- jeffMc
- Member
- 125 posts
- Joined: April 2014
- Offline
- jeffMc
- Member
- 125 posts
- Joined: April 2014
- Offline
- merlino3d
- Member
- 65 posts
- Joined: Feb. 2013
- Online
- Konstantin Magnus
- Member
- 670 posts
- Joined: Sept. 2013
- Offline
Additionally you can use the sort node by attribute and delete all prims but the first.
https://procegen.konstantinmagnus.de/ [procegen.konstantinmagnus.de]
- animatrix_
- Member
- 4516 posts
- Joined: Feb. 2012
- Offline
To check all point groups for point attribute “attrib”, you can write something like this inside AttribWrangle SOP in Detail Mode to gather them in a point group called “maxvals”:
string groups [ ] = detailintrinsic ( 0, "pointgroups" ); float maxvals [ ]; int pts [ ]; resize ( maxvals, len ( groups ) ); resize ( pts, len ( groups ) ); foreach ( int index; string g; groups ) { maxvals [ index ] = -1e10; int elements [ ] = expandpointgroup ( 0, g ); foreach ( int elem; elements ) { float val = point ( 0, "attrib", elem ); if ( val > maxvals [ index ] ) { maxvals [ index ] = val; pts [ index ] = elem; } } } foreach ( int pt; pts ) setpointgroup ( 0, "maxvals" , pt, 1 );
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 | animatrix2k7.gumroad.com
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]
youtube.com/@pragmaticvfx | patreon.com/animatrix | animatrix2k7.gumroad.com
-
- Quick Links