WiseDisplacement01

From Valve Developer Community
Revision as of 21:27, 12 February 2008 by Plykkegaard (talk | contribs) (This tutorial is ported from sdknuts.net/wiseDisplacement01 and is originally created by wisemx and is ported to the VDC by ~~~~)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Displacement basics

First the facts

  1. Displacements can not be converted into entities. (i.e. func_detail)
  2. They do not seal your map. Your map must be sealed against leaks.
  3. Do cast shadows and have a collision system. (i.e. Players, NPCs and Vehicles)
  4. They are static and can not be moved in the game.
  5. Displacements must be created from normal 6-faced (4 sided) brushes.
  6. Do not block PVS Visibility.
  7. Can add dramatically to the overall file size of your map.
  8. 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.
Create worldbrush
Clone the brush
Apply texture
Displacements

Create Floor

Brushwork

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.

Noise

Applying noise
Taking shape
Paint Geometry
Paint Alpha
  • 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.
Note:The details sprites, from blend textures, won’t show in Hammer
.
  • 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.
Note:It is possible to create invalid displacements if you stretch any of the points too far.

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:

WiseDisp01 09.jpg

Articles

Additional resources for creating Displacements in your maps:

Videos

  • Cliffs with Displacements hammer_displacement_tut.zip Video tutorial (74MB)

Wrap up

There’s a lot more you can do, hopefully this article have stimulated your imagination.

Credits