Sign in to follow this  
ShmeeBegek

Possible to access the stencil buffer from a Cg shader?

Recommended Posts

Hello, I was wondering whether or not it is possible to access the stencil buffer value for the current pixel in a Cg shader (much like one can access the color, depth, normal, position etc.)? This would speed up one of my projects greatly, so I eagarly await a reply, ~SPH

Share this post


Link to post
Share on other sites
Unfortunately no, it's not possible to directly manipulate the stencil buffer. The best way I can think of is to use passes to change the stencil buffer by some fixed function, and selectively kill fragments that you don't want modified.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
The amount of redundancy on this forum is rampant, because some people are just too lazy to read through one or two pages of previous threads. Or even, God beware, *search* for them !

http://www.gamedev.net/community/forums/topic.asp?topic_id=285817

Now that wasn't too hard, was it ?

Share this post


Link to post
Share on other sites

Sorry for posting something that was already up, I forgot to search (uncommon for me I swear ;) ). I needn't write to the stencil buffer, so that's okay, but it seems too bad that I must copy it to a texture in order to access it as that will be slow (but perhaps not as slow as extra rendering passes).

Thanks, ~SPH

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