In many games where the player can go underwater, it seems like when you look where the top half of the screen is in the air, and the bottom half the screen is in the water, it's almost like the water doesn't exist and the player is... flying slowly with water sounds?

enter image description here

Is there a logical way to solve this? An algorithm? Doesn't seem like any solution has come up yet since many games still have this. I don't want to make the same mistake.

  • 4
    \$\begingroup\$ Modern games have shaders that are different for above and under water. It definitely doesn't look like this nowadays. I believe Crysis has pretty advanced underwater rendering: youtube.com/watch?v=yXxEZJdFjeM \$\endgroup\$ Jun 24, 2013 at 5:20
  • 9
    \$\begingroup\$ @sm4: I guess this game has this feature too. But the problem is that camera is not bellow the water, its above and you are able to see below because of near clipping. \$\endgroup\$
    – Kikaimaru
    Jun 24, 2013 at 5:34
  • \$\begingroup\$ @Kikaimaru I see, I did not completely understand the question. However Crysis doesn't seem to have this problem. \$\endgroup\$ Jun 24, 2013 at 5:42
  • 2
    \$\begingroup\$ Aww, but how else am I supposed to see if there are pearls at the bottom of the river? (Elder Scrolls Oblivion) :D \$\endgroup\$ Jun 24, 2013 at 6:14
  • 1
    \$\begingroup\$ Maybe you could check if the character "head" is underwater instead of the camera and don't allow the camera to go underwater unless the character is also underwater \$\endgroup\$
    – Luke B.
    Jun 24, 2013 at 14:39

4 Answers 4


How about simply not permitting this situation?

I don't know how you are making your game, but if you detect that the view will be partly underwater, you can force the camera to be above water, and only when the entire view would be below water, you can switch to the underwater view.

Depending on how you do it, this could mean that there is an additional delay from the moment where you start diving and when you actually view the scene from beneath the surface. This may actually be a good thing from a UX perspective, so feel free to experiment.

On a separate but related note, I wonder why most underwater scenes are rendered crystal clear... If you ever put your head underwater, you will notice that your eyes are not designed for underwater sight, and therefore everything seems blurry. You'd have to be wearing goggles to actually see clearly underwater.

And additionally, things look (and hear) very different underwater than above water. Water absorbs light much faster than air, so the farther light travels, the less light will arrive at your eyes. This means that the deeper you go, the bluer things look (red light has less energy, and is therefore absorbed more easily than blue light). In fact, at a mere 12 meters underwater, blood looks black, not red.

I've yet to see a non-specialized game that even tries to get underwater environments right...

  • 5
    \$\begingroup\$ Lots of games change the light and sound underwater. See the Crysis video linked in the comments above. I'm sure it's not perfectly realistic, but (a) most people don't have direct experience with deep underwater environments and (b) in games that have you going underwater, you presumably need to be able to see, to play the game. \$\endgroup\$ Jun 24, 2013 at 7:01
  • \$\begingroup\$ I believe most games don't do this simply because nobody would like to go underwater if they don't see anything there. Or maybe all the game main characters were trained by Moken people! news.nationalgeographic.com/news/2004/05/… \$\endgroup\$ Jun 25, 2013 at 3:10
  • 1
    \$\begingroup\$ In game development, this sort of "doctor, it hurts when I do this" solution is usually the optimum one. \$\endgroup\$ Jun 25, 2013 at 22:51
  • 1
    \$\begingroup\$ @TrevorPowell: I read your comment a dozen times and I still don't understand your point. Maybe you would like to elaborate? \$\endgroup\$ Jun 26, 2013 at 1:38
  • 2
    \$\begingroup\$ Apologies! It's a reference to an old vaudeville joke. The joke goes something like this: Patient: "Doctor, it hurts when I do this!". Doctor: "Don't do that!" I was just meaning to say that in games, often the simplest way to solve a problem is to stop the game from getting into a state where the problem must be solved. (eg: the easiest way to fix "the graphics look wrong when the near-clip plane intersects the water surface" is "don't let the near-clip plane intersect the water surface") \$\endgroup\$ Jun 26, 2013 at 3:20

The problem you are referring to has to do with the camera's view volume clipping through the water plane; typical "underwater effects" are done via full-screen post-process effects, and wouldn't look correct if the view is clipped like this (it would just be the opposite problem).

Even if you do bother to detect the clipping case (potentially difficult) and scissor or clip the otherwise full-screen underwater effect so it only applied to the underwater scene (which is a potential solution you could explore), you'd still have the problem of the actual water plane itself. The transition there would still be a jarring visual artifact. You could detect that plane and blur it heavily; this is probably the closest you can get to a real-world analogy of what the view may be through a partially-submerged camera lens.

Alternatively, prevent this from happening entirely: don't let the camera go below the water plane if the player is "above" the water or above the water plane when the player is "below" the water. This will only really work if you have discrete player operation modes for above/below water, and works best if there is a physical button or other clear and obvious action the player can take to transition between "swimming on the surface" and "swimming below the surface."

Instead of an explicit keystroke to dive, you could interpret forward motion while the camera is pitched down sufficiently to mean "dive." You can then use a graphical effect (splashes or whatever) to hide the camera's transition through the water plane, which it would normally not be able to cross.

We used a technique like this in Guild Wars 2.


Games usually turn on some sort of effects, primarily blue fog, when the camera is underwater. To handle the situation where the near plane clips through the water surface, you can turn on the fog shader when the camera gets close to the water surface, but then add some code to the pixel shader that calculates the point on the near plane corresponding to that pixel, and activates the fog only if that point is under the water surface.

If fog is done as a postprocess, by rendering a full-screen pass, this is especially easy - you just have to calculate the world-space position of each vertex of the full-screen quad or triangle on the near plane (with the inverse view/projection matrix), and interpolate this value down to the pixel shader; then you can check its vertical component and see if it's above or below the water plane.

For bonus points you can use the same technique to add a few-pixels-thick texture to represent the meniscus at the water surface, so it doesn't look so much like a sharp line.

  • \$\begingroup\$ (has problems if water surface is a mesh, but still a great general answer) \$\endgroup\$
    – Will
    Jun 26, 2013 at 9:07

I have two methods; One uses a shader, the other one could use a GUI. Both will start the same:

"Simplified" - If, Object(Camera) is in 3d Space(Water bounding box/whatever you choose) trigger a shader/GUI.

Shader will give more realism, you can apply a distortion Like This one

Fog Like Com. Boy stated, can be applied through GUI. Create a photo, with a partial transparency and use it as GUI on the entire camera view. For the photo you supplied I would try a brown colour.

This has been used in a horror game called Drea D Out. If the player approached a ghost, the screen would turn foggy. Although it wasn't used under water it gave a similar effect :)

You can always choose both methods, or make a shader that would change the colour.


Taken from : http://sahdan-share.blogspot.com/2013/04/dreadout.html

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .