Need help beginning with Lighting

Hi. I have taken up a 3D home modeler as my project, which lets the user construct any simple building(its very basic though). I have already finished with the construction part, and now i want to add lighting(I have never used lighting before).
I want to use a very simple lighting scheme in which there is an overall lighting all over the scene. So even if the user navigates and comes inside a room, he should find sufficient light to look around. I was thinking of simulating a light for sun, but what happens when i am inside a closed room? Does it have to do anything with global ambient light?
Time is short, and ultra realism is not on my mind. To be frank, i need lighting so that my objects - like walls, become perceptible. So can someone please tell me a simple method to use lighting. If you can give some example lighting parameters to begin with, that would simply be great.Please suggest me how to define material paramaters also.


You might be able to use a lantern-style light, that is one with a position relative to the camera.

That way wherever the eye was, it would see things. Here’s the idea:

//top of display func.
    Glfloat *camTrans; // eye trans. matrix
                       // used for the projection

    glMatrixMode( GL_MODELVIEW );
    glMultMatrix( camTrans );
    glPushMatrix(); //needs to be pushed to move 
                    // light, I think.
    glLightv(...// position the light 
    glPopMatrix(); glPopMatrix(); //revert mview

Would that work?

Hope it helps,

If you just need lighting to be able to see things, it is very simple. Don’t wory about closed rooms, there are no cast shadows by default so you will be able to see.

Personnaly I don’t really like ‘lantern-style light’, because I find it flattens out the geometry.

If you put a single ‘sun’ at infinity, with no distance attenuation (the default), and an angled position, like (1,1,1,0), it should be pretty good. Setting the ambient light brighter than default will help a bit.

Untested code, but should work :
GLfloat pos[4]={1,1,1,0};
GLfloat amb[4]={0.2,0.2,0.2,0};

You can even add an second dark blue light placed at (-1,-1,-1,0) for nicer effects, especially with curved models. Not your case, but anyway.

Hi. I have done the same thing, setting a directional light at (1.0,1.0,1.0,0.0). These are my light0 settings:
GLfloat light_Diffuse[] = {1.0,1.0,1.0,1.0};
GLfloat light_Ambient[] = {0.2,0.2,0.2,1.0};
GLfloat light_Specular[] = {1.0,1.0,1.0,1.0};
GLfloat light_Pos[] = {1.0,1.0,1.0,0.0};
GLfloat global_Ambient[] = {0.2,0.2,0.2, 1.0};

But some faces of the objects look completely black when viewed from a particular angle. For ex, i have drawn a solid cube at origin, and when i view it from, say eye position (10.0, 1.0,10.0), the front face of the cube(the one whose outer face is towards +ve Z axis) looks completely black. The scene also looks dull as if viewed at the sunset. Do you suggest I should use two lights?
Another queer thing is that a huge polygon that i draw for the earth surface(y=0) looks the same Gray from both the sides, but another polygon(z=0) looks totally black when i view it from other side. using GL_LIGHT_MODEL_TWO_SIDE solves this problem, but why does the y=0 polygon remains the same color even when this option is disabled?