Jump to content
  • Advertisement
Sign in to follow this  

OpenGL Depth-Pass stencil shadows problem?

This topic is 2968 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts


I've just implemented a test case rendering shadow volumes in OpenGL using the depth-pass stencil buffer technique. Everything seems to be working pretty well in general (using a light source against a height map). However, I've run into a problem that I haven't seen described anywhere and I'm looking for some tips/suggestions.

How do I eliminate the shadows that form against the far clipping plane (or skybox if in use)? My first thought is to render a 'back cap' at the far end of the shadow volume. However, I never see anyone describing this problem with depth-pass, so I wonder if I am missing something obvious?

To visualize the problem, picture a perfectly flat landscape with a single mountain. When the light source is at or below the peak of the mountain, the shadow projects horizontally until it intersects with the far clipping plane. If I am viewing at an isometric angle, the technique naturally cases a shadow at the clipping plane as the shadow volume back faces get clipped against the back plane before they can 'decrement' the stencil bits that the front faces of the shadow volume incremented.

Any ideas would be greatly appreciated!

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!