Sign in to follow this  
Steve-B

Problem or drawback with OpenGL lighting?

Recommended Posts

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??

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this