I packed this to the separate MaterialFunction [MaterialFunction][1]
Not sure that it possible to load directly from UE (you can try to copy this asset directly to your cintent folder)
It contains exactly this:
To insert this inside your material add CallCustomFunction node and connect it as shown on a picture
Stencil value input allow you to select working stencil value (less than boat interior and greater than boat exterior), by default it is 128
Unfortunately this can not be used with opaque and masked materials. On them depth buffers are inaccessible to read, Maybe it will be possible to pre-bake your boat depths picture each frame before rendering whole scene and use PixelDepthOffset to push water out from a boat. So, if your boat have near-square deeping it is possible to evaluate required PDO without any extra rendering, and both of these ways are bit complicated.