PDA

View Full Version : Stencil Routed A-Buffer



quasarquantum
02-03-2009, 05:59 AM
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 (http://www.sci.utah.edu/~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,

Quasar

Dark Photon
02-04-2009, 07:03 AM
Hmm. Don't know off hand, but this reminds me of an extension:

* NV_explicit_multisample (http://www.opengl.org/registry/specs/NV/explicit_multisample.txt)

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).

quasarquantum
02-06-2009, 04:49 AM
It does work with that extension :-)

Ido Ilan
02-15-2009, 11:39 AM
Hi,

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

Ido

Verdagon
01-27-2011, 01:06 PM
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?

Dark Photon
01-27-2011, 05:23 PM
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:

* What is and why do we need explicit_mult...ferred shading) (http://dabroz.scythe.pl/2009/09/16/explicit-multisample-real-antialiasing-in-deferred-shading)
* OpenGL 3.1 explicit_multisample VS OpenGL 3.2 multisample textures (http://dabroz.scythe.pl/2009/09/23/opengl-3.2-multisample-textures)