PDA

View Full Version : lighting and normals



Warrior
03-26-2001, 08:25 PM
there is a few things im confused about.

ive got a spotlight shining down onto a mesh made of out triangles.

first im specifying the normal for each poly i render, however when i dont specify normals, its as if they have had no effect.
what do you have to do to see the effect of specifying normals? im not too clear on this.

second you have to pretty close to the mesh in order to see any lighting effects at all. the light source is only a few units above mesh, but should i still be able to see the light on the mesh from higher up?

third im confused about setting the direction of a spotlight. the default is
{ 0.0, 0.0 -1.0 }
i wanted my light to shine down the negative y axis so it is perpendicular with my mesh, so i set
{ 0.0, -1.0, 0.0 }
but this didnt work.
it DOES work however if i set
{ 0.0, -1.0, -1.0 }
i dont understand this.

ok, whew, i appreciate anything you guys can help me with. thanks http://www.opengl.org/discussion_boards/ubb/smile.gif

Deiussum
03-27-2001, 07:44 AM
Ok... first of all.. the default position of the light is {0.0, 0.0, 1.0, 0.0}. The vector is the position that the light comes FROM, not the direction the light points. The 4th value there is used to specifiy if it's a positional light or a directional light. 0 = directional 1 = positional. For a spot light, you specify this as positional and use the GL_SPOT_DIRECTION to set the direction. So far as how it'll affect things, lighting is done per vertex, so if you have a large triangle and the light points at the middle, the vertices of that triangle might not get much effect for the light so you won't have a very good spot light effect. YOu can fix that by sub-dividing the faces to get more vertices for the lighting calculations.

Warrior
03-27-2001, 10:05 AM
ok thanks for your reply
im gonna have another go at it right away
thanks