Shore detection for water surfaces

Even though distance to nearest works on landscape, my method for generating waves had waves appearing over sand bars, and not nice sine waves: the entire sandbar just faded between white and blue. My wave-generation method using a gradient around the shoreline did not work with depth-based methods because it had waves crashing and distorting where no waves should be crashing at all. Once again, the only thing you can get with distance based functions is a very simple foam around the object itself. The distance-field method does not render fast enough for games, and the depth-based method does not produce waves around objects. So the best method, the only method that is sure to work when determining the shoreline, is a texture mask. And don’t knock it! This is how Assassin’s Creed III made their water: with a 512x512 texture mask for the shoreline. And their water was lovely.