Stencil Routed A-Buffer

Hi all!
I tried to implement a paper called “Stencil Routed A-Buffer” from Nvidia with OpenGL and GLSL, using the extension mentioned on one of the authors’ homepage L. Bavoil. What the paper does is routing samples by setting different stencil bitmasks for every sample in the multisampled stencilbuffer. The extension does allow reading from single samples after rendering, and setting alpha bit masks to render to specific samples per pass… but no separate stencil mask for every sample that could be decremented during the pass to render different values into each single sample.
Is it in any way possible to access the stencil buffer from within the shader, maybe with a packed depth stencil renderbuffer? Or can i in some way create a multisample stencil buffer? Maybe i am overlooking something…

Any help is appreciated,


Hmm. Don’t know off hand, but this reminds me of an extension:

Among other things, provides “The ability to fetch a specific sample from a multisampled texture”. Could be used to infer the stencil values, even if the multisample stencil buffer couldn’t be queried directly (and I don’t know – maybe it can).

It does work with that extension :slight_smile:


I’ve been wanting to try this approach myself in OpenGL.
Can you share a sample.


In that page, it says that the status, “Shipping in NVIDIA’s Release 180 drivers (October 2008)”

Is it safe to assume it got into all the other types of cards too by now?

Not only that, there’s been an ARB-generic version of that specific capability for years. It’s standard in OpenGL 3.2 (accessible on any DX10+ card).

See these links for a quick example:

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.