Triangle Terrain 1: The Basics
by ReNo (view all articles)

unrated
Cover any area you wish in some complex looking yet easy to make terrain
by ReNo (view all articles)

unrated

In this tutorial, you will learn how to create some impressive (by HL's standards) uneven terrain. It will equip you with the skills to plug any gap you wish in a convincing and natural way. To make the most of this tutorial, you ought to have some experience using the vertex manipulation tool, as it is used extensively throughout. If you have not used this tool before, I recommend searching around HL editing sites such as this one to find out how it works. I also assume you are using Zoner's compile tools (or ones based from it), and have the zhlt.wad in hammer ready for use.
Before we begin, you may wish to download the example maps. Included in the zip file are all of the screenshots and a text file of the tutorial so you can also use it while offline. Please note though that this tutorial is not so specific to the example maps that you MUST use them to follow it - it is just as easy to follow using any map you may need triangle terrain in. Below is the link if you wish to use it...
(note that at the time of posting this was not available, but should be soon)
http://www.snarkpit.com/pits/reno/tutorials/terraintut.zip
To begin, you will note that the example map consists of a reasonably simple set of stairs. This tutorial will go as far as to show you how to fill all the area between the two stair sets with some nice looking and reasonably low poly count rocks. The reason I have used these stairs as an example is because they include many elements that will challenge you in making rockwork - winding horizontal boundaries, and a change in height. Essentially the only other feature that you will need to learn to be able to make any rocks you could wish is to know how to change the direction of the terrain (ie. change smoothly from a ground surface to a cliff), but that it is perhaps best saved for a seperate tutorial.
Now, on with the tutorial. To begin with, set your grid size to something relatively small, such as 4. Next up, to make the work area as clearly visible as possible, select all the parts of the map that are not in direct contact with the area you are making rocks, as they will simply clutter the views. This should leave your editor looking something like this...
Now you should create your first triangle. We use triangles for making uneven terrain as it is impossible to create invalid solids using them (unless you do something really illogical, which we will avoid here!). There are many different ways you could do this step, and through looking at other people's maps I have seen many approaches. The way I recommend is to create a block that is one unit deep, all covered in the NULL texture that comes with Zoner's HL tools, and then use the clip tool or vertex manipulation to turn the block into a triangle. Now texture the top face (the only one the player will see) in the texture of your choice. For the sake of this tutorial I am using the default HL wad only, but I highly recommend if you are making rocks in your own maps then you seek out some nice custom ones, as HL's are overused and low quality. Now move your triangle to sit inside the boundaries.
You should now have something akin to the following...
Now is a suitable time to mention that you need not worry about the vertical location, as my approach to triangle terrain is the build the "mesh" of triangles to fit inside the horizontal boundaries, and then manipulate this mesh to meet the vertical extents afterwards. This is just my approach, I'm sure other people manipulate each and every triangle as they go.
Another important choice to decide now is whether you will use a uniform mesh, or one that is more random. The next two screenshots demonstrate the two styles...
This is the uniform layout. Note how the triangles are made to meet as squares, and these squares are in a grid.
This is a random mesh - simply throwing the triangles down wherever.
People argue over both being superior, and both are great in their own ways. Uniform meshes are much simpler to decipher from looking at it - the triangles are all lined up and make for a nice neat looking view. This uniform approach may also cut down compile times, as it is more logically put together. On the other hand, the random mesh can end up giving a less precise, and therefore more natural finished product. After all, terrain is rarely so geometrically structured. Another benefit of a random mesh is that it allows you to choose how many triangles to put into each area, meaning you can have a nice detailed part of ground, and then make it simpler if the situation calls for it. A uniform grid limits you to a constant detail level, sometimes meaning unneccessarily high poly counts. I personally use the random mesh and will use it in the tutorial, but the choice is entirely up to you, and it really makes little difference to the technique.
The next step is to build your mesh. The fastest way to do this is select your first triangle and clone it. Incase you have somehow missed out on the clone ability of Hammer, simply select the triangle, hold down shift, move it somewhere, et voila - a new copy of your old brush. Now whip open the vertex manipulation tool and move the vertices of the new brush to logical places. Don't fret if you haven't exactly the same as below - remember that I am using the random mesh technique, and its a contradiction in terms if everyone did it the same way!
Repeat this clone / manipulate process until you have filled up the area, something like this...
The next stage is the toughest part - but go slowly and methodically and its really simple enough. You guessed it, its time to make this mesh into an uneven surface. Before you start moving those vertices, ensure your triangles are all grouped. Now our first step here will be to move all the outside vertices to meet up with the boundaries. As you should have had experience with vertex manipulation in the past, this should be a fairly simple process, but the sheer amount of vertices on the side and front view can be daunting. Just remember to drag selection boxes over a vertex on the top view so it selects all of the ones underneath, and then move it up or down on the side or front view. Make sure you always check the vertices have kept the same horizontal (x/y) location, and you are only changing their vertical (z) location.
Once you have got all of the outside vertices moved into position, its time to move the internal ones to make the terrain more natural. The look you achieve is entirely up to you - you can have harsh angles to suggest mountainous rocks, or make the transitions smooth to make it more like a rolling hill. Be experimental, but always keep in mind what your intention is. If you are going to have a sand embankment between the stairs, then it would be a smooth curve, whereas a small rock outcrop is likely to be far more jagged.
If by now your rocks have some dodgy texture issues, you shoul select all of the rock texture faces, and ensure that are set as "treat as one" and "to world" - now feel free to mess about with alignment or scale as you see fit. Sometimes triangle terrain that is wildly jaggy can through texture alignment right out the window and its near impossible to get right - in these cases I suggest you use a confusing and non-directional texture. By this I mean pick a texture in which the entire thing has no obviously discernable features, as these will show up the misalignment. Non-directional means not to pick a texture that has obvious streaks or other indicators of the direction it is MEANT to be facing, as non-matching rotation factors on faces can make these stand out really badly.
Hopefully after this you will end up with something like what I have, shown below...
Triangle terrain that is uneven like that we have created often has the downside of coming with dodgy clipping issues - movement is made awkward through snagging and things. If it is not essential to the level to have the ability to move over the terrain, I suggest you cover the area with clip brushes.
If you would like more practice, it might be wise to have a shot at surrounding the entire structure in terrain, perhaps turning it into a mountain-top outpost, or setting it in a dip in a sandy desert. Different textures on the same terrain can often give an entirely different setting, so be creative
I hope that this tutorial has taught you the basics of triangle terrain, and you are now confident with using it wherever the situation calls for it. In the future I will likely write a follow up describing how to have direction changes, and how to cut down on the amount of polygons if you have gone overboard on the triangles. Any other suggestions for other tutorials or improvements/questions on this one should be posted below.
Before we begin, you may wish to download the example maps. Included in the zip file are all of the screenshots and a text file of the tutorial so you can also use it while offline. Please note though that this tutorial is not so specific to the example maps that you MUST use them to follow it - it is just as easy to follow using any map you may need triangle terrain in. Below is the link if you wish to use it...
(note that at the time of posting this was not available, but should be soon)
http://www.snarkpit.com/pits/reno/tutorials/terraintut.zip

To begin, you will note that the example map consists of a reasonably simple set of stairs. This tutorial will go as far as to show you how to fill all the area between the two stair sets with some nice looking and reasonably low poly count rocks. The reason I have used these stairs as an example is because they include many elements that will challenge you in making rockwork - winding horizontal boundaries, and a change in height. Essentially the only other feature that you will need to learn to be able to make any rocks you could wish is to know how to change the direction of the terrain (ie. change smoothly from a ground surface to a cliff), but that it is perhaps best saved for a seperate tutorial.
Now, on with the tutorial. To begin with, set your grid size to something relatively small, such as 4. Next up, to make the work area as clearly visible as possible, select all the parts of the map that are not in direct contact with the area you are making rocks, as they will simply clutter the views. This should leave your editor looking something like this...

Now you should create your first triangle. We use triangles for making uneven terrain as it is impossible to create invalid solids using them (unless you do something really illogical, which we will avoid here!). There are many different ways you could do this step, and through looking at other people's maps I have seen many approaches. The way I recommend is to create a block that is one unit deep, all covered in the NULL texture that comes with Zoner's HL tools, and then use the clip tool or vertex manipulation to turn the block into a triangle. Now texture the top face (the only one the player will see) in the texture of your choice. For the sake of this tutorial I am using the default HL wad only, but I highly recommend if you are making rocks in your own maps then you seek out some nice custom ones, as HL's are overused and low quality. Now move your triangle to sit inside the boundaries.
You should now have something akin to the following...

Now is a suitable time to mention that you need not worry about the vertical location, as my approach to triangle terrain is the build the "mesh" of triangles to fit inside the horizontal boundaries, and then manipulate this mesh to meet the vertical extents afterwards. This is just my approach, I'm sure other people manipulate each and every triangle as they go.
Another important choice to decide now is whether you will use a uniform mesh, or one that is more random. The next two screenshots demonstrate the two styles...

This is the uniform layout. Note how the triangles are made to meet as squares, and these squares are in a grid.

This is a random mesh - simply throwing the triangles down wherever.
People argue over both being superior, and both are great in their own ways. Uniform meshes are much simpler to decipher from looking at it - the triangles are all lined up and make for a nice neat looking view. This uniform approach may also cut down compile times, as it is more logically put together. On the other hand, the random mesh can end up giving a less precise, and therefore more natural finished product. After all, terrain is rarely so geometrically structured. Another benefit of a random mesh is that it allows you to choose how many triangles to put into each area, meaning you can have a nice detailed part of ground, and then make it simpler if the situation calls for it. A uniform grid limits you to a constant detail level, sometimes meaning unneccessarily high poly counts. I personally use the random mesh and will use it in the tutorial, but the choice is entirely up to you, and it really makes little difference to the technique.
The next step is to build your mesh. The fastest way to do this is select your first triangle and clone it. Incase you have somehow missed out on the clone ability of Hammer, simply select the triangle, hold down shift, move it somewhere, et voila - a new copy of your old brush. Now whip open the vertex manipulation tool and move the vertices of the new brush to logical places. Don't fret if you haven't exactly the same as below - remember that I am using the random mesh technique, and its a contradiction in terms if everyone did it the same way!

Repeat this clone / manipulate process until you have filled up the area, something like this...

The next stage is the toughest part - but go slowly and methodically and its really simple enough. You guessed it, its time to make this mesh into an uneven surface. Before you start moving those vertices, ensure your triangles are all grouped. Now our first step here will be to move all the outside vertices to meet up with the boundaries. As you should have had experience with vertex manipulation in the past, this should be a fairly simple process, but the sheer amount of vertices on the side and front view can be daunting. Just remember to drag selection boxes over a vertex on the top view so it selects all of the ones underneath, and then move it up or down on the side or front view. Make sure you always check the vertices have kept the same horizontal (x/y) location, and you are only changing their vertical (z) location.
Once you have got all of the outside vertices moved into position, its time to move the internal ones to make the terrain more natural. The look you achieve is entirely up to you - you can have harsh angles to suggest mountainous rocks, or make the transitions smooth to make it more like a rolling hill. Be experimental, but always keep in mind what your intention is. If you are going to have a sand embankment between the stairs, then it would be a smooth curve, whereas a small rock outcrop is likely to be far more jagged.
If by now your rocks have some dodgy texture issues, you shoul select all of the rock texture faces, and ensure that are set as "treat as one" and "to world" - now feel free to mess about with alignment or scale as you see fit. Sometimes triangle terrain that is wildly jaggy can through texture alignment right out the window and its near impossible to get right - in these cases I suggest you use a confusing and non-directional texture. By this I mean pick a texture in which the entire thing has no obviously discernable features, as these will show up the misalignment. Non-directional means not to pick a texture that has obvious streaks or other indicators of the direction it is MEANT to be facing, as non-matching rotation factors on faces can make these stand out really badly.
Hopefully after this you will end up with something like what I have, shown below...

Triangle terrain that is uneven like that we have created often has the downside of coming with dodgy clipping issues - movement is made awkward through snagging and things. If it is not essential to the level to have the ability to move over the terrain, I suggest you cover the area with clip brushes.
If you would like more practice, it might be wise to have a shot at surrounding the entire structure in terrain, perhaps turning it into a mountain-top outpost, or setting it in a dip in a sandy desert. Different textures on the same terrain can often give an entirely different setting, so be creative

I hope that this tutorial has taught you the basics of triangle terrain, and you are now confident with using it wherever the situation calls for it. In the future I will likely write a follow up describing how to have direction changes, and how to cut down on the amount of polygons if you have gone overboard on the triangles. Any other suggestions for other tutorials or improvements/questions on this one should be posted below.