First the facts
- Displacements can not be converted into entities. (i.e. func_detail)
- They do not seal your map. Your map must be sealed against leaks.
- Do cast shadows and have a collision system. (i.e. Players, NPCs and Vehicles)
- They are static and can not be moved in the game.
- Displacements must be created from normal 6-faced (4 sided) brushes.
- Do not block PVS Visibility.
- Can add dramatically to the overall file size of your map.
- They can be Clipped, Vertex Edited, Rotated, and Moved in Hammer.
Displacements will be one-sided once they are created, the original brush is tossed. As a general guideline you can seal behind the visible face with normal world brushes entirely textured with nodraw. Making these sealing brushes 16 units thick works out well. They can overlap the displacement but be careful that they don’t come through the face or you will see gaps in the game.
When creating displacement floors it’s often best to create two brushes for the floor identical in size. The top one will become the displacement, the bottom one will seal your map. Before you create a displacement apply the texture you will be using to the entire brush you are starting with. Once you create the displacement faces the other faces will be discarded and you can not have nodraw faces on displacement surfaces.
Displacements can be used anywhere but they may require finessing.
As you can see by my tutorial on Displacement Columns there are many more uses for them than just outside map geometry. Notice in this tutorial on Grass how the effect is only possible with a displacement floor.
Here are some uses for displacements in your maps:
- Outside map geometry, such as seen throughout HL2.
- Columns and Pipes.
- Perfectly round cylinders.
- Corners on buildings.
- Tunnels and caves.
- Contoured cushions for beds and seats.
- Glass tubes.
Let’s create a simple displacement floor.
- Make sure Snap to Grid is On. Shift+W
- Create a normal world brush entirely textured with nodraw.
- Select this new brush, hold Shift and drag a clone of this brush by dragging it in the side or Front viewport.
- With the new brush still selected chose a texture and apply it to the entire brush.
- For this example I’m going to use nature/blenddirtgrass006a.
- We now have two identical brushes, once entirely textured with nodraw and one entirely textured with nature/blenddirtgrass006a.
- The bottom brush is complete; we will not do anything else to it.
- This brush now serves the purpose of sealing the map.
Create the displacement map
- Open the Face Edit dialog. Shift+A
- Click the Displacement tab.
- Left mouse click on the top textured brush face to select it.(To select multiple faces hold Ctrl.)
- With only the top face selected click the Create button, it will default to a power of 3 which is fine for our project. Click OK.
- The Power of your displacement surfaces can be 2, 3 or 4.
- Power of 2 = Simple displacements where fewer triangles are required.
- Power of 3 = Common applications, all around best option.
- Power of 4 = High triangle count, should be used with caution.
- The top face is now a displacement surface and all other faces of that brush are gone.
- Our new displacement surface is still flat.
- Let’s add some noise to give it some shape.
- With the Face Edit dialog still open and the displacement surface still selected click on the Noise button.
- Adjust the Min and Max Displacement Noise and click OK.
- Our displacement surface now has shape.
- Even though the original brush shows as being the same in the 2D viewports you can see how the brush will look in the game in the 3D viewport.
- We have shape now but we can add a little more by using the Displacement Paint Geometry tool.
- Don’t go crazy with this tool, it’s far too easy to blow your displacements out of proportions with this tool. Use the adjustments and make careful changes.
- Click where the triangles intersect to make changes in that area.
- Left click to raise the geometry.
- Right click to lower the geometry.
- Make subtle changes at first until you get used to this tool.
For our final touch we’ll add some contrast to the floor texture by using the Displacement Paint Alpha tool.
- Move around with the WASD keys as you use the Left mouse button to paint.
- You can hold down on the Left mouse button and just sweep the area.
- Use the Right mouse button to restore.
Now seal your new displacement project by building skybox brushes and ignoring the displacement brush. Your new displacement has nothing to do with sealing your map, you should only be concerned right now with that normal brush we created in the beginning, the one that has remained under our displacement.
Now place a light_environment in your map, an info_player_start and you’re ready to compile the map and test your new displacement. I’ve also placed one env_cubemap in the very center at the Players eye level.
- Keep in mind objects will need to be placed above the displacement surfaces so they aren’t stuck when spawned in the game.
- For many objects it’s best to place them well above the displacement surface and let them fall to the ground when they spawn.
The final effect:
Additional resources for creating Displacements in your maps:
- Face Edit of Displacements
- Creating holes in Displacements
- Columns, Tubes and Pipes with Displacements - wiseColumns
- Cliffs with Displacements hammer_displacement_tut.zip Video tutorial (74MB)
There’s a lot more you can do, hopefully this article have stimulated your imagination.
- The example used in this tutorial.
- If you need further help please use the forum for Source level Design