Back when I was trying to learn Source mapping, I ran into several issues, most of which involved lighting or water. While I have not mastered Source lighting, I can offer some help to those having issues with water.
How to Make Water and Basic Displacements in Source
News & Rumors
This tutorial assumes you know the basics of Hammer. You should know about placing geometry, basic lighting, some entities, and the general properties of the various tools. What you should learn from this is how to place water in a simple map and accent it with displacements.
If you are unfamiliar with basic Hammer techniques, you should check out this Valve Developer Wiki article.
Step 1: Open and Configure Source SDK
Go ahead and launch the program from Library > Tools in Steam. If it’s been collecting dust, I recommend resetting your game configurations via the main window. Knowing how sensitive Source is, the smallest thing like this can make the difference between success and angry emails. For this tutorial, I am using Half-Life 2 (Source 2009).
After opening Hammer, go to View > 3D Textured Polygons (This means that geometry will be textured and not appear as a wireframe). Next, go to Map > Snap to grid and make sure it is checked. A grid makes it easier to create neat geometry and is absolutely essential to water creation.
Step 2: Make a basin
Choose a texture and make five connecting pieces of geometry. They should be in a bowl shape without any holes or gaps in the bottom. Try not to make the bottom sides overlap, because this can result in texture popping. For the sake of this tutorial, I’ll use developer textures to keep things simple.
EDIT (August 20, 2010) It’s a good idea to use a nodraw texture for the bottom, as suggested by redBadger. This eliminates the problem of running into flat geometry when modifying the terrain above it.
Step 3: Make the water
This is the easiest step to screw up. Select the tools/toolsnodraw texture from the texture browser, and make a shape that fits snugly into your basin. You can alter the water level to keep it slightly below the wall if you like, but do not make it higher than the outside geometry.
Then select the nodraw geometry and open Texture Application tool. From within the tool, select only the top of the nodraw geometry and then click “browse”. Filter your search to “water” and choose a texture. Not all of them work, and the ones ending in “-cheap” aren’t as visually impressive, but use less memory. I’m going to use dev/dev_water2. Double click the texture and then hit “Apply”.
This should give you functional water. Skip to step 6 to try it out.
Step 4: Make displacements
Make another piece of geometry and place it under the water. Try to place it just above the bottom piece that is holding the water in, and make it touch the sides of the tank. The thickness doesn’t matter, but it’s recommended to keep it thin.
You should be able to move the camera under the water texture and see what you’ve created. Select it, and move the camera back above the water with the WASD and arrow keys. With it still selected, go into the Texture Application tool. Go to the Displacement tab and click “Create“. The default number is 3, but I prefer 5 or 6. A higher number will result in smoother geometry, but will also tax the memory, so don’t go too high. Choose your number and press enter.
Now it should be covered in intersecting lines. Press “Paint Geometry” and alter the Distance and Radius values to your liking. Distance refers to how high/low your displacements will be and Radius is the width. For general terrain, using a low distance and medium-high radius is ideal. Mess with it for a while until you get something that looks good. By left clicking, the geometry rises, and right clicking does the opposite.
If you did it right, you should see the geometry changing in the 2D views, and depending on your settings, the geometry may go above the water. This is fine, and can looks more realistic than if everything is underwater.
Step 5: Final Touches
Before we run the map, there are some very important things to be added. They are a player spawn and a skybox.
To make a player start, select your entity tool and on the right window towards the bottom (by default), you can select the entity. Scroll through until you find info_player_start. After selecting it, click somewhere on your map. It is recommended that this is not on a displacement or in the water. Also make sure the little green man is not inside any geometry, or you will be stuck.
This is optional, but you can also add the entity item_suit and place it touching the green Gordon. This grants the player suit powers such as sprinting, more health, flashlight, etc.
We don’t really need a skybox, but it’s a good habit to start using one, plus they make the level much more interesting. If you don’t use a skybox, just use regular geometry, but make sure to cover up every hole . There should be no black visible because this causes a leak, which is bad.
Open your texture browser and select the tools/toolsskybox texture. Then make six walls around your map, and make sure they are all connected. They don’t have to be huge or thick, but keep in mind that the illusion can be ruined if they are too close.
The 3D skybox texture and other map settings can be changed through Map > Map Properties. There are options for changing the name, author, etc. You can also change the global skybox texture, which by default is sky_day01_01. Take a look at this list of available skybox textures, and enter the name into the box. Some will work and others won’t, depending on which game configuration you are using.
Step 6: Run map
Save your map with File > Save and give it a name that doesn’t contain spaces. The location doesn’t matter, but put it somewhere convenient. It will generate a few extra files when compiling, so you might want to give it a folder.
And finally, go to File > Run Map or press F9. Make sure the “Don’t run game after compiling” checkbox is unchecked. If you did everything correct, you should be put into the map and see a little message about Node graphs. This is because you didn’t place any lights, so the game automatically used full brightness. In a real map, this would be a problem, but for the tutorial it’s fine.
Jump in the water, make sure it works and the sky is displayed correctly. Congratulations!
Step 7: Experiment
I recommend playing with Hammer and looking at more tutorials. I barely know anything about Hammer myself, and some developers might scoff at my methods of mapping, but I remember water being extremely difficult to implement. Hopefully this helped, and I’d love to hear suggestions of future tutorials to write.
Here is the .vmf file that I created for the tutorial. Please take care of him and make sure he goes to bed on time.
i want moar!
Great tutorial! Thanks!
You’re only supposed to select the top part of the block when creating a displacement. If you’ve done it right, you should be able to see through the displacement if you go under the block, which is normal. You then must make sure everything below the displacement is covered from the void (the black space) or else it will leak. Of course, you will need the nodraw texture for this.
Thanks for the feedback! It does make a lot more sense to use a nodrawn texture over a regular one, I’ll edit that in.
Thanks!
Awesome guide!
Can we feed the .vmf after midnight?
Bright Light-ning