Lindley
07-06-2007, 12:14 PM
I'd like some details on precisely how stencil and zbuffer culling work.
In particular, let's say I've masked out part of an image in one pass, and I'd like to mask out more of it in the second.
What I'd like to do is, on the second update, only bother spending processor time running fragment programs on those places which were not previously masked out.
glStencilFunc appears to only control whether *color* is written in a given location----not whether anything at all is attempted there. So that isn't quite what I want. I figure this since you can set the stencil buffer up even with GL_NEVER set as the func. (Unless, of course, that's simply making use of the stencil fail case in glStencilOp...?)
Early-z may be useful, since that seems to prevent fragment programs from running entirely. However, I can't update the zbuffer this way, because doing so will disable early-z!
So I'm thinking I may need to do some sort of joint early-z/stencil approach, where each is updated by the other in turn.
What I need to know is where in the pipeline, precisely, each of these tests aborts rendering of a given fragment.
In particular, let's say I've masked out part of an image in one pass, and I'd like to mask out more of it in the second.
What I'd like to do is, on the second update, only bother spending processor time running fragment programs on those places which were not previously masked out.
glStencilFunc appears to only control whether *color* is written in a given location----not whether anything at all is attempted there. So that isn't quite what I want. I figure this since you can set the stencil buffer up even with GL_NEVER set as the func. (Unless, of course, that's simply making use of the stencil fail case in glStencilOp...?)
Early-z may be useful, since that seems to prevent fragment programs from running entirely. However, I can't update the zbuffer this way, because doing so will disable early-z!
So I'm thinking I may need to do some sort of joint early-z/stencil approach, where each is updated by the other in turn.
What I need to know is where in the pipeline, precisely, each of these tests aborts rendering of a given fragment.