Making global sea that detects objects

Hello all

Im trying to make a material that detects when objects clip/encroach into it. This is so I can model landmasses and place them on the “globe” and have the teal blue waters auto-generate, thus removing the need to model offset polies and such.

The only way I could do it was to have a solid opaque sphere with another sphere scales slightly larger with a “distance to nearest surface” node. It works, it just does not work too well. There is real imprecision in how it detects the objects cliiping into it ( see shot)

Is there a way to improve this precision so that it will outline smaller objects and protuberances? Like the small island at the bottom?

Spheres work okay but im after making landmasses that, while chunky, still have the sorts of profile of a more real-world island.

please help!!