2D top-down water shoreline foam effect

Hey,

I have a procedural top-down island generation system in 2D and I’ve been trying to figure out how to create a water shoreline shader for something like this, as i’ve only come across ways to achieve this in 3D using camera distance and so on. I’m looking to achieve this in 2D for a top down island. Here is an example of my island:


The effect i’m trying to achieve:

Maybe it’s possible to use an animated sprite shape that surrounds the island?

Instead of pure shader solution, have you thought about using rule tiles if you are using Unity’s tilemap system? I think you could use rule tiles to make shape that follows the shoreline.

Yes I’ve thought about that, but the issue is that I need them animated and for some reason I can’t use animated tiles in a generated island, it only let’s me hand paint them. I was looking for something more dynamic and modular, but haven’t come across anything yet

I am also looking to create an effect like this, without the use of RuleTiles. However, seeing as you have said that you would settle with using Animated RuleTiles as a solution, you can actually use animated tiles in your generation. Just pass the Tilemap into the script and when you loop through your noise array, you can just do this:

Vector3Int position = new Vector3Int(x - (width / 2), y - (height / 2), 0);

// Code to determine which tile you should place, in this instance I will just use the keyword PlacingTile.

// Place the tile in the tilemap.
Tilemap.SetTile(position, PlacingTile);

Hope this helps! :slight_smile: