Skip to main content

Command Palette

Search for a command to run...

Water in Games is Not Real

How water works in video games. It's an illusion.

Published
9 min read
Water in Games is Not Real

Introduction

Every ocean you have sailed. Every river you crossed. Every pool you dove into. None of it was real water. It was all a trick. A very clever trick built from math and textures and a lot of creative cheating.

Why Not Just Simulate Real Water?

Real water consists of billions of molecules interacting. Simulating even a small portion in real time is too costly. Games must achieve 30 to 60 frames per second, and a true fluid simulation would exceed the frame budget.

So instead of simulating water. Games fake it. And they have gotten incredibly good at faking it.

The Surface. It Starts With Waves.

The foundation of almost all game water is a flat plane. A simple grid of triangles. To make it look like water you need to make it move. You do that with waves.

Sine Waves

A sine wave is a smooth curve that goes up and down forever. It has two properties you care about.

Amplitude is how tall the wave is. A bigger amplitude means taller peaks and deeper valleys.

Wavelength is the distance between two peaks. A shorter wavelength means the wave repeats more often. Which means more detail.

You feed a position on your plane into a sine function and it gives you back a height. That height moves the surface up or down. Add time to the equation and the wave starts moving.

One sine wave looks boring. But if you add multiple sine waves together. Each with different amplitudes and wavelengths and directions. You start getting something that looks like water. This technique is called Sum of Sines.

Sharper Peaks

Basic sine waves are too smooth and round. Real ocean waves have sharper peaks and wider flat areas between them. There are modified wave equations that give you this sharper shape. One famous one is called the Gerstner wave. Another simpler approach uses an exponential function to sharpen the peaks. The idea is the same. You take your basic sine wave and reshape it so the tops are pointy and the bottoms are wide.

Fractional Brownian Motion (FBM)

This is a big one. FBM is a technique where you layer waves on top of each other in a structured way. Here is how it works.

You start with one big wave. Low frequency. High amplitude. This is your base shape. Then you add another wave on top. This one has higher frequency but lower amplitude. So it adds smaller detail on top of the big shape. Then you do it again. Even higher frequency. Even smaller amplitude. Finer detail.

You keep doing this. Each layer is called an octave. Each octave adds finer and finer detail but with less and less impact. The result is a surface that has large rolling shapes AND tiny ripples at the same time. Just like real water.

FBM is not just used for water. It is one of the most important algorithms in graphics. It is used to generate clouds. Terrain. Fire. Anything that needs natural-looking layered detail.

Vertex Displacement

All of these waves need to actually move the surface. The technique for this is called vertex displacement. Your water plane is a grid made of many vertices. Points in 3D space. A shader runs on the GPU and moves each vertex up or down based on the wave math. The GPU does this for every vertex every frame. It is extremely fast.

Vertex means a corner point of a triangle in your 3D mesh. Shader means a small program that runs on the GPU. It controls how geometry is positioned and how pixels are colored. GPU means Graphics Processing Unit. The chip in your computer that is designed to do millions of small math operations at the same time.

The wave math runs inside a vertex shader. That is the part of the rendering pipeline where you can change the position of each vertex before it gets drawn on screen.


Making It Look Like Water. Lighting and Shading.

Moving geometry alone looks like a white blob. The magic that makes it look like water is all in the lighting.

Normal Vectors

To calculate how light hits a surface you need to know which direction the surface is facing at every point. That direction is called a normal vector. On a flat floor every normal points straight up. On a wavy water surface the normals tilt in all sorts of directions following the bumps and dips.

The cool thing about the wave math approach is that you can calculate the exact normals using calculus. You take the derivative of your wave function. That gives you precise normals without any guessing. This matters because accurate normals mean accurate lighting.

Diffuse Lighting

The most basic lighting calculation. You compare the normal vector to the direction of the light. If they face each other. The surface is bright. If they face away. The surface is dark. This is called Lambertian diffuse. It gives the water its basic form and shading.

Specular Highlights

These are the bright sparkly spots you see where sunlight bounces off the water directly into your eyes. The calculation checks if your viewing angle lines up with the reflected light direction. If it does. You get a bright spot. This is what makes water look shiny and alive.


Reflections

Water without reflections does not look like water. There are three main approaches games use.

Ray Tracing traces light rays to calculate perfect reflections. Looks amazing. Very expensive. Only works on modern hardware.

Screen Space Reflections (SSR) only reflects what is already visible on your screen. Cheap and common. But if the thing being reflected moves off screen the reflection just disappears. Easy to break. Most games use this anyway because it is fast.

Cube Map Reflections use a pre-captured image of the environment stored on the six faces of a cube. You calculate the reflection direction from the camera and sample the cube map. This gives decent reflections cheaply. Most skybox reflections work this way.

The Fresnel Effect

This is one of the most important visual tricks for water. Fresnel describes how the reflection strength changes based on your viewing angle.

Look straight down into water. You see through it clearly. Look across a lake at a shallow angle. It looks like a mirror.

Games blend between showing the reflection and showing what is under the water based on this angle. This single effect makes a huge difference in how real the water looks.


Normal Maps. Faking the Small Stuff.

You cannot add infinite wave detail through vertex displacement. At some point the triangles in your mesh are too big to show tiny ripples. This is where normal maps come in.

A normal map is a texture. But instead of storing color it stores direction information. Each pixel tells the shader "pretend the surface is tilted this way." This lets you add fine surface detail like small ripples and distortions without adding any actual geometry.

The classic water trick is to take two normal map textures and scroll them across the surface in different directions. They overlap and blend. Your brain sees complex moving ripples. In reality it is just two images sliding over a flat surface. This technique is everywhere. From Half-Life 2 to Cyberpunk 2077.


Caustics. Light Patterns Underwater.

Caustics are those dancing bright patterns you see on the bottom of a swimming pool. They happen because the wavy water surface bends light like a bunch of tiny magnifying glasses. Some spots on the floor get extra light focused on them. Other spots get less. This creates the signature wiggly web of bright lines.

In games the cheapest approach is just a scrolling texture. An animated image of caustic patterns projected onto surfaces under the water. Add some distortion and it looks convincing. Subnautica uses this approach heavily across its entire ocean floor.

More advanced methods actually trace where the light goes after hitting the water surface and calculate where the bright spots should be. This matches the wave shapes but costs more.


Interaction. Making It Feel Real.

What really sells water is how it reacts to the world.

Ripples from objects. When a character walks into water or a bullet hits the surface the game uses vertex displacement at that spot to create a ripple that spreads outward and fades.

Splash particles. Sprite-based particle effects for splashes. Combined with ripples this gives you something like the bullet impacts in Red Dead Redemption 2.

Foam. White foam that appears on wave crests and near shorelines. Usually a texture that is blended in based on wave height or proximity to objects.

Buoyancy. Objects floating. The simplest version just pushes objects up when they are below the water line. More advanced versions calculate how much of the object is submerged and apply force proportionally. This gives natural bobbing behavior.

Underwater effects. When the camera goes below the surface everything changes. Colors shift blue. Sound gets muffled. A fog effect limits visibility. The surface looks different from below. Each of these is a separate system.


The Recipe. Putting It All Together.

Here is the full stack of what makes game water work.

A flat plane mesh with enough vertices to deform. Wave math using sum of sines or FBM to displace those vertices. Normal calculation for accurate lighting. Scrolling normal maps for fine surface detail. Diffuse and specular lighting. Fresnel-based blending between reflection and refraction. Reflections via cube maps or SSR or ray tracing. Caustic textures projected on underwater surfaces. Particle effects for splashes and foam. Interaction systems for ripples and buoyancy.

Every game picks and chooses from this list based on their budget and hardware targets. A mobile game might only use scrolling normal maps on a flat plane. A game like Sea of Thieves uses almost everything on this list and then some.