Reverse normals vs reverse vertex order

   2467   3   1
User Avatar
Member
696 posts
Joined: Aug. 2019
Offline
In Houdini, for some reason the normals (N attribute) isn't the only thing that determines how a fragment is shaded. For example, I cut an isohedron in half, then reverse its normals (without reversing its vertex order):



The shading is completely broken:



(left: reversing normals without reversing vertex order; right: reversing normals and vertex order)

Why does this happen? From my understanding of graphics programming, the normal of a fragment (pixel) should be the interpolated result from the vertices, and the vertex order shouldn't affect how it's interpolated.

Attachments:
Screenshot 2023-11-27 181406.png (80.7 KB)
Screenshot 2023-11-27 181725.png (217.8 KB)

User Avatar
Member
153 posts
Joined: June 2020
Offline
The vertex order of a polygon determines what is considered the front and back of that polygon.
If your polygon faces one direction and you explicitly tell the normals to face the opposite direction, the shading will look broken.

If no normals are explicitly set, Houdini will autogenerate normals for the viewport.

You can see this by viewing the reverse right after the clip. The vertex order is reversed and the normals are recalculated and there are no shading errors other than seeing the backface tint if you have that option enabled.
Edited by freshbaked - Nov. 27, 2023 11:36:07
User Avatar
Member
355 posts
Joined: Nov. 2013
Offline
raincole - once the authored normals are pointing opposite to the winding orientation I think you just end up in a weird undefined place wrt how a render interprets what should happen, but I get what you're saying. If you switch to karma, I bet you get a different interpretation again. Getting applications and renderers to act consistently when it comes to orientation, sidedness and authored normals has been impossible since the dawn of CG and it's unlikely to change anytime soon unfortunately.
User Avatar
Member
8178 posts
Joined: Sept. 2011
Offline
raincole
Why does this happen? From my understanding of graphics programming, the normal of a fragment (pixel) should be the interpolated result from the vertices, and the vertex order shouldn't affect how it's interpolated.

I think it's because surfaces draw two-sided in Houdini. In order to shade both sides correctly, the normals have to be face-forwarded. Typically, the geometric normal is used to determine face-forwardness, which if incorrect will result in broken shading on both sides.
  • Quick Links