Normals are wrong after using the Sweep node

   3181   5   2
User Avatar
Member
8 posts
Joined: 11月 2021
Offline
Hi guys!

I am using the Sweep node, to sweep a curve along another curve, and for some reason some of the normals are reversed.





As you can see in the first screenshot, the point normals of the curve are pointing outwards, which they should. But somehow some of the normals after the sweep are facing the other way.

Does anyone have an idea why this could be or how I could fix it?

I can't just reverse the normals, since it's only a part, and I cannot isolate that part since I don't know what the deciding factor is, that makes those parts have inverted normals.

I am really lost with this one.
Edited by LMaly - 2022年2月9日 05:55:42

Attachments:
sc2.jpg (148.0 KB)
sc1.jpg (135.1 KB)

User Avatar
Member
133 posts
Joined: 3月 2016
Offline
Not sure but could you use the dot product to just flip the ones in the wrong direction?

Drop down a wrangle, run over vertices:

float dist = dot(@N,{0,1,0});
if (dist > chf('val'))
{
@N = -@N;
}

Use the float channel slider to get the value that caputures them? Might not work as it might grab ones you dont want to flip, you could group just those around the problem area and then run it just over those points, looks like it might be okay
Love Houdini
User Avatar
Member
8 posts
Joined: 11月 2021
Offline
Hatchery
Not sure but could you use the dot product to just flip the ones in the wrong direction?

Drop down a wrangle, run over vertices:

float dist = dot(@N,{0,1,0});
if (dist > chf('val'))
{
@N = -@N;
}

Use the float channel slider to get the value that caputures them? Might not work as it might grab ones you dont want to flip, you could group just those around the problem area and then run it just over those points, looks like it might be okay

Thanks for the tip! For some reason I got really weird results when I flipped the vertex normals with a wrangle, but the general idea works.

Now I did it by putting all prims which are pointing down into a group and reversing that group. That will work most of the time, but it is still not bulletproof, since it might be possible for the faces to point down intentinally, in which case it would flip those too.

But this is already a move in the direction, thanks a lot!
User Avatar
Member
7771 posts
Joined: 9月 2011
Offline
LMaly
Hatchery
Not sure but could you use the dot product to just flip the ones in the wrong direction?

Drop down a wrangle, run over vertices:

float dist = dot(@N,{0,1,0});
if (dist > chf('val'))
{
@N = -@N;
}

Use the float channel slider to get the value that caputures them? Might not work as it might grab ones you dont want to flip, you could group just those around the problem area and then run it just over those points, looks like it might be okay

Thanks for the tip! For some reason I got really weird results when I flipped the vertex normals with a wrangle, but the general idea works.

Now I did it by putting all prims which are pointing down into a group and reversing that group. That will work most of the time, but it is still not bulletproof, since it might be possible for the faces to point down intentinally, in which case it would flip those too.

But this is already a move in the direction, thanks a lot!

It's better and more procedural to fix the initial problem that causes inconsistent orientation when swept. Is the curve actually multiple curves? If so, then merging them with the polypath tool may help, as it will create a single curve with consistent direction. Alternatively, the reverse tool could be applied to the curve segment that is flowing the wrong way.
User Avatar
Member
8 posts
Joined: 11月 2021
Offline
jsmack
LMaly
Hatchery
Not sure but could you use the dot product to just flip the ones in the wrong direction?

Drop down a wrangle, run over vertices:

float dist = dot(@N,{0,1,0});
if (dist > chf('val'))
{
@N = -@N;
}

Use the float channel slider to get the value that caputures them? Might not work as it might grab ones you dont want to flip, you could group just those around the problem area and then run it just over those points, looks like it might be okay

Thanks for the tip! For some reason I got really weird results when I flipped the vertex normals with a wrangle, but the general idea works.

Now I did it by putting all prims which are pointing down into a group and reversing that group. That will work most of the time, but it is still not bulletproof, since it might be possible for the faces to point down intentinally, in which case it would flip those too.

But this is already a move in the direction, thanks a lot!

It's better and more procedural to fix the initial problem that causes inconsistent orientation when swept. Is the curve actually multiple curves? If so, then merging them with the polypath tool may help, as it will create a single curve with consistent direction. Alternatively, the reverse tool could be applied to the curve segment that is flowing the wrong way.

Thank you so much!! I didn't know about the polypath tool, and it solved the issue, and also a bunch of other issues I was having. Thanks so much!
User Avatar
Member
17 posts
Joined: 2月 2019
Offline
The issue you're encountering may be related to the vertex order in the spine. The sweep node doesn't just utilize the N and up vectors, but also takes into account the vertex order of your spine. So, if the normal vector isn't directed from the vertex with the smaller number to the vertex with the larger number, you might end up with an inverted mesh.

Regrettably, I haven't found a method to manually sort the vertices yet. As Lmaly suggested, the only workaround is to identify the initial inconsistency within the spline.

You can see the vertex numbers in your viewport using the following setting in the display options.
Edited by Sergey Filin - 2023年7月28日 12:59:10

Attachments:
2023-07-28_19-57-10.jpg (44.5 KB)

  • Quick Links