The Ocean Water System
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:
- removing this milky look, and get a full control over the color, saturation, contrast and in general look of the water.
- adding an automatic shoreline. I want the shore to adapt when the water is moving.
- 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?
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.
- 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):