Orienting Point Normals

   517   2   1
User Avatar
Member
5 posts
Joined: June 2025
Offline

Good day! I would like to know how I could orient my point normals to face straight? Currently my normals are slightly tilted from what they are looking at, and I would love to know how I could snap it into grid direction (see green for supposedly correct normal direction)

Any simple approach? I tried rounding it off but it clearly did not work at all (due to most directions rounding off to 0)

Any help would be appreciated, thank you!
Edited by iamrheonmaro24 - Sept. 8, 2025 00:54:08

Attachments:
Recommendations4.png (129.0 KB)

User Avatar
Member
5042 posts
Joined: Feb. 2012
Offline
Hi,

You can use Orientation Along Curve SOP, where X Axis will give you what you want. Make sure to choose the right Tangent Type for your use case.

Attachments:
1.png (540.5 KB)

Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com] https://lnk.bio/animatrix [lnk.bio]
User Avatar
Member
16 posts
Joined: Nov. 2012
Offline
Hi Iam,

Getting the correct normals for polylines can be tricky.
It all depends on the point order. So ensure that you're point order is correct. see image

in this case each primitive has 2 points in clockwise order. if you flip point number 2 and 3, the normal will be in opposite direction.
so using this script, in a primitive wrangle, you will get the correct normals.
/*
    calculate outer Normal direction in primitive context
    asuming 
        that each primitive has 2 points
        and all primitive points are in clockwise order
*/

//get the points of each primitive (should be 2 points)
int pts[] = primpoints(0, @primnum);

//get the position of each primitive point
vector p0 = point(0, "P", pts[0]);
vector p1 = point(0, "P", pts[1]);

//calculate direction by subtracting and make them a length of 1 by normalizing
vector tu = normalize(p1 - p0);//to flip the normal: use  p0 - p1

//the up direction
vector up = {0,1,0};

//calculate N with the cross product
vector n = cross(up, tu);

//set the Normal attribute
setpointattrib(0, "N", pts[0], n, "set");
setpointattrib(0, "N", pts[1], n, "set");

Attachments:
pointOrder.png (397.4 KB)

  • Quick Links