Hi guys, found something disturbing.
I am putting together a deferred renderer and hit a nasty issue.
When a pixel has an alpha of zero,it is not written to the depth buffer.
My colour render target is created with a 24bit depth buffer, depth buffer is enabled, and depth clipping on the rasteriser state is enabed, but the depth buffer does not work.
You can see this in this video
After a lot of scratching my head, I realised I was storing the materials specular strength in the alpha channel of the color render target, which is zero for the water at the moment.
So I did an experiment by setting this to 1.
Now the depth buffer works.
I am going to work around this by creating another render target and storing specular data in this.
Want to know what is going on though as I am seeing other issues that don't make sense. Like even though the specular strength is 0, I still get specular terms in the final image.
This makes me think some alpha blending is going on when I don't want it to.