Devblog
Low-Polygon water

Low-Polygon water

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!

My goals for the water shader were

  • Low-polygon look -check!
  • Animated surface, duh -check!
  • Depth color gradient – check!
  • Depth distortion
  • Depth opacity fade – check!
  • Interactions with ships and shoreline – check
Water shader captured from unity scene view outside of play-mode.

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.

Read more about water & water interaction

Shallow waters

It has been a slow week for the project. But I managed to squeeze in some time to add water / rigidbody interactions and test and implement shallow waters into the game.

Large scale water interactions

I needed to create a separate water interactions solution for the large ship scene. I was not able to make the ship move, so Instead I chose to move the waves under it.

Water interactions

I got so lucky with creating the water interactions! I managed to find a water interaction demo project made with unity 5! I loaded it up into my current version 2020.2b and managed to get it working with a few tweaks to the source code.

Tags :

2 thoughts on “Low-Polygon water

Leave a Reply

Your email address will not be published. Required fields are marked *