PDA

View Full Version : Strange Lighting



AtheistGod
08-04-2001, 03:51 AM
Hi all,

I'm not sure if this question belongs here, or weather there should be an intermediate forum for Q's like this.

I have a terrain engine that works fine, as does the lighting ... sort of. The problem is, in all the code people have been giving me they seem to be leaving out one thing. There is a DiffuseColor array (maybe called something similar), an AmbientColor array, and a LightDirection array. The code I am using performs everything as it should, but I never anywhere in the code use my LightDirection array!

Lighting looks brilliant, but when I look down, the terrain gets brighter. When I look up, it gets darker. The lighting direction is entirly dependent on my direction, not the LightDirection array that I WANT to use.

Does anyone know where I can plug this array into the code to use it's values so the sun isn't dancing all over the sky lighting things up in accordance with my angle?

Thanks for any help,

Andrew.

AtheistGod
08-04-2001, 04:18 AM
I just saw wpcmmx's post below called 'Lighting problems'. He wasn't all too clear, but I think he has the same problem as me. He talked about his lights changing direction when he moved, which is what happens to me.

After a lot of analysis though, I can conclude that it is changing to accord with my ANGLE, not POSITION on the map. Maybe it's different when your using positional lights, instead of directional ones like me.

I'm using standard windows OpenGL, not GLUT or anything like that.

Thanks all,

Andrew.

Bob
08-04-2001, 04:23 AM
Sounds to me that you are placing the light only once. You need to place the light after you set the modelview matrix, each frame.