Jump to content
  • Advertisement
Sign in to follow this  
Kryzon

[Stencil Shadows] Quick question

This topic is 2996 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

Hello,

I wanted to ask how is it possible to blend stencil-shadows with the underlying geometry, just like seen in the following screenshot:

Blended Stencil Shadow

You see that those shadows aren't flat black. They blend with the fragments "underneath" them.

Although I have the source to that demo, I can't make out which part is responsible for this blending feature. Can someone give me a direction?

Thank you.

Share this post


Link to post
Share on other sites
Advertisement
As far as I remember stencil shadows are done by first creating the shadow volume and rendering it in to the stencil buffer. Then you just enable stencil testing and draw a full screen sized quad. This will draw the quad only on the areas where the stencil buffer was set which makes your shadows appear.
So if you draw a fully opaque black quad on the screen all shadows will be 100% black you can play with the transparency of that quad.

Share this post


Link to post
Share on other sites
There's no need to use a quad.

You render the Ambient pass, then render to the Stencil buffer, and then you'd do an aditional pass for each light in the scene. The thing is, I only have one light in the scene (the sun), so the shadows would be total black (because there would be only one pass).

Is there a way I can make the stencil shadows slightly transparent, like in the screenshot above?

Share this post


Link to post
Share on other sites
if you render your ambient pass first, your shadows won't be black, they will have the lighting that comes from the ambient.
so, instead of rendering just the full bright lighting outside the shadows, you render the scene first with like 50% ambient and then on top you render additive the sun lighting (with sun brightness set to 50%). this will result in the effect from the screenshot you posted.

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!