Sign in to follow this  
arbin

two-side lighting / winding

Recommended Posts

Hi, I have a mesh ,not all faces in the mesh are winded consistently. I try to render it in such a way:
glDisable(GL_CULL_FACE);
glLightModelf(GL_LIGHT_MODEL_TWO_SIDE,GL_TRUE);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE,matCol);
//render ...(ununiformlly defined winding model)
As I have understood glLightModelf(GL_LIGHT_MODEL_TWO_SIDE,GL_TRUE) reverses backface normals ,but remains the front face normals... But only back faces are lighted.What seems to be the problem? Thank you in advance.

Share this post


Link to post
Share on other sites
How are your normals generated, are they all in the right direction, or are they flipped like the winding?

If you have a triangle that the normal is pointed in the opposite direction of the front-face, than I think enabling two-sided lighting will still be incorrect (both faces will now have normals pointed in the opposite direction of their faces).

I think this is how I understand two-sided lighting, but I could be wrong.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this