I am trying to improve my water shader so i takes into account how deep the water is.
For this i need in the water shader to sample the depth buffer (i render the ground before the ocean, so the depth buffer already has the information i need when i am about to render the ocean).
The problem comes when i need to send it to my ocean shader. I read that i need to unbind the depth buffer from the current render target to be able to sample it. So right before rendering the ocean i call this :
md3dImmediateContext->OMSetRenderTargets(1, &mRenderTargetView, NULL);
But then my ocean grid does not have depth test properly performed, and it looks just wrong.
If i don't unbind the depth buffer, then i only sample the value 0 ...
I googled this a bit, but it's always explained with an engine using differed rendering. I might switch to differed rendering at some point, but for now, i just have a "normal" rendering pipeline. Is this incompatible with the ability to sample the hardware depth buffer ?