WiseWaters: HL2 Water crash course
This tutorial was originally created by wisemx. It was originally posted on SDKnuts.net.
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
+showbudget
. - 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.
- One
water_lod_control
is required, it can be placed anywhere in the map, and does not even need to be near the water.- If you forget to add this, the compiler will add one for you.
- 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. - 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 don't want it to overlap. You may have to use more than one brush for your water if it needs to fill an odd shape.
- If you want water that moves, use
func_water_analog
.
Creating the water
- Using the Hammer texture browser, select the nodraw texture (
tools/toolsnodraw
). - 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_cubemap
in the center above the water. - 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. - Your water is now complete. (Don’t forget to add that one
water_lod_control
.)
Note: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.
Tip:If you are using Mapbase, run the game with
-autocubemap
to automatically build LDR and HDR cubemapsSee 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