how to set normal properly ..

Hi,

I draw a triangle according to these vertices, respectively: (0, 0, 0), (0, 1, 0), (1, 0, 0). I hope to have two face to show the same color. When setting the vertices’ normal, I find out that (0, 0, -1) shows darker, real color than (0, 0, 1). Could some one kindly explain this difference? It looks to me that something translucent covers the triangle when using (0, 0, 1), and hence it appears less pleasing.

Very sorry that I’m a newbie. Any help is much appreciated.

Tony

As I understand you have the lighting on, right?

If you are using a clockwise order the correct normal for the triangle you are defining is the (0,0,-1). If you use the normal (0,0,1) the lighting isn’t computed correctly. For example, the emissive component:

E = EmissiveTriangleEmissiveLightdot(N, L)

N is the normal vector
L is the light vector

So depending on the vector you use, the light component computed can be different.

E = EmissiveTriangleEmissiveLightdot(N, L)
That’s the formula of diffuse.

Could some one kindly explain this difference?
The lighting is normally computed one-sided. That is, if the light comes from the front (that is, the side where the normal is pointing), you get normal light. When it comes from the back side of the polygon, you get only the ambient part of the light, so it’s relatively dark. The diffuse part will be negative (because of the formula API posted), so it is clamped to zero.

You can switch lighting to two-sided with glLightModel(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE). Don’t forget to specify the material for the back side when you do this (either seperately or with GL_FRONT_AND_BACK).

That’s the formula of diffuse.
Ups, you are right, sorry stupid mistake :stuck_out_tongue: