View Full Version : light
03-19-2003, 09:42 AM
I am appending some rendering to a 3rd party drawing (i.e. I have no way to know their setting). I can see their models with shadow, and some faces opposite to the light are darker. But my appended model, say a cube, has all faces equally light. What commands am I missing? I disable GL_CULL_FACE, GL_BLEND, enable GL_COLOR_MATERIAL, GL_LIGHTING, and call glPolygonMode(GL_FRONT_AND_BACK, GL_FILL). Could you help? Thanks.
03-19-2003, 09:56 AM
Do you use textures? Maybe you have a wrong texture enviroment, it should be GL_MODULATE. Or maybe you have too much ambient or emissive light.
Originally posted by jyoung77:
I disable GL_CULL_FACE, GL_BLEND, enable GL_COLOR_MATERIAL, GL_LIGHTING, and call glPolygonMode(GL_FRONT_AND_BACK, GL_FILL). Could you help?
With all those enabled, I smell dodgy normals.
03-19-2003, 04:54 PM
The following is how I set up my texture environment. It makes no difference with or w/o them. If the problem is
too much ambient or emissive light, the 3rd party software should have the same problem (but they don't), right? Do I have to set up normals for my objects' faces? Please help. Thanks.
glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
If you don't specify normals they default to 0,0,1 (I think thats right). The shading of faces due to lighting is calculated using the dot product of the light vector and the face normal. If all your faces have the same normal, they will be shaded (lit) in the same way. So yes, you do need to supply a normal for your vertices.
This is a pretty basic 3D/opengl fundamental. Can I suggest you look at the tutorials here (http://nehe.gamedev.net)
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.