Stencil Shadow Problem When Clearing Stencil Buffer!

Started by
-1 comments, last by Brownmonster 19 years, 7 months ago
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
Cheers,Monster.http://www.brownmonster.co.uk/

This topic is closed to new replies.

Advertisement