Jump to content

Porting Vops into Vex (primuv)


Recommended Posts

Hello, I'm trying to get more comfortable with Vex and have hit a hurdle I was hoping someone could help with. For the moment I am trying to convert what is in the Vops network to a point wrangle. I'm struggling with the primuv part of the network (seen below), I believe the prim_attribute in Vex to be the function I need to use, but I don't know where I'm going wrong with it, I've found the documentation a little hard to understand?

 

Any help would be appreciated.

float search_rad = 10.0;
int   max_points = 1;
float uu, vv;
int primid, succ;

int handle = pcopen(0, "P", @P, search_rad, max_points);
vector value = pcfilter(handle, "P");
vector diff = @P - value;
vector sum = @P + diff;
i@prim;
v@uv;
float dist = xyzdist(1, @P, @prim, @uv);
vector hitpoint = {0,0,0};
succ = prim_attribute(1, hitpoint, "P", primid, uu, vv); 
vector blend = lerp(@P, hitpoint, 0.5);

@P = blend;

post-13980-0-62222900-1441545287_thumb.p

Link to comment
Share on other sites

Primuv works in vex too. Try this instead of your prim_attribute call:

vector lookupuv = set(uu,vv);
hitpoint = primuv (1,"P", primid, lookupuv); 
You don't seem to assign a value to 'primid' anywhere though. Did you mean to use @prim instead?
Edited by mestela
Link to comment
Share on other sites


...

int primid; // you already have this defined, but for completeness

vector primuv;

xyzdist(1, sum, primid, primuv); //as sum is your lookup position according to screenshot and primid and primuv variables will get sampled data

vector hitP = primuv(1, "P", primid, primuv); //then just get "P" from that sample

...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...