Jump to content
  • Advertisement
Sign in to follow this  
NumberXaero

FBO depth dtencil

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

I have an FBO with an attached depth stencil texture. Writing only to the depth stencil, Im clearing the stencil to 0, and drawing two groups of geometry. When group one passes the depth test Im writing 1 to the stencil, when group two passes the depth test Im writing 2 to the stencil.

For testing purposes, Im drawing 3 colored full screen quads to a color attachment. Where the stencil is EQUAL to 0 (clear value) Im drawing red quad, where stencil is EQUAL to 1 (first geometry group) Im drawing green, and if stencil is EQUAL to 2 (second geometry group) I draw blue. Everything works, red clear 0, green 1, blue 2.

stencil EQUAL 0 (clear) red
stencil EQUAL 1 (group 1) green
stencil EQUAL 2 (group 2) blue

Now the problem, if I change the stencil test from EQUAL to LESS EQUAL, and test for <= 1, drawing red and then the blue EQUAL 2. I should be getting an all red screen with geo group 2 showing as blue, but I dont.

stencil LESS EQUAL 1 (clear, group 1) red
stencil EQUAL 2 (group 2) blue

The stencil cleared area 0, is not red but black, geo group 1 is red, and geo group 2 is still blue. So I end up with black, red, blue. LESS EQUAL seems to be ignored by the stencil.
But, if I do, not equal to 2

stencil NOT EQUAL 2 (clear, group 1) red
stencil EQUAL 2 (group 2) blue

I get the correct result. Anyone have any idea why it would do this? why does it seemingly ignore LESS EQUAL but not EQUAL or NOT EQUAL

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!