Transferring Normal Direction

   3535   2   0
User Avatar
Member
45 posts
Joined: March 2017
Offline
I am trying to copy a bunch of tubes to points on a surface to align with the normals direction but of course this is never easy and I think the most asked question on the forum.

As you can see in the attached image my point normals(blue ones) are all facing up. My primitive normals(pink ones) are facing as they should, in the direction of the face.

I have created a point in the center of each primitive face, that is what I want to use to copy the tubes to but the normals all face up and I get the typical undesired outcome. What I am interested in doing is somehow transferring the prim normals information to the point normals, is that possible? Is there another/better solution?

Attachments:
normals.jpg (174.4 KB)
normalsProblem.hiplc (173.5 KB)

User Avatar
Member
900 posts
Joined: Feb. 2016
Offline
In the primitive wrangle when you create the points use this code:

removeprim(0, @primnum, 1);
int newpt = addpoint(0,@P);
setpointattrib(0, "N", newpt, @N, "set");


it sets primitive normals to the new created point.
Of course you have first to create the primitive normals, otherwise there's no attribute to transfer: just add a normal node before the wrangle, and set it to primitive
Edited by Andr - June 6, 2019 09:24:49
User Avatar
Member
900 posts
Joined: Feb. 2016
Offline
Andr
Of course you have first to create the primitive normals, otherwise there's no attribute to transfer: just add a normal node before the wrangle, and set it to primitive


I just realize that this is unnecessary: normals are implicit for the primitives. So even if you don't see any ‘N’ attribute in the primitive spreadsheet, the above code would work anyway. You can skip this passage
Edited by Andr - June 6, 2019 09:24:32
  • Quick Links