# Help Wanted Water, Waves Dependent based on distance from island

Discussion in 'Shader Graph' started by ImperialDragon98, Jan 16, 2020.

1. ### ImperialDragon98

Joined:
Nov 7, 2018
Posts:
28
I'm in the process of creating a shader for water and I managed to get a few things working, im also a complete beginner to shader graph and writing shaders in general. My end goal is to have water that has really small waves at the shore and very large waves in the middle of the ocean. Right now I have zero clue how to get started on this could someone please show me how I can achieve this or show me to documentation to help me?

This is my nodes for the water waves so far
http://prntscr.com/qoqibh

Unity 2019.2.17f1
Latest HDRP

2. ### alexanderameye

Joined:
Nov 27, 2013
Posts:
983
Introduce an amplitude value that multiplies the texture value. Then make this amplitude larger/smaller based on the water depth so waves in shallow areas (near the shore/beach) are smaller than the ones in deep water.

3. ### ImperialDragon98

Joined:
Nov 7, 2018
Posts:
28
Could you be more specific? What node are you talking about for amplitude value? Also I remember the last time you helped me you taught me how to do water color based on distance from island. I feel some of this logic would apply to this situation but I have no clue how to apply it

4. ### alexanderameye

Joined:
Nov 27, 2013
Posts:
983
Just multiply the texture output with a property and call that property amplitude or something.

Then indeed you can use the same logic I gave for the colors. First you get the depth by subtracting the alpha component of the raw screen position from the scene depth in eye mode. Then divide by a 'distance' variable, then saturate the output. This will give you a 0-1 output. The value will be '1' in shallow parts and '0' in deep parts. So you can use this to change the wave height!

Maybe use a 'one minus' node so you get '0' in shallow parts and '1' in deep parts. Then multiply the value with your wave's amplitude so you get no waves in shallow parts and the regular waves in deep parts.

5. ### ImperialDragon98

Joined:
Nov 7, 2018
Posts:
28
I multiplied the texture output with a property and I also setup the scene depth and screen position but where do I hook up the saturate node too? http://prntscr.com/qp7tef

6. ### alexanderameye

Joined:
Nov 27, 2013
Posts:
983
You can multiply by amplitude, before multiplying it with the texture.

7. ### ImperialDragon98

Joined:
Nov 7, 2018
Posts:
28
http://prntscr.com/qpbrb4 I cant connect the two multiple nodes together why is that?

Joined:
Nov 7, 2018
Posts:
28
unityunity