Like you have seen yourself, when you rotate your camera your results change.
With both the approaches that I mention, that should most likely never happen.
I don't even understand how you can place a camera near the water and render depth without getting artifacts (since the near plane should cut into the terrain near the water edges).
I would imagine that you can get artifacts doing it like that as well since you then try to compare that to the real render of the scene I guess?
I would also imagine it would be impossible to sample certain pixels if it actually places the camera at the water level with the direction of the normal camera, since it would then be unable to generate the depth for water behind itself.
The more I think about this, the more problems I see.
It sounds like it would just be easier to use the same Z pre pass texture as you use for other stuff instead (such as SSAO, soft particles, etc). That is what the refraction camera usually does as well, just that it instead has a render flag that makes it render only stuff that are actually under water.
As long as you rotate your depth/refraction camera with the normal camera and just sample the depth without doing something special, you are most likely never going to get correct results.
Both of my approaches should fix that though.
Just imagine that you look from a beach from above, then you would see the exact depth of the water at any one point.
But if you sit at a beach and look out on it, you could look at a terrain 100 meters away, therefore getting the incorrect height because of the camera rotation. So if you would (for example) want to fade away the water near the terrain edges, it would be impossible to do so with a simple sample, instead you would have to either look from above (0, -1, 0) or you would have to somehow raycast to the bottom of the water pixels Y value to get its real height (which is impossible to do correctly as long as it is a screen-space technique).
EDIT: Not even my technique to raycast up to the water surface would work for that scenario.



