Advertisement

Problem or drawback with OpenGL lighting?

Started by September 21, 2004 09:46 AM
5 comments, last by Steve-B 20 years, 2 months ago
Hi I've created a small level in max and loaded into my program. There is a corridor that you start in and it turns left after a bit and then left again to another small corridor which leads to a small room with a point light in the center. The light has been set up correctly as has the surface normals of the walls. The problem is that the walls on the right hand side of the first corridor are very brightly lit as though the light has no obstruction between it and the wall. Clearly there should be no light reaching this wall or the wall on the right hand side of the second corridor. Is this a problem with OpenGL lighting or do I have to do something else to achieve the effect I'm looking for? I've tried playing with the Attenuation parameters of glLightfv but it makes little difference. Any ideas??
OpenGl doesn't do shadows. You will have to implement them yourself...

Look for Stencil Shadows, Shadow Volumes, Z-Fail etc. in the GameDev forums.

E.g: Theory

Cheers
Advertisement
Or shadow mapping...
If at first you don't succeed, redefine success.
OpenGL performs it lighting calculation individually for each vertex, after primitive-assembly in the pipeline. When calculating the lighting, OpenGL knows nothing about the scene around that single vertex. And so, shadows cannot be calculated with ordinary OpenGL lighting.

But like has already been mentioned, techniques for applting shadows in OpenGL rendered scenes do exist. The two most used ones are shadow volumes, and shadow mapping. They each have their pros and cons, so do some research, and decide which fits nicest for you...
I see. Thanks for the advice. Looks like I'll have to start investigating shadow volumes and shadow mapping. I guess I kind of new that I'd have to use shadows to achieve the effect I was looking for but I thought of shadow volumes/mapping as being used on the object within scenes not on the actual level object itself. Well now I know better. lol. I just hope that calculating large shadows for long corridors and large areas where there is little to no light doesn't severely hamper the running speed.

One question though. Would this problem occur if I used Per-Pixel lighting with the nVidia Register Combiners??

Cheers,
Steve-B
Quote: Original post by Steve-B
One question though. Would this problem occur if I used Per-Pixel lighting with the nVidia Register Combiners??

Cheers,
Steve-B


Yes.
If at first you don't succeed, redefine success.
Advertisement
lol. Thought so. :p

This topic is closed to new replies.

Advertisement