View Full Version : Shaded objects does not look consistent

05-21-2006, 06:07 AM

I got a nicely shaded model, but the position of the light does not look consistent. Some of the faces of the object seems to shade in a different - almost opposite- way of what is expected.

Does to direction of the normal matter? Is the backside of a triangle shaded the same as the front side when subjected to light?

If not, is there some way of making OPENGL ignore if the normals are consistent or reversed. My CAD data does not make sure all normals point in the same direction. Some surfaces point in the opposite direction and I do not want to mess with correction algorithms etc.


05-21-2006, 10:39 AM
Normal direction is critical to lighting. If all your faces are winded the same way, then use those windings to make the normals all point in the good direction (this is simply a vector opposite).

05-21-2006, 10:48 AM
You can enable two-sided lighting (glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 1)). This still requires the direction of the normal to be consistent with the winding of your triangles, though.

05-21-2006, 03:39 PM
Thanks for the feedback!

The last tip GL_LIGHT_MODEL_TWO_SIDE was exactly what I was hoping to find. My models now look great!