WiseWaters: HL2 Water crash course
From Valve Developer Community
This tutorial was originally created by wisemx.
Seven important tips before we begin
- See the Adding Water page.
- If you’re creating water in any of the Source engine Multiplayer games do so sparingly. Keep track of in-game performance with the console command
- Your water will work great within displacements, like the canals of Half-Life 2, but be aware that you must seal behind the displacements with normal world brushes.
water_lod_controlis required, it can be placed anywhere in the map, does not even need to be near the water and if you forget to add this control the compilers will add one for you.
env_cubemapis required for each volume of water and it’s best to assign the face in the entity’s properties. When placing these just click on the water surface in the 3D viewport and it will be placed at the correct distance from the water.
- Make sure Snap to Grid is ON and reduce the size of your grid if it helps to place your water, This isn’t as important when water is placed within displacements as it should overlap the displacement but when water is within normal brushes you should be very accurate with placement, if you have to use more than one brush for your water in an odd shape make sure there are no gaps.
- If you want water that moves, use
Creating the water
- Use the Hammer Texture browser, on the right-hand toolbar, and select the nodraw texture (
- With the Block Tool (Shift+B) create the brush that will become your water. You will now have a brush entirely textured with nodraw.
- Use the Toggle texture application tool (Shift+A), also known as the Face Edit Dialog), to browse for water textures. Use the filter word water.
- Double-click on any image to select that texture, which will return you to the Face Edit dialog.
- Right-click on the surface of the water to apply this texture.
- With the Entity Tool (Shift+E) place an
env_cubemapin the center above the water.
- Double-click on the
env_cubemapor press Alt + Enter to bring up the properties. Choose Brush Faces then use the Pick... button and click on the water surface.
- Your water is now complete. (Don’t forget to add that one
Note:When you compile your map and are ready to test your water in the game you first need to run the console command
buildcubemapsonce after each compile.
- Example VMF showing many water textures. Note that due to how visibility and the water shader interact, some water textures will not render correctly when the player is not in the intended spot. Also, the 3D view in Hammer may appear glitchy, due to some textures being partially broken.
- Example VMF backup