Sign in to follow this  

help in stencil shadowing

This topic is 4774 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'm developping a fatasy strategy game, and I would like to generate shadows of the units on the terrain. I read the papers about stencil shadow volumes, and I don't understand a few things: - If I have 50 unit with 1000-1500 vertices per unit, is the stencil shadowing the best solution? - What if I'm using fragment/vertex shaders (lightning, miltitextring, etc.) with VBOs? Will the stencil work? Thanks!

Share this post


Link to post
Share on other sites
I'd suggest that stencil shadowing is -not- the way to go in this situation, purely because of the amount of geometry involved. You could probably produce a very satisfactory effect simply with "blurry blob" shadows on the ground under each unit.

That said, stencil shadowing should work ok with most rendering systems. The classic method is to render everything with ambient light, then render everything with lighting minus those areas stencilled out by shadow, using additive blending on top of the ambient pass.

However, you will need to know the final rendered vertex positions of all the geometry that is casting shadows, because silhouette determination needs to be done on the CPU. (Technically, it's possible to assume every edge may be casting a shadow and let the GPU take all the load, but in general this will be slower.) So you may have to be careful with your use of vertex programs, ie avoid manipulating the vertex position. Multitexture and fragment shaders aren't going to be a problem.

Share this post


Link to post
Share on other sites

This topic is 4774 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.

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