Edge detection and specific texture ...

Hi i working on ocean shader and i have a question, how to make the effect of sea foam at the edges and depth based opacity? I new in materials and still learning.