Jump to content
  • Advertisement
Sign in to follow this  

Stencil Shadow Problem When Clearing Stencil Buffer!

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

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
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!