Difference between revisions of "Moving Water"

From Valve Developer Community
Jump to: navigation, search
m (new category)
Line 4: Line 4:
[[Category:Level Design Tutorials]]
[[Category:Level Design Tutorials]]
{{seealso|[[Flowing Water]]}}
{{seealso|[[Flowing Water]]}}
[[Image:Moving_water.jpg|thumb|300px|Moving water in cs_militia.]]
The Source engine supports [[water]] with the [[func_water_analog]] entity which can move in a similar way to a [[func_movelinear]] entity.
The Source engine supports [[water]] with the [[func_water_analog]] entity which can move in a similar way to a [[func_movelinear]] entity.

Latest revision as of 05:54, 28 July 2014

See also: Flowing Water

The Source engine supports water with the func_water_analog entity which can move in a similar way to a func_movelinear entity.


Though moving water is possible, it has some limitations.

  • The water shader cannot be used. However, bump mapping is allowed (akin to "cheap" water).
  • Moving water will not always react the same as normal water. Client-side entities, such as broken props in HL2MP or ragdolls, do not float in this type of water.
  • Splashes (most noticeably those caused by explosions) will not render correctly. Splashes appear to be created at the water's original position, rather than its current position.
  • Underwater fogging does not occur, making the water seem "bright" compared to normal water brushes.


To add a moving water volume to your level, follow these steps:

Creating the Water Brush

Step 1
  1. Create a brush the size of the water volume using the Block Tool.
  2. Open the Texture Browser by clicking the Browse button on the Texture Bar.
  3. Double-click the tools\toolsnodraw material in the Texture Browser.
  4. With your water brush selected, click the Apply Current Texture button to assign the tools\toolsnodraw material to the whole brush.
  5. Select the Texture Application tool, which opens the Face Edit mode.
  6. Left-Click the top face of the water brush in the 3D view to select it.
  7. Click Browse to bring up the Texture Browser again.
  8. Type movingplane into the filter field and select the texture nature/water_movingplane.
  9. Click the Apply button on the Face Edit panel.

Configuring the func_water_analog entity

Step 2
  1. Now you have constructed the water brush, press Ctrl + T to tie the brush to an entity. Select func_water_analog from the list.
  2. In order to trigger your water, you must name it. Enter an identifier for the water in the Name field.
  3. Select the direction for the water to move in the Move Direction field. For most cases, you should select Up from the list.
  4. Enter a speed at which your water should move. 55 works well, but the speed should depend on the situation.
  5. The entity uses the Move Distance field to determine how far the water should move. If you enter the height of your water brush, it will move fully above its starting position (the bottom of the brush will be where the top of the brush was originally).
  6. You can select sounds to be played when the water starts or stops moving with the Sounds played... fields.

Triggering the Water

The func_water_analog entity can be moved via two inputs, Open and Close. See Inputs & Outputs for more information.

Cubemaps and Moving Water

As mentioned earlier, moving water cannot use the water shader and instead has the same visual properties as "cheap" water, using a pre-calculated environment map from an env_cubemap instead.

Cubemaps are important to use with water surfaces. On lower than DX9 level video cards, it is not possible to render the real-time reflective water shader. For these cards, an env_cubemap entity provides the pre-calculated environment map use to render water on sub-DX9 cards.

Adding a env_cubemap to water surfaces:

  1. Add an env_cubemap entity using the Entity Tool.
  2. Place the env_cubemap above the top surface of the water, near the center.
  3. Double-click the env_cubemap in the 3D view to bring up the Object Properties dialog.
  4. Click on the Brush faces key in the Object Properties.
  5. Click the Pick... button. The mouse cursor will change to the eye dropper icon.
  6. Click the top water face to select it with the eyedropper. The face will highlight in red, to show it has been associated with the env_cubemap entity.
  7. Close the Object properties dialog.
  8. Compile and run your map. After the map is loaded, open the developers console and type buildcubemaps. The engine will calculate an environment map for each env_cubemap entity, and save the data into the BSP file.