PDA

View Full Version : positional light doesnt work right



V-man
05-30-2002, 05:13 PM
Very simple problem here:

I have a scene with a quad. I have 3 light source in *front*.

material_ambient is ZERO
material_diffuse is {0, 0, 1, 1}
material_emission is ZERO
material_specular is {0.2, 0.2, 0.2, 1.0}

global_ambient_light is ZERO
light_ambient is ZERO
light_diffuse is ONE
light_specular is ONE
two_sided_lighting is OFF
local_viewer is ON
When I rotate, to view my quad from the back (not suppose to be lit), it gets lit anyway. Even if I have 1 light, Its gets lit.
Now, it is difficult to see with 1 light, so I screencapture in a image editor and check up on the pixels.
I see (0, 0, 42) sometimes. The other side where the light is looks as expected.

If I use directional light, the back side is BLACK,, as it should be.
What am I missing here?

V-man

zed
05-30-2002, 09:08 PM
>>two_sided_lighting is OFF<<

by default a quad will have the same thing both sides, textures lighting etc

BTW i assume the light is in the right place (in the world + positioned after u position the camera)

V-man
05-30-2002, 09:28 PM
Originally posted by zed:
>>two_sided_lighting is OFF<<

by default a quad will have the same thing both sides, textures lighting etc


Meaning what? When you look at the back, where there is no light, it should be no diffuse and no specular, unlike the front.
Im not using textures, but the result should be the same. Normals are pointing towards lights. And I think I have the polygon's CCW right.




BTW i assume the light is in the right place (in the world + positioned after u position the camera)

I beleive it is right.
//Not the actual code, but something like this
glLoadMatrixf(matrix);
glLightfv(GL_LIGHT0, GL_POSITION, position);

glPushMatrix();
glRotatef(XMouseRotate, 1.0, 0.0, 0.0);
glRotatef(YMouseRotate, 0.0, 1.0, 0.0);

renderquad();
glPopMatrix();

Im rotating the scene with the mouse so that I can look at the quad from behind.

V-man

zed
05-31-2002, 11:52 AM
turn on two sided lighting