Jump to content
Sign in to follow this  

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.


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



  • 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