The Ocean Water System

I love Playway Water System… but the ones who really knows me, are aware that I have some experience with water shaders!

90% of the work made by Playway is a complex and powerful framework, that can save presets, and manage the different shaders. 10% is made in the shaders themselves.

This shader seems to be done by a good mathematician. FFT/Gerstner waves are the best and in general, the water is moving great. But here is a list of things that I want to change in order to use it in my game:

  1. removing this milky look, and get a full control over the color, saturation, contrast and in general look of the water.
  2. adding an automatic shoreline. I want the shore to adapt when the water is moving.
  3. having a smooth way to fade from one preset to another. The demo is doing it, why no function for doing it in the shaders?

Abracadabra, here is the improved Playway shader inspector.

I added a profile merging system. I just looked how the demo was doing it and added the feature inside the inspector.

Then, I added Gamma, Brightness, Saturation, Contrast and optionally Hue (I disabled it because it sucks some GPU for nothing).

And finally, I  checked the shaders and it happens to be more or less a copy of the Unity’s Standard shader patched with Water4, so the shoreline code from Water 4 worked almost without a change!

I got some problems with the shoreline been static, so I added some UV animation (cos(uv)). And here we go (check the pictures and the video).

I also changed the fact that the shader strictly follow the color of the sun, which in many case (rain) is not working, so now I give to the sun a 30% importance. Also the Shoreline is not affected by the sun color, so that it stay white in the night.

Playway has its own foam shader but boy, that is like using a bazooka to kill a mosquito, and in the end the foam is looking really bad. Having a simple foam texture without normal map is visually better and faster.

The result is a shader that is compact and quick, it would even work on Mobile or VR.

Now the water is doing everything I want for my game:

  • Color adaptation to the light and Global Illumination. Reflection and refraction that are taking about 10% or less of the process
  • A real dynamic shoreline that moves and adapt when the water move.
  • Real shadows on the water, which is very important for the general ambiance specially the morning and the end of the afternoon.

And of course, underwater, and other things that Playway designed in the original package.



Here are some pictures, but nothing is better than a video. I have a 24 km2 area with shore that is working perfectly now, and it works any time of the day. These pictures are not transparent + shadows.

These pictures are with transparency + shadows.


Here is the video (shader not transparent):


Author TheWolf
Categories Research & Dev
Views 32810

Comments (7)

  • Thiago Travi
    May 24, 2017 at 6:22 pm
    Hey Wolf! That was a super smart implementation. Are you planning to share it? Congratulations for the hard work!
    • TheWolf
      May 25, 2017 at 7:01 pm
      Why helping the author, I am not in the beta, I have asked, received an old version and now he doesn't reply...
  • generic cialis
    April 27, 2018 at 11:10 am
    Amazing tons of excellent tips!
  • Dobalina
    July 22, 2018 at 3:25 pm
    I was fortunate to purchase PlaywayWater off the asset store when it was still available, though much like you, I don't care much for the foam shader it came with. I was also a bit disappointed there were no shadows. With the discontinuation of Playway Water, are you able to release your modifications? I'd absolutely love to play with these additions.
  • JamesSlara
    October 21, 2018 at 1:54 am
    Could you please extend them a little from next time? Thank you for the post.
  • JamesSlara
    October 22, 2018 at 8:36 am
    But should remark on few general things, The site style is perfect, the articles is really nice : D.
  • viagra generico
    March 31, 2019 at 2:20 am
    First of all I want to say terrific blog! I had a quick question that I'd like to ask if you do not mind. I was interested to know how you center yourself and clear your thoughts before writing. I have had a difficult time clearing my thoughts in getting my ideas out. I truly do take pleasure in writing but it just seems like the first 10 to 15 minutes are usually lost simply just trying to figure out how to begin. Any recommendations or hints? Cheers!

Comments are closed.