• Advertisement
Sign in to follow this  

Possible to access the stencil buffer from a Cg shader?

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

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
Advertisement
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
Surely you could put the stencil buffer to a texture and then use that ? .. Just a thought, I'm quite noob to all this stuff.

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

  • Advertisement