How do I use the custom materials?

I’m using TMS Tile images to define the areas to be displayed as water.
I followed the idea of this link to do it:How do I set a water mask material? - #5 by Kevin_Ring
But I don’t understand “create a custom material that reads from the overlay texture”, how to reads from the overlay texture,and what should be read? What I mean is how to match custom materials with the Raster overlay? I want to render the TMS Raster overlay as a water effect instead of the entire Earth.
Looking forward to your reply, thank you!

In other words, how to determine which Raster Overlay the current mesh corresponds to?