I need something to be cleared up for me, and I hope this is the right place to ask my question:
I intend to attempt stochastic transparency, where I will draw glass panes and smoke particles onto the g-buffer for deferred shading. For every 2x2 cell of pixels, I will allow up to 3 of the 4 pixels to be used for glass or smoke. The last pixel is always the opaque background. But say we have this situation:
- (Near clip plane)
- Smoke particle
- Glass pane
- Solid wall
- (Far clip plane)
The smoke particle is in front of the glass pane, and would occupy all 3 pixels. This I do not want, and therefore I will need to check whether neighbouring pixels in that 2x2 cell already have 'smoke' or 'glass' written to them, rather than just the simple Z-check.
I therefore wish to sample neighbouring pixels from the same g-buffer that I'm currently writing to, but this seems not possible, am I right? And why do the depth & stencil buffers seem to be exceptions to this, or does this have something to do with only reading the exact pixel you are about to write to?
I hope the way I formulated the question(s) make sense, and is sufficiently detailed.