Flipping Normals

   2039   12   1
User Avatar
Member
29 posts
Joined: 10月 2022
Offline
While progressing with the data received in Unreal Engine, I encounter situations where certain normal directions are flipped, as shown in the image. If I want to procedurally flip only the inverted faces, what should I do?

Attachments:
스크린샷 2023-07-04 203801.png (422.7 KB)

User Avatar
Member
477 posts
Joined: 8月 2014
Offline
PolyDoctor's "Correct Winding of Polygons to Majority in their Manifold Patch" is one way to do it.
User Avatar
Member
29 posts
Joined: 10月 2022
Offline
Polydoctor seems to operate only on the flipped faces within connected polygons. It doesn't seem to affect polygons that are detached or separate.
User Avatar
Member
29 posts
Joined: 10月 2022
Offline
To elaborate further, after going through several processes, when I merge convert lines and perform a polygon fill, occasionally I encounter flipped normals. What should I do to prevent flipped normals from occurring?
User Avatar
Member
477 posts
Joined: 8月 2014
Offline
Do prims that you're generating always lie on a flat plane, like on the screenshot?
Edited by ajz3d - 2023年7月5日 08:56:20
User Avatar
Member
29 posts
Joined: 10月 2022
Offline
ajz3d
Do prims that you're generating always lie on a flat plane, like on the screenshot?
Due to obtaining surface information from the low hills of the landscape, slopes can occur in some cases.
Edited by gallerykim - 2023年7月5日 21:28:21
User Avatar
Member
477 posts
Joined: 8月 2014
Offline
If this is the case, then perhaps it will be enough to reverse all primitives which have normals within a specific spread angle from the (0, -1, 0) vector? It should work for this kind of data.
Edited by ajz3d - 2023年7月6日 06:30:17

Attachments:
normal_spread_angle.hipnc (166.4 KB)

User Avatar
Member
29 posts
Joined: 10月 2022
Offline
ajz3d
If this is the case, then perhaps it will be enough to reverse all primitives which have normals within a specific spread angle from the (0, -1, 0) vector? It should work for this kind of data.

Do I need to modify @N to change the normal vector?
When instructed to multiply by -1 when @N.y < 0, in the spread sheet, the N value became positive, but the actual normal did not flip.
User Avatar
Member
477 posts
Joined: 8月 2014
Offline
gallerykim
Do I need to modify @N to change the normal vector?
Depends.
  • If you have no existing vertex normals and it is only primitive winding that is wrong, then obviously no.
  • If you have existing vertex normals, then regardless of primitive winding you will also need to reverse vertex normals.

When instructed to multiply by -1 when @N.y < 0, in the spread sheet, the N value became positive, but the actual normal did not flip.
It would be best if you could post a sample scene.
Maybe it's a viewport bug? Or perhaps you're multiplying only one vector component instead of negating the full vector?

Attachments:
fix_reversed_vx_N.hipnc.zip (31.3 KB)

User Avatar
Member
29 posts
Joined: 10月 2022
Offline
Thank you for providing the sample. I've tried incorporating a portion of my scene into the sample file, but I'm still encountering issues with the normals that need to be resolved before performing the final extrude operation.

Attachments:
fix_reversed_vx_N_stash.zip (144.9 KB)

User Avatar
Member
477 posts
Joined: 8月 2014
Offline
I added two Reverse SOPs (one per method) to the network that are reversing the candidate group, and now PolyExtrude returns correct result.

There were ill-formed primitives in the input geometry, so I cleaned them up by recreating primitives from their edges. This might not be a perfect solution, but it works on geometry data you provided.

Attachments:
fix_reversed_vx_N_stash.hipnc.zip (46.2 KB)

User Avatar
Member
29 posts
Joined: 10月 2022
Offline
The issue has been resolved cleanly.
Thank you very much!!
User Avatar
Member
477 posts
Joined: 8月 2014
Offline
You're welcome.
  • Quick Links