Im new to unity shader graph and I have no clue how to make it so the water changes from light blue to dark blue depending on how far away it is from an island. I also want the water to change transparency based on deep the water is. I’ve looked online everywhere and cant find anything on it, It would be very appreciated if someone could help me or find me documentation.
Try something like this as a start. Instead of ‘how far away from the island’ it’s more based on depth but I assume the water is getting deeper further away from the island so this works.
And here is some information about what I’m doing.
Let me know if you need more information.
There is an abundance of tutorials online on how to create water with a simple 2-color gradient.
I recommend this one if you want more. https://roystan.net/articles/toon-water.html
It is not specifically for shader graph but the logic stays the same.
Edit: Be sure your shader master node is set to have a transparent surface. Also make sure that your renderer is generating a depth texture.
Screenshot by Lightshot I tried to get it to work but it just looks like a black plane that is very transparent
Screenshot by Lightshot
What values are you using for your colors?
I used alphaclip 0, light blue for color A with a bit of transparency, then dark blue for color B with 0 transparency.
Also I use URP, I don’t know what any differences might be with HDRP.
Do you think HDRP would be the problem or the fact my shader graph was out of date?
No idea, I don’t understand what issue you are having. What issue are you having and what values are you using for your material?
Screenshot by Lightshot I managed to fix it by changing the alpha on the color itself didnt realise it was all the way down lol, Im still having a problem now only the deep water is showing up the shoreline water isnt there
Play with the distance value. It will determine how much of the water is seen as ‘shallow’ or ‘deep’.
It worked but Im having one more problem the shoreline render distance is terrible do you know to fix it? Screenshot by Lightshot
Try to add this. Is that what you mean with render distance?
And I mean yeah you’re getting a depth difference using distance from camera. You can’t come too close to the water. It’s a limitation of the technique.
Thanks so much it works perfectly, may I ask a question what is the difference between unlit graph and lit graph?
You can use lit if you want.
Lit means the material will be influenced by the light in the scene.
Unlit means the material will not be influenced by the light in the scene.
I usually just use unlit first to focus on the shader itself.
When you use lit you get extra properties like smoothness, metalicness etc which relate to how the material surface reacts to the light it receives.
Do you understand the water shader btw? With the explanation I added.
I understand the explanation, For some odd reason the newest version of unity 2019.2.17f1 breaks this effect and it doesnt work anymore. No matter how much I play with the settings nothing works. http://prntscr.com/qnqznt
Hey there @ImperialDragon98 , plase file a bug report using the process detailed here: Unity QA: Building quality with passion and let us know your ticket number so the team can have a look. Thanks!