This might be weird or totally impossible. I have a subdivided cube which is the ocean. I use cycles node displacement to create waves (have to because the waves require complex node tree) I have a flat plane (technically a disc) where, using textures and several noise nodes plugged into the alpha, i have created foam to be visible where waves and land intersects. The shape and uv of the disc is important, i couldn't simply add the nodes onto the wave / ocean object. There is a discrepancy between the foam and the ocean, because the ocean has waves. I know that i can't shrinkwrap the foam object onto the ocean object because node based displacement is calculated buring render and not actual geometry. But that's essentially what has to happen. Either there's a trick that allows me to do this, or there's some method allowing me to project, as if with a cinema projector, the foam object and it's nodebased alpha channel onto the waves, like a shadow, but white. and keep in mind that there's actual land in there too. Screenshots are obviously simplified with a diffuse shader instead of the nodes: waves with node based displacement
Syncing displacement textures between two (or more) objects/materials is as easy as mapping to a single object.
First link the texture coordinate of the ocean object to the object itself like so
Then copy the Texture Coordinate, Mapping, texture and Displacement nodes to the material of the foam.
As long as you keep the
Scale values of the mapping, texture and displacement nodes in the foam material the same as the values of their counterparts in the ocean material they should displace identically.
Further, if you need the foam to flatten toward the shore you can just use a colorramped gradient to ease between displaced water and the flat ground.