Jump to content
  • Advertisement
Sign in to follow this  
zppz

cancelling a portion of stencil shadow

This topic is 4844 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'm thinking to use the simplest depth-pass kind of stencil shadowing in my game, having just one lightsource for outdoor sunlight. I'd also like to occasionally have point lights which light up nearby polygons, and cancel out their nearby shadows, but I don't want to do real stencil shadows for these lightsources. Since the actual shadow is done by rendering a final dark quad over the whole screen, I thought I could calculate the areas which would be brightened by the point lights and pre-draw some alpha there, so that the final quad would not be so dark in those places. Any suggestions about how to get the hardware to do the pre-drawing part? I know I could always calculate it 'by hand'.... hmmm need to clear existing alpha values first too. The brightened areas dont need to be occluder-correct or anything, just like normal vertex lighting would give is good enough. Does anybody do this? I get the feeling there is a better way.

Share this post


Link to post
Share on other sites
Advertisement
Well I expect it's possible with a pixel shader and setting the alpha blending function to 1 (i.e. GL_ONE,GL_ZERO in GL). I can't see how you can get lighting to affect alpha in that way without a pixel shader. Then you draw the final dark quad on with GL_DST_ALPHA, GL_ONE_MINUS_DST_ALPHA (or D3D equivalent). Seems an odd way to do things though. As for depth pass stencil shadows I wouldn't use them unless you're sure the near plane won't intersect the shadow volumes. Carmack came to the conclusion he couldn't do it and switched to Z fail.

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!