PDA

View Full Version : light and normals



09-27-2000, 07:11 AM
this may be a dumb question but here goes..
if i want to have a wall.. with a specular light shining at it.. and make the wall real shiny.. i just set up my spec light and material properties..

and then define the normal for the wall like this..
the wall is a couple trianglesgoing like this

glVertex3f(-100.0, -10.0, -100.0)
glVertex3f(-100.0, 10.0, -100.0)
glVertex3f(100.0, 10.0, -100.0)

and another opposing triangle to make it a square..
but my real question is.. to define a normal for that wall.. should i type..
glNormal3f(0.0, 0.0, 1.0)?

or am i totally leaving something out?

DFrey
09-27-2000, 07:38 AM
There is one problem, if you are wanting to use a spotlight, a wall made up of just 2 triangles will not likely produce the results you desire. Your wall will need a fairly fine degree of tessellation before a spotlight will look good.
Also, each vertex needs a normal. That is specify the vertex normal, before specifying the vertex itself.

[This message has been edited by DFrey (edited 09-27-2000).]

Bob
09-27-2000, 10:47 AM
The normal you specified is correct. Depending in what direction you want the wall to face, you might have to change it to (0,0,-1) though, but the direction itself is correct. And in this particular case, you only need to set normal for the first vertex, because all vertices will have the same normal, but get used to pass one normal per vertex when using lightning, to get smooth lightning.