WiseCubes: Displacement Cube method

From Valve Developer Community
Jump to: navigation, search

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


One of the best ways to create displacement Mountains, Rock walls, Cliffs, Caves and Tunnels is the Cube method. It’s rather simple and can be a lot of fun but most importantly it will save you from going crazy. From what I’ve seen by the displacements in projects sent to me by mappers who need help a lot of people are creating large displacement geometry such as Caves and Mountains by starting with simple thin brushwork, then trying to punch and stretch the brush into the shape they desire. I don’t have to tell you how many problems that can create and how it ends up looking.


The basic principle of the Cube method is to start with single cubes that you will copy again and again. When you do this begin with cubes that are square and divisible in even increments starting with 512 units. Therefore the starting cubes will be:

  1. 512x512x512
  2. 256x256x256
  3. 128x128x128
  4. 64x64x64
  5. 32x32x32

For the most part your cubes will be 512 or 256. After placing all of your Cubes they can easily be resized as needed. Make sure Snap to Grid is On and it helps to have your grid lines set to 16.

Once you have created the cubes that will be used in your project texture each of them with the texture that will be used. Texture them entirely with this texture. When searching for the material use filter words like Blend, Rock, Floor, etc. For Rock walls a nice texture is nature/rockwall015a. These cubes will seem large at first but once you select the required faces on each and the displacements are created the rest of the cube will be tossed. When you look at your project and think about how the cubes will be arranged think of them in terms of 1 or 2 faces.

In the image below I’ve copied one cube and aligned the copies in the manner they will be used to create the displacements.


Now I’ve created displacements on just the faces needed. To do this:

  1. Open the Face Edit dialog. Shift+A
  2. Left click on a starting face then hold Ctrl and you left click on the others which are needed.
  3. Chose the Displacement tab then click the Create button.
  4. Select a power of 2.

Typically a Power of 3 is best, 4 is used for extreme detail however it is harder on in-game performance.


As you see above all of your cube faces are now gone with the exception of the ones you selected. Now with those same faces still selected click the Subdivide button. The area between each face will be rounded.


Notice the edges are not what we want. The cure for this is to use sacrificial end cubes that you will delete once you have subdivided the cubes that will be kept. By adding sacrificial cubes at each end I would have ended up with this:


The only difference in the previous two images is the amount of cubes that were used. In the last image I was able to get exactly what I needed by using a total of 16 cubes while I would only be keeping 4 of them, the 12 sacrificial cubes were all deleted once the Subdivide process had completed.

Once you have created the displacements and subdivided them you can go in and use the Paint Geometry and Pain Alpha displacement tools. You can also use the Clipping and Vertex Editing tools.

There are of course times when you won’t want to use Subdivide, such as a displacement floor. In most cases it’s best to build your floor with the Noise and Paint options then use Subdivide on the walls that will join your displacement floor. Use whichever method you are comfortable with.

I’ve created a practice room for this project. The room is 1600x1808x16 and 512 units tall. In the practice room are three cubes in sizes 64, 128 and 256. The cubes are textured with nature/rockwall015a. Use these cubes to create a Cave, copy/clone them over and over.

Once you have created the walls of your cave create a new floor and ceiling that will become part of the cave, blended right in with the walls. The existing walls, floor and ceiling will remain as they are and will only serve to seal the map. If you were going to create tunnels for your cave you would do that now and consider the cube method for them as well but some tunnels will work fine if you use the subdivide method on them to round the corners.

See Also