Last 2 evenings I’ve spent researching into water rendering tutorials, looking for a nice water effect shader. It is quite hard to find one. Most of the times the result is less than satisfactory and older OpenGL functions are used, resulting in complicated pipeline. Luckily I have found a few good ones, so here’s my first attempt – this is a test-bed example:
Notice how deep water has more deep colors and how far away water surface is more reflective. Colors and coefficients can be tweaked to make water look more muddy or crystal clear. Shallow water with the same as above settings looks good too:
There are no ripples and no sun specular highlight yet, I might add them later or see into trying out a different water shader first. This one has some imperfections:
See the deep water color, when the water depth changes quickly it is noticeable that the volume color is rendered on the water surface. That wont be noticeable much in the game, if there are no plateaus underwater. Another limitation is that only flat water surface is allowed and that surface has to be one per whole map. I can make it 2-3, but that would eat some more performance, because each next one will require additional rendering pass (~30% fps).
Questions for discussion:
– single flat water surface per level, is that acceptable?
– several unconnected flat water surfaces per level, is that acceptable?
– how important for mapmaking is to be able to edit water height level for each tile?
– anything related?