From Valve Developer Community
- See also: Flowing Water
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
- Create a brush the size of the water volume using the Block Tool.
- Open the Texture Browser by clicking the Browse button on the Texture Bar.
- Double-click the
tools\toolsnodrawmaterial in the Texture Browser.
- With your water brush selected, click the Apply Current Texture button to assign the
tools\toolsnodrawmaterial to the whole brush.
- Select the Texture Application tool, which opens the Face Edit mode.
- Left-Click the top face of the water brush in the 3D view to select it.
- Click Browse to bring up the Texture Browser again.
movingplaneinto the filter field and select the texture
- Click the Apply button on the Face Edit panel.
Configuring the func_water_analog entity
- Now you have constructed the water brush, press Ctrl + T to tie the brush to an entity. Select
func_water_analogfrom the list.
- In order to trigger your water, you must name it. Enter an identifier for the water in the
- Select the direction for the water to move in the
Move Directionfield. For most cases, you should select Up from the list.
- Enter a speed at which your water should move. 55 works well, but the speed should depend on the situation.
- The entity uses the
Move Distancefield 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).
- You can select sounds to be played when the water starts or stops moving with the
Triggering the Water
func_water_analog entity can be moved via two inputs,
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:
- Add an env_cubemap entity using the Entity Tool.
- Place the env_cubemap above the top surface of the water, near the center.
- Double-click the env_cubemap in the 3D view to bring up the Object Properties dialog.
- Click on the Brush faces key in the Object Properties.
- Click the Pick... button. The mouse cursor will change to the eye dropper icon.
- 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.
- Close the Object properties dialog.
- 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.