Archived

This topic is now archived and is closed to further replies.

Front and back of a surface with lighting

This topic is 5649 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''ve been trying stuff out with lighting and reading up on it and for some reason when my light gets near the front of the surface it gets darker , but the back gets brighter , is the back the side that we are suppose to be using , or do I have something wrong , Thanks Alex

Share this post


Link to post
Share on other sites
I think I''ve missed something about normals in opengl , I know in math the normal is a line that is perpendicular to the plain so there for there would be 2 points or 1 point on the plain and one out of the front , what I''ve learned about opengl its suppose to be a point on the plane
there for if you had this plane
glVertex3f(-5,0,-5);
glVertex3f( 5,0,-5);
glVertex3f( 5,2,-5);
glVertex3f(-5,2,-5);
the normal would be
glNormal3f(0,1,-5);
the code afterwards would be
glNormal3f(0,1,-5);
glVertex3f(-5,0,-5);
glVertex3f( 5,0,-5);
glVertex3f( 5,2,-5);
glVertex3f(-5,2,-5);
if this is incorrect where should the normal be
OR
if this is the front then how would I get the normal to switch it for the back
thanks
Alex

Share this post


Link to post
Share on other sites
quote:

glVertex3f(-5,0,-5);
glVertex3f( 5,0,-5);
glVertex3f( 5,2,-5);
glVertex3f(-5,2,-5);
the normal would be
glNormal3f(0,1,-5);
the code afterwards would be
glNormal3f(0,1,-5);
glVertex3f(-5,0,-5);
glVertex3f( 5,0,-5);
glVertex3f( 5,2,-5);
glVertex3f(-5,2,-5);
if this is incorrect where should the normal be
OR
if this is the front then how would I get the normal to switch it for the back
thanks
Alex





no the normal would be either (0,0,1) or (0,0,-1) depending on which way you want the normal to face...you'd probably want (0,0,1) cause then it would face the positive Z direction

normals are always between -1 and 1




A CRPG in development...

Need help? Well, go FAQ yourself.


"I'm gay, please convert me." - Nes8bit

[edited by - Nazrix on June 27, 2002 1:54:38 AM]

Share this post


Link to post
Share on other sites