If you’re on this blog, I’m guessing you love video games. And you should, they’re awesome. But I’m also guessing your interest is deeper than the average “I buy Madden and CoD every year!" gamer. In this series of articles, I’m going to be going “under the hood," so to speak, and writing about the challenges that game/ engine/ hardware developers face when making games, how they’ve addressed them over time, and what the future looks like. Today’s subject: water.
Back in the halcyon days of the N64/ 3DFX, we didn’t much think about water. The prevailing attitude was one of “holy ***, this is 3D! Crank up the Pearl Jam and let’s pull on Mario’s face!" And it shows: if you examine the water in these early games, they’re usually blue-tinted blocky areas that you can see through. In some games, jumping out of the water made a little splash sprite appear, but that was all the thought that was given to water.
It’s a me, Mario–hey kid, stop-a that!
Eventually, though, we started to realize that water doesn’t look or act like this. The number of polygons on the screen was going up, the color depth of our video cards made the jump from 16 to 32 bit, and we started wanting more realistic water. Scientists had long since examined the properties of water, and computer engineers started to take an interest in water. Over a long period of time (The Voodoo Graphics PCi Card came out in 1996), video card engineers, API designers, and game developers have slowly addressed the problems with water rendering. But before getting into this, let’s try and understand the problems of water rendering before talking about the answers.
Experiment time! Get a glass and fill it halfway with water. Hold it up to a light. It should reflect that light, while still being translucent. Look very carefully at the line at the top of the water. You should notice that it is slightly bent upward along the side of the glass. This is called the capillary effect. Stick your finger in. The water level will rise (this is called displacement). Now pull it out rapidly. Water will come splashing out along with your finger. This is the capillary effect again, along with the surface tension of the water being splashed about. Now drip it onto a leaf. It will form a ball because the surface of the leaf is hydrophobic. On other surfaces, like a brick, it will soak right in. Drip two drops of water right next to one another on the counter. They should stick together. This is because water is polar, and therefore attracts itself. Now shake your glass vigorously (you did fill it halfway, didn’t you?). The water will slosh about due to a combination of surface tension and inertia. Because of the deformable nature of water (we call water a soft body), its reactions are very difficult to predict.
That was a glass of water and a high school physics-level study on the properties of water. What if you were observing an ocean? Then you would have to account for those basic properties of water when acted on by winds, the tides, and the 1.43 zillion things that live and move in an ocean (yes, there exactly 1.43 zillions lifeforms in each ocean. It’s just science, don’t question it). Kinda gives you an appreciation of the difficulty of realistic water modeling, doesn’t it?
The first (and easiest) problem dealt with was the addition of reflection. Compare water in The Legend of Zelda: Ocarina of Time with Jet Moto. Reflection really helped! There were problems (the dynamic range of lighting in older models of DirectX/ OpenGL made the reflection of bright sources look bad), but it was a start. This reflection problem was fixed with the advent of high dynamic range rendering (HDRR). With HDRR, the lighting model used has been updated to allow for very bright lights. The result is water that doesn’t look “flat" when reflecting light. If your character is standing on the beach staring at the ocean on a sunny day, you will now be properly blinded like you deserve. Progress!
Don’t let the emulator and fond memories fool you: Zelda never looked as good as this.
On the physics end of things, some games gave water a “ripple effect" (for an early example, consider Waverace 64; for a later example, see Morrowind), but it didn’t look right. Newer games have had water slosh about (consider Oblivion, apologies for the guy talking in the link), but it still didn’t look right. Some of the best “current-gen" (yes, I know your computer can do better. No, I don’t care.) examples of water behavior are Bioshock, Red Dead Redemption (skip to 2:00), and Skyrim. They beat the *** out of earlier efforts, but there are still problems. Realistic water was still a dream.
The future looks promising. Using a combination of hardware tessellation techniques, advanced physics models, particle effects, and HDRR, excellent water has been rendered. Consider Crysis 3 (running in DirectX 11 mode?your Xbox 360, PS3, or Wii U won’t look like this) or the NVidia Water Demo (DiRT 2 also uses this technique, but frankly I don’t think it looks very good). The PS4 and Super Xbox (whatever they’re calling it) should both be able to render water in this way, which means that the future is bright for us water lovers.
The future of water! (picture from Crysis 1)
In closing, I feel it is appropriate to pay homage to Homer Simpson: