#### Archived

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

# Front and back of a surface with lighting

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

## 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 on other sites
Sounds like your normal is facing the wrong way.

Death of one is a tragedy, death of a million is just a statistic.

##### 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 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 on other sites
you get the normal by taking what''s called the cross product of the 3 points of a triangle and normalizing it.

1. 1
Rutin
45
2. 2
3. 3
4. 4
5. 5

• 10
• 28
• 20
• 9
• 20
• ### Forum Statistics

• Total Topics
633407
• Total Posts
3011700
• ### Who's Online (See full list)

There are no registered users currently online

×