Stylised Water Shader - Unity LWRP
- FraserJamesH
- Sep 22, 2019
- 2 min read
Updated: May 1, 2020
Here is the water shader I have been working on for the game. Water will surround the island/islands so it was important that I establish a shader to use early on and after trying the Shader Graph in the Unity LWRP (Light Weight Render Pipeline) I decided to go with it instead of trying to either write a custom code based shader or one from online. The Shader Graph was surprisingly easy to use but did have a few bugs as it is still in development by Unity. I have listed below a few helpful tutorials on creating water shaders but none seemed to have everything I needed all in one place so I used parts from all of them to create the final result. The shader I have at the moment offers lots of variation which is perfect as the game is in very early development. By far the hardest part was generating the foam around objects that intersected with the water plane but in the end I was able to achieve the effect by using the scene depth node as a mask which was previously just being used for the water depth around objects. By using the scene depth it also means that the closer an object is to the surface of the water, foam will be generated as it is classed as a shallow area. A restriction of the water is that for movement it relies of verts in the water plane as the shader uses vertex displacement, essentially meaning that the less verts the bigger the waves which could become an issue in the future if I want the effect of 3D foam on the shore. I have found a solution to this that might work but for now I will leave that for another post as I am unsure of whether I will use this idea or not.
SAND TEXTURE CREDIT :
Jaden Taylor
https://static.wixstatic.com/media/698d5b_533696d2e74149dbaa4f252fe2132180~mv2.png/v1/fill/w_1457,h_985/WaterShader_Graph.PNG.png
Comments