Shore detection for water surfaces

So basically a plane with shoreline foam texture on it? How did you make “foam” to conform to the terrain ? (on that screenie above) Care to post your material setup? :o

Thanks