Original Post
Hi. :) I'm reading More OpenGL Game Programming, and it's EXCELLENT. I haven't had too many problems understanding the concepts shown throughout, and I'm very pleased with it. I'm in the lighting chapter, and it got difficult really fast. I got through the Blinn-Phong model just fine, but after that it was pretty daunting, namely,(forgive spelling please) Cook-Torrence, Oren Nayer, Ashikhmin. It blew right past me. Could someone please try to explain it in something closer to english? Anyway, that's not the main concern of this post (in case you're wondering why it's named Polygon Faces and I'm talking about lighting models). After it talks about those models, it talks about image-space lighting where the lighting is done based on a volume. I understood it for the most part, but the way it uses the polygon faces confuses me. All I can remember OpenGL Game Programming saying about faces is that polygons are flat but OpenGL draws them twice (provided there is no culling), drawing the front and back. The front faces the camera, the back faces away from the camera. So I'm wondering how this helps in the process of determining whether or not an object is within the bounds of a lighting volume. Just to clarify, it's set up to cull front faces, the depth test is GL_GREATER, so only objects behind others are drawn, and the stencil op is set to GL_REPLACE for zfail (others GL_KEEP). In this case, zfail means the lighting volume was drawn in front of the object so the object (er..pixel) is behind the lighting volume. What's the purpose of culling front faces instead of back faces? It repeats the same thing again with front faces culled and this time zpass is GL_REPLACE (others GL_KEEP). If it passes, that would mean that it's in front of the pixel. If it's inside the volume, that'd mean it has to be behind some vertices and in front of some others, so either way it would get replaced and therefore not be drawn later. Thanks a lot.