Archived

This topic is now archived and is closed to further replies.

Stencil shadows?

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

Hi, 1. I wonder if anyone know a tutorial on how to implement real-time stencil shadows with DirectX7/8. I have seen the demo from the SDK but I would like some explainations i guess 2. That SDK demo and other demos run so slow. I know I only have a TNT1 but I''ve run games that run much faster. Are there other faster techniques that coulde be used to get the same shadow effect? Thanks

Share this post


Link to post
Share on other sites
In a nutshell, you

1. render a ground plane
2. create a matrix which essentially renders the light''s viewpoint from the camera''s point of view
3. render the shadow caster into the stencil buffer using that new matrix.
4. render a big black/gray rectangle using the stencil buffer to mask it so only the shadow parts are darkened.
4. switch back to the "normal" matrix
5. render the shadow caster the usual way.

Sometimes games are faster because they cheat. One way I''ve been able to cheat is to use a much lower res version of the shadow casting object for the shadow pass. Usually, you can''t see the difference, and it''s "cheaper" to render.

Share this post


Link to post
Share on other sites