I only have partially opaque/transparent but not translucent sprites in my scene. My approach would be to render the scene to an FBO with a simple fragment shader writing gl_FragCoord.z
for opaque- or 1.0
for transparent regions to gl_FragColor.a
, then blending the alpha with glBlendEquation(GL_MIN)
.
Now having a texture with depth information on the alpha channel, I'd like to use it as a depth attachment and render the scene again, this time with potentially more expensive shaders to color it.
Compared to the usual far-near blending technique, this would benefit from early-z in the second pass and have low fillrate if the first pass was drawn near-far.
I have not found any material about this approach, but is it possible?