3

I am creating a scene where I use a box to represent a room and different models within that box. When I enable lighting, my models light up fine but the room itself (the inside of the box) does not light up, or rather it is darker than it should be. Is it because I am trying to light up the inside of a cube? I am sure the normals are correct. Please let me know what you think!

I suppose the normals aren't correct but how do I go about finding the correct normals for inside of the cube. Currently, I am only passing the center point of each face into the normalf function.

sudo
  • 329
  • 7
  • 14
  • Clarify: when you say the normals are correct, are they pointing to the inside or the outside of the cube? – benzado Nov 14 '10 at 06:59
  • I am not calculating the normals, I am just passing the center points into the glNormalf. – sudo Nov 14 '10 at 07:14

1 Answers1

5

If you pass in the center points your normals will be facing the wrong way.

For example, if your cube is 2 units in size and centered on the origin, the center point of the face on the positive X axis will be (1, 0, 0), and that would also happen to be the correct normal for the outward facing side of that face.

However the face pointing inwards will have a normal that's the inverse of that, i.e. (-1, 0, 0).

Alnitak
  • 334,560
  • 70
  • 407
  • 495