Create point in middle of prim + transfer N from prim to newly created point

   2935   2   1
User Avatar
Member
17 posts
Joined: July 2017
Offline
Hi Guys
This is a newbie question but I wonder how to transfer normal attrib from primitive to newly created point in the middle of that primitive.
The point creation part is as follows:
attrib wrangle run on prims:
@N = @N;
addpoint(0, @P);
removeprim(0, @primnum, 1);

I found it somewhere on the forum.
I know how to do the whole thing using SOPs but I suspect it can be much simpler using VEX.

When run within for-each prim loop I get one prim (primnum “0”) and one point (pointnum “0”), so my question is basically how to transfer attrib N from primnum 0 to pointnum 0. I cannot figure out correct syntax.

Thanks in advance
Edited by McKormick - June 19, 2018 07:21:35
User Avatar
Member
2164 posts
Joined: Sept. 2015
Offline
int Pt_Num;

@N = @N;
Pt_Num = addpoint(0, @P);
setpointattrib(geoself(), "N", Pt_Num, @N, "set");
removeprim(0, @primnum, 1);
User Avatar
Member
17 posts
Joined: July 2017
Offline
Thanks a lot, it works as expected, however it cooks slower than SOP approach using Divide_node: compute dual.


Now all my roof tiles are laid on roof geo in no time
  • Quick Links