Models with 1-sided faces only get lit from the front

Wed Apr 17, 2019 1:52 pm

Run attached demo. From behind the model, the surface is completely dark, despite being lit directly with your flashlight.

Similar results with both OpenGL and latest vulkan2 commit.
You do not have the required permissions to view the files attached to this post.

Re: Models with 1-sided faces only get lit from the front

Wed Apr 17, 2019 2:06 pm

This one is somewhat tricky to solve because GZDoom renders some of its geometry backfacing - can't remember if its walls or flats. This means the fragment shader can't flip the normal vector using gl_FrontFacing.

Re: Models with 1-sided faces only get lit from the front

Wed Apr 17, 2019 2:53 pm

It shouldn't. Aren't you confusing normal direction with vertex winding order?

Re: Models with 1-sided faces only get lit from the front

Wed Apr 17, 2019 3:09 pm

I believe I once tried turn on backface culling (for the world, not models) and that created holes in in the map. The normal direction is of course correct for the world, so I suppose you could say the vertex winding order isn't consistent. It requires a renderpass change to change the winding order so we want to keep that at a minimum (right now the entire opaque scene is more or less done by a single pass).

Re: Models with 1-sided faces only get lit from the front

Wed Apr 17, 2019 3:35 pm

The winding order is indeed not consistent. It's the opposide for floors and ceilings because the xy-mesh is the same for all planes in the same sector - and the same plane data can be used for rendering both.