Valve Developer Union

Making Use of Source's Water Materials

(December 3, 2017)


The Source engine had some of the most detailed and lifelike water effects for its day, and even to this day, the effect holds up well. Water in Source is reflective, refractive, fogged, and has the ability to flow if needed. With all of this comes restrictions on how it can be placed and the potential for glitches if used improperly.

The water shader in action
The water shader in action

Before we get into any specifics, know that there's actually two kinds of water materials, cheap water and expensive water.

Huh? Cheap and expensive water?

Rendering realistic water takes time. This is generally what we refer to when we call something "cheap" or "expensive" to render. Expensive water is a multi-step rendering process, while cheap water often uses a single, tinted texture. Here's a list of the different rendering passes that go into an expensive water material.

From left to right: Water with bump map only, bump map and refraction, bump map and reflection, bump map, reflection, and refraction
From left to right: Water with bump map only, bump map and refraction, bump map and reflection, bump map, reflection, and refraction

This is a demonstration of each rendering pass of an expensive water material. In order from left to right, we have a water material using only a bump map, a water material using a bump map and real-time refraction, a water material using a bump map and real-time reflection, and a water material using all three.

Expensive water
Expensive water

In addition to all of this, expensive water has restrictions on how and where it can be used. It takes time to render expensive water, time you may not have in a complicated scene.

Cheap water
Cheap water

Cheap water, in comparison, oftentimes only features fog and uses a normal $basetexture like other brushes, with a cubemap if necessary for reflections. It features no fogging, refraction, or real-time reflections. Cheap water also features fewer restrictions on its use than expensive water.

Info

Cheap trick

Cheap water materials don't actually use the water shader at all! As an example, nature/water_dx70 uses the normal LightmappedGeneric shader, with dev/water as its $basetexture and set to render as translucent. The %compilewater material parameter is what makes the water functional in-game. This is why cheap water can be used in more situations than expensive water.

Adding water to a map

To add any kind of water to a map, draw out a brush textured with tools/toolsnodraw and texture the top with the water material of your choice. The water brush can intersect other brushes, but it has to be rectangular in shape. When the map is compiled, the compiler will turn it into a transparent brush that the player will be able to swim through. Note that water will not seal a map or block VVIS from seeing through it.

A valid water brush in Hammer
A valid water brush in Hammer

Different games will have different water textures, and there's no way we could fit a listing into one guide. Instead, we direct your attention to two separate videos. one video compares the water textures featured in Counter-Strike: Source and shared with Half-Life 2, Day of Defeat: Source, and other games of its era. The other compares the water textures available for Counter-Strike: Global Offensive mappers.

Restrictions on water brushes

As stated earlier, the water shader has several restrictions on how expensive water is used in a map. Flickering and other visual inconsistencies can occur if proper care isn't taken.

Half-Life: Source uses cheap water in the Blast Pit chapter
Half-Life: Source uses cheap water in the Blast Pit chapter

If you find yourself in a position where you're unable to use an expensive, realistic water material, you can fall back to using any water material with _dx70 or _cheap in the name. While it won't look as nice, it's more functional, and depending on the map, the loss of detail likely won't be an issue. In the above screenshot from Half-Life: Source, the use of cheap water barely sticks out.