In the same manner as gl_FrontFacing
. I wish there would be gl_FaceNormal
that return the vector of the face that fragment are working with. It should be easily calculated at the same time along with gl_FrontFacing
What makes you think that gl_FrontFacing
requires being “calculated”? Getting a face normal requires a computation; getting whether the front or back face of a triangle’s rasterization is being used requires a “computation” that the rasterizer already did when it started rasterizing (it’s how face culling works).
And what space would the normal be in? It’d have to be in window space or clip-space, which are the only two spaces that OpenGL really knows about. Clip-space is homogeneous, so normals aren’t so simple to deal with. And window space isn’t particularly useful either (especially with the skewed Z component).
It’d be better for the user to just compute the normal directly, in whatever space they want.
This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.