Well, without distance attenuation, it does seem normal to me that closer vertices are not specifically brighter, or even darker. That just doesn not contribute.
What James said is true : you may feel better lighting contribution if normals are sent differently. That is, instead of calling glNormal orthogonal to the quad, call glNormal for EVERY vertex like it was looking to the Interior.
For instance, replace this piece of code :
glBegin(GL_QUADS);
glNormal3f(0.f,0.f,1.f);
glVertex3f(-1.f,-1.f,0.f);
glVertex3f(-1.f,+1.f,0.f);
glVertex3f(+1.f,+1.f,0.f);
glVertex3f(+1.f,-1.f,0.f);
glEnd();
with that :
glBegin(GL_QUADS);
glNormal3f(+1.f,+1.f,0.f);
glVertex3f(-1.f,-1.f,0.f);
glNormal3f(+1.f,-1.f,0.f);
glVertex3f(-1.f,+1.f,0.f);
glNormal3f(-1.f,-1.f,0.f);
glVertex3f(+1.f,+1.f,0.f);
glNormal3f(-1.f,+1.f,0.f);
glVertex3f(+1.f,-1.f,0.f);
glEnd();
Shadow volume (lesson 28)
Yes, with per-vertex normals, the 3 wall near the corner should be lighted in the same way. It would be better.
But it do not explain the problem.
With per-face normals, if i put my light in one edge near (or far) the corner, one wall should be bright (the one where the light is in front of), and 2 walls should be dark (because the dot product is equal to 0 on the edges).
This is not the case.
And it do not explain why the faces have different level of light when i move my camera.
But it do not explain the problem.
With per-face normals, if i put my light in one edge near (or far) the corner, one wall should be bright (the one where the light is in front of), and 2 walls should be dark (because the dot product is equal to 0 on the edges).
This is not the case.
And it do not explain why the faces have different level of light when i move my camera.
quote:
Original post by greg2
With per-face normals, if i put my light in one edge near (or far) the corner, one wall should be bright (the one where the light is in front of), and 2 walls should be dark (because the dot product is equal to 0 on the edges).
What do you mean by ''in front of'' ? If you mean that a light "in front of" a wall is a light that is "close to" a wall, then (again) it''s not to be taken into account.
Have you tried to setup the normals like described in the previous post ?
quote:
Original post by greg2
And it do not explain why the faces have different level of light when i move my camera.
The only light contribution that depends on the camera position is the specular contribution. If you set the specular color to black (either on the material or the light) you will not notice different lighting when movinf the camera.
I have found the problem.
The .exe file from Nehe has a bug.
But when i compile it again i have no bug.
I have not seen that before, because i have compiled the project only after having added the attenuation to the light (this is why i had not understood why attenuation could solve the problem).
But, i have understood that the distance is not a factor.
I mean that a light "in front of" a wall is a light that has a dot product equal to 1 (normalized).
But the .exe from NeHe do not let me seen that.
Look at this picture (i use local coordinates with (0,0,0) in the corner. This picture show the problem i have with the .exe file from Nehe, and that i have not when i compile it again:
http://texel3d.free.fr/bugs/light2.jpg
Thanks for your patience and your answer.
The .exe file from Nehe has a bug.
But when i compile it again i have no bug.
I have not seen that before, because i have compiled the project only after having added the attenuation to the light (this is why i had not understood why attenuation could solve the problem).
But, i have understood that the distance is not a factor.
I mean that a light "in front of" a wall is a light that has a dot product equal to 1 (normalized).
But the .exe from NeHe do not let me seen that.
Look at this picture (i use local coordinates with (0,0,0) in the corner. This picture show the problem i have with the .exe file from Nehe, and that i have not when i compile it again:
http://texel3d.free.fr/bugs/light2.jpg
Thanks for your patience and your answer.
In the scheme, you''re right about the color of the corner (0,0,0) being invariant whether the light position is x=-1 or x=-1000.
But it''s not true fir the three other corners which angle will vary when x=-1 or x=-1000, thus the dot product will vary and those three corners will have different light contribution. Finally, because the shade model is GL_SMOOTH, the colors will be interpolated over the quad, which means that only the corner (0,0,0) will have a constant color.
And btw, I deserve to be patient since ... I know what it''s like to talk to a French guy
But it''s not true fir the three other corners which angle will vary when x=-1 or x=-1000, thus the dot product will vary and those three corners will have different light contribution. Finally, because the shade model is GL_SMOOTH, the colors will be interpolated over the quad, which means that only the corner (0,0,0) will have a constant color.
And btw, I deserve to be patient since ... I know what it''s like to talk to a French guy

This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement