Perfecting Water Shader

Manually calculating look better. But DDX/DDY is simpler so you can use that as reference so you know that manual calculations are right.

Hum, the waves “break” depending on the depth of the ground beneath them. Then their speed and height is also relevant for the resulting behaviour and foam. Also the angle of the beach should be taken into account, as waves against a steep cliff/rock cause other effects like on a shallow sandy beach.