I am in the process of implementing a 3D billboard, but writing to gl_FragDepthEXT is not working as expected. I think that maybe the drawn pixels is whatever is furthest from the camera. I’ve also tried flipping the sign of the gl_FragDepthEXT in case I got my camera orientation reversed, but to no avail. gl_FragColor is mapped from the fragment z depth and the color/shade looks as expected, so I think math is correct.
Here is a description of how the billboard is implemented - each “sphere” is actually comprised of two triangles that always face the camera. At each fragment position, the z-depth is calculated as if the surface was in fact spherical and that is written to gl_FragDepthEXT.
I have created a jsfiddle to demo the issue. All the spheres are on the Y-axis and the camera is on the Z-axis.
https://jsfiddle.net/ra802wez/
And this is what it looks like. I think it’s either a blending issue or an issue with the depth buffer.