Shaded back-faces ??

...
        GLfloat mat_specular[] = { 1.0, 1.0, 1.0, 1.0 };
        GLfloat mat_shininess[] = { 50.0 };
        GLfloat l_ambient[] = { 1, 1, 1, 1};
        GLfloat light_position[] = { -2, 0, -2.0, 0.0 };

        glClearColor (0.0, 0.0, 0.0, 0.0);
        glShadeModel (GL_SMOOTH);

        glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular);
        glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess);
        glLightfv(GL_LIGHT0, GL_POSITION, light_position);
        glLightfv(GL_LIGHT0, GL_AMBIENT, l_ambient);
        glLightModelf(GL_LIGHT_MODEL_TWO_SIDE, 0.0);

        glEnable(GL_LIGHTING);
        glEnable(GL_LIGHT0);
        glEnable(GL_DEPTH_TEST);

        glMatrixMode(GL_PROJECTION);
        glLoadIdentity();
        gluPerspective(45, (float)((window_w))/(window_h) , 0.001, 1000);
...
        GLdouble eq[] = { 1, 0, 0, 0};
        glMatrixMode(GL_MODELVIEW);
        glLoadIdentity();
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
        glTranslatef(0, 0, -5);
        glRotatef(10, 0, 1, 0);
        glClipPlane(GL_CLIP_PLANE0, eq);
        glEnable(GL_CLIP_PLANE0);
        glutSolidSphere(1, 20, 20);
        glFinish();
...

The piece of code above show this half-sphere.
Why the inside of the sphere is lighted ??
It shouldn’t be completely black ???

You’ll need to set material properties for the back face to make it black. Either that or move the light source

You have only set front material properties and the front face in two sided lighting is determined by the face winding.

The normal and material will be flipped based on whether the face is clockwise or counter clockwise.

If you get the winding wrong (w.r.t. your chosen frontface winding preference (glFrontFace(GL_CCW) is the default) the inside will have the outside material and may appear backlit due to the normal pointing the wrong way.

Your code only sets the front face material too so you should correct that. Materials have default properties, they are not simply black.

I’d advise you set ambient low and set diffuse to different colors for front & back materials. You may want to set emission to some color and everything else to black just to make sure you know what you’re looking at w.r.t. face winding just to start off with.

Originally posted by dorbie:
[b]You’ll need to set material properties for the back face to make it black. Either that or move the light source

You have only set front material properties and the front face in two sided lighting is determined by the face winding.

The normal and material will be flipped based on whether the face is clockwise or counter clockwise.

If you get the winding wrong (w.r.t. your chosen frontface winding preference (glFrontFace(GL_CCW) is the default) the inside will have the outside material and may appear backlit due to the normal pointing the wrong way.

Your code only sets the front face material too so you should correct that. Materials have default properties, they are not simply black.

I’d advise you set ambient low and set diffuse to different colors for front & back materials. You may want to set emission to some color and everything else to black just to make sure you know what you’re looking at w.r.t. face winding just to start off with.[/b]
Oh Yeah, I misunderstood how glLightModelf(GL_LIGHT_MODEL_TWO_SIDE, 0.0) works.
I thought that setting it to 0 would turn off the lighting calculation on the back side…

However, to turn off completely the back side lighting was my goal (setting the back material to black doesn’t avoid the calculations).
Is it possibile ???