Sign in to follow this  
Brownmonster

Stencil Shadow Problem When Clearing Stencil Buffer!

Recommended Posts

Alrighty guys, Ive got a beast of a problem here, and have been racking my brains out on this for a while now... I am basically using stenciled shadows for the rendering of shadows in my game, i am drawing the entire scene first as normal, then rendering my shadow meshes using a different shader and extruding etc, and then quickly drawing a quad over the screen to show the shadow. Whats happening though is wierd, basically if i clear the stencil buffer every frame i get absolutely no shadow results what so ever. If i clear the stencil buffer every OTHER frame, i get a shadow cast for the second frame only so i get a shadow that flikers on and off, very bizarre. I have tried also sorts of stencil states to fix this but am still having no joy, currently im setting any front facing poly to a stencil ref of 0x1 and any rear facing poly to a stencil ref of 0x0. This means when i come to draw my quad i simply say if the stencil ref is equal to 0x1 draw the pixel. As i said it works every other frame, which is very bizzare. Can anyone shed any light on this? Cheers Steve

Share this post


Link to post
Share on other sites

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