[Water] How to: Create a Coastline / Waves around objects (images attached)

Iam trying to figure out of the following effect is done:

My conclusion so faar:

  1. Blue water texture applied to mesh
  2. Shader or Script calculates collisions between water mesh and other collision objects
  3. White waves (second texture?) are rendered somehow along the collision points.

Could someone hint me into the right direction how the white waves are done?

Hi,Have you got the perfect answer?

Now,I want to creat a game with terrain and the coastline,but i don’t have a perfect plugin with it ,can you give some advice for me.Thank you ! Best wishes~

Hey there. I dont know how much knowledge you have about shaders. But here is a quick advise how you could achieve this effect.

First create a 1D texture, defining the waves (so you’ll draw the amount of them, the thickness, the space between).

Then inside the shader for your water surface, you will need access to the depth/z buffer, to calculate the coastline. Normalize the Depth Variation into a Range from 0-1. And use this value as UV coordinate for your 1D Wave texture. Then you should probably add depending on the world position or vertex color. Some Variation (You could multiply and offset the uv of your 1D Texture with a Cosinus/Sinus Wave)

Thats all it should need for coastline :slight_smile:

You could probably also add a normal map that offsets your depth value for a bit more variation.

The way Nintendo does those kinds of effects is they model all of that stuff in manually. They’re panning textures on manually modeled geometry that floats just above the water plane.