Today when i was extending my procedural terrain engine i added water. I dont need big effects with the water so its just a blue plane at water level and some coloring according to its depth. But i have seen a problem when the shore is pretty plain which makes the water and the terrain be nearly coplanar. Expectingly this gives z-fighting and over all looks edgy.
Here is an image showing the effect:
In the internet ive seen the hint that i should use different z-planes for the two objects. So i decided to move the far plane away for the water so that it is nearer (relative) to the camera. That resulted in odd behavior. The water moved up and down with the camera. Next i tried to add a z-offset after the transformation in the shader. With that the water just intersected earlier with the terrain but the border stayed the same.
What techniques are there to avoid that kind of distortion at the edge?