Jump to content
Sign in to follow this  
ela1995

how to for each primitive with vex

Recommended Posts

I have colored gradient for each extruded primitive using For Each Loop. How do I do the same thing with vex? I'm not familiar with prim array. Can anyone help me? Thanks in advance.

image.thumb.png.f6b1253501d69fb5d768a1a2589ec2ac.pngimage.thumb.png.e9e622995fcb178efda30ee9ab34ac22.png

how to foreach prim with vex.hip

Share this post


Link to post
Share on other sites

you can do this for example in point wrangle after your Connectivity SOP
 

int class = prim(0, "class", @primnum);   // get class of point's prim
string grp = sprintf("@class=%s", class);  // ad-hoc group string for all prims with that class value
vector rbb = relbbox(0, grp, @P);  // rel bbox of point's p within bbox of all prims in that group
v@Cd = chramp('color',rbb.y);  // profit

 

how_to_foreach_prim_with_vex_fix.hip

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×