WiseWaters: HL2 Water crash course

From Valve Developer Community
Jump to: navigation, search

This tutorial was originally created by wisemx. It was originally posted on SDKnuts.net.

Seven important tips before we begin

  1. See the Adding Water page.
  2. 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 +showbudget.
  3. 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.
  4. One water_lod_control is 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.
  5. One env_cubemap is 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.
  6. 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.
  7. If you want water that moves, use func_water_analog.

Creating the water

  1. Use the Hammer Texture browser, on the right-hand toolbar, and select the nodraw texture (tools/toolsnodraw).
  2. With the Block Tool (Shift+B) create the brush that will become your water. You will now have a brush entirely textured with nodraw.
  3. 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.
  4. Double-click on any image to select that texture, which will return you to the Face Edit dialog.
  5. Right-click on the surface of the water to apply this texture.
  6. With the Entity Tool (Shift+E) place an env_cubemap in the center above the water.
  7. Double-click on the env_cubemap or press Alt + Enter to bring up the properties. Choose Brush Faces then use the Pick... button and click on the water surface.
  8. Your water is now complete. (Don’t forget to add that one water_lod_control.)
Note.pngNote:When you compile your map and are ready to test your water in the game you first need to run the console command buildcubemaps once after each compile.

See also

  • 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