View Full Version : problem with lights
we created a shooter and tried to create a lighting source that follows the camera. the problem we have is that in some angles the light is too strong and in other angles the light doesn't shine on the objects of the maze.
we enabeled the lights, defined light values, defined position, direction (spot_direction), attenuation.
we draw the lights position after all transformations are complete.
do you have an idea what might be wrong?????????
03-13-2001, 07:02 PM
Have you checked the normals for your triangles? I believe that magnitude of the normal vectors affect the amount of light that is reflected. If you are using an algorithm that doesn't acount for the size of a polygon, the magnitudes and the resulting reflected light might be off. I'm not terribly sure though, maybe someone else can confirm this.
03-14-2001, 10:39 AM
How big are the faces that the light shines on? The lighting in OpenGL is calculated per vertex so if you have a light source that shines in the middle of a face, but doesn't affect any of the vertices, you'll get no light. This effect can be seen in EverQuest... when you are running along at night with a light source, you will only see the light on the ground as you get near the vertices. A very annoying effect, IMO. http://www.opengl.org/discussion_boards/ubb/smile.gif
You should also check your normals to make sure they are all unit length. If you use glScale at all, the length of the normals can be affected too. You can use glEnable(GL_NORMALIZE) to have OpenGL always rescale the normals to unit length, but I'd only recommend this if they are getting scaled. In other cases, it'd probably be better to normalize the normals yourself.
Powered by vBulletin® Version 4.2.2 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.