Possible to access the stencil buffer from a Cg shader?

Started by
3 comments, last by ShmeeBegek 19 years, 4 months ago
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
AIM ME: aGaBoOgAmOnGeR
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.
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.
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 ?

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

AIM ME: aGaBoOgAmOnGeR

This topic is closed to new replies.

Advertisement