I have worked on a few water shaders in previous projects and there is something about it that I really enjoy doing. So I was eager to get started on the water shader for this project as well!
At this point I have tackled most of them, but one big task looms in the horizon: water interactions! (for boats, piers, things falling into water etc… this will be a difficult task to do)
I am pretty new to Unity shader graph having only worked on Unreal shaders and hand programmed shaders for Unity, so this also was a good exercise to learn Unity shader graph.
Getting the shader to deform the water was pretty easy. The most challenging things were to add the depth gradient and to recalculate the normals so that the deformed water actually reflects the light properly. I was able to repurpose a cartoon eye outline shader I created for a previous project for the depth gradient and I found an Unreal shader tutorial on how to recalculate normals and it worked 1:1 in Unity too!
I added a bunch of customisable controls for making it possible for me to tweak everything about the water while the game was running so that I could get exactly the look I was going for. Simply what my shader does now is it blends the opacity and the smoothness on points where it collides with geometry. Then it also changes color between 2 shades depending on how deep it is. The I have 2 layers of noise that are overlaid on top of each other. One I have set to really large, slow moving waves and the other has been set to create the small, faster surface ripples. It looks just fine for now.
Also, mobile performance for the water is great. I get no lag near water. The water culls beautifully and should be really lightweight to render on all platforms.
The sort of greenish / teal candy water I fell in love with when looking for references has turned into a lot colder, more “realistic” water as the project has progressed. It has a lot to do with me starting to look at colors from the Lethal Weapon movie series and other movies from that era. They tend to be VERY natural and unbiased on the color grade. It might also have to do with me using Google meshes and imagery for prototyping different game systems and blocking out the levels.