I started trying to improve water in Run Horrible Monster last week so my brother and I went and looked at a bunch of old games that tackled portraying what it’s like to be both underwater and out of water and learned a few things:
1. There’s no consistent way to do it.
2. Everything is sneaky cheats.
For example oftentimes games make it murky in the water but clear in the air. And pretty much every game that bothers with this just takes the world’s fog and switches around how thick it appears when you go underwater and then uses some visual effect to hide the transition. One problem with this method is that if you are underwater looking up, a mountain up in the air has suddenly disappeared into the water’s murk. Additionally the water doesn’t look nearly so murky from above.
One game that broke this rule was Ecco the Dolphin: Defender of the Future. We noticed that somehow they were managing to have murk underwater at all times and clear air above at all times, even when the game transitioned to a side-scroller where you could see both in and out of water at once!. They achieved this by giving each object a special underwater shader that makes it disappear into it’s own fog. A cool effect that basically requires all geometry be chopped in half at the waterline so that the top half can have a shader without fog and the bottom half can have a shader with fog.
We came up with a clever way to do them one better and make a much more dynamic effect by having the shader check it’s height every time it renders a pixel to see if its below the water level or not. Then not only does it apply fog to it, but also a moving textures as well. There’s no need to divvy up the objects into underwater ones and out-of-water ones and the effect is the same no matter where you look at it from, so there’s no need to hide your transition into water. And the really cool thing is that when an object is half in the water and half out it gets all those effects applied only to the part that’s in the water!
My guess is this may not be anything all that new to people in the know but we thought it was cool. (Though frankly its pretty surprising how scared most games seem to be of letting you go underwater and how many of the ones that do aren’t very dynamic).
-Tad
Notice the aquatic fog visible from above.
Look the barrel is blue below the waterline!!!!
Running on some foggy water.