[Tutorial] Displacements

Nutomic

L11: Posh Member
Feb 7, 2009
888
177
This is my first tutorial, about displacements in hammer, how they work, and what can be done with them.
This is a large topic, so prepare for a long read.

1. Displacement Tools

faceeditsheet.jpg

1 Select: standard tool to select faces, just as you normally do. To select multiple faces, hold strg while selecting.
2 Create: Turns all selected faces into displacements. When pressing, hammer asks you for the "power". The higher the power, the higher the number of nodes. 3 is standard, but you should try too keep it as low as possible for performance reasons. Displacements with a power of 4 can also cause problems with sticky bombs, so better dont use that (thanks littleedge)
3 Destroy: Turns all selected displacements back into world brushes.
4 Subdivide: Divides each big face into smaller parts, making it smoother and rounder. Further information can be read here (thanks to Nerdboy)
5 Noise: Raises and lowers each vertex of the displacement by a random value between the min and max values.
6 Sew: Connects the selected displacements to prevent gaps. For this to work, the base brushes of both displacements must share an edge. The displacements must either have the same length of that edge, or one must be exactly half the lenghth of the other. Displacements can not only be sewn with each other, but also with world brushes and even brush entities.
7 Paint Geometry:
paintgeometry.jpg

Effect: Raise/Lower: Move points up or down by the specified value with each click.
Raise to: Rises the current point exactly to the specified height.
Smooth: Removes hard edges of the displacement. you will probably have to set the raduis higher to see a result.
Spatial: If selected, changes apply to all points within the radius, the stronger the nearer they are to the center.
If it is disabled, changes only apply to the currnetly active point.
Brush: to do: While testing, i didnt find any differences between soft-edge and hard-edge, probably doesnt do anything. If you know what it does, let me know.
Distance: The distance a single click changes the height (raise/lower), or the height the displacement is set to (Raise to).
In smooth mode, a lower value seems to mean more change with each click, while a high value lets the height only change by a few units.
Radius: The radius changes should apply to.
Suto sew: sews the selected displacements after each change, useful to avoid gaps.
8 Paint Alpha:
paintalpha.jpg

Effect: Same as in paint geometry.
Type: Probably for textures with more than one alpha channel, though i could not test this.
Brush: The site of the area to edit, 1 means only the actual vertex gets edited, 3 would change all vertexes within a range of 3.
Value: Basically the same as in paint geometry.
9 Invert Alpha: Turns the alpha channel around, 0 becomes 255 and 255 becomes 0, same for values in between, so 25 would become 230.


2. Creating Displacement Ground

Imagine we have this area, and want the nodrawed space filled with displacements (dont do it like i did, and place everything off the grid...):
displacementgroundbase.jpg


Here are a few examples of possible solutions:
displacementgroundworst.jpg


As you can see, theres a really high number of vertexes, because the displacements are small and the power is high. In almost all cases, you will
not need so many vertexes, and this has a really bad effect on performance. You can also see parts of displacements sticking out of the map.
displacementgroundworst.jpg


If we have a look on the 2d overview, we can see how the displacements are in a nice raster (and that i forgot one). It might look good from here, but is the worst case you can have. More than half of all displacements are hidden under brushes, but still being rendered.
displacementgroundmid.jpg


Here, we have a lower displacement scale, and also bigger displacements, which should work perfectly, if your displacements are rather flat.
displacementgroundmid2d.jpg


As we cen see on the overview, theres still much of the displacements hidden under geometry, thus being rendered, without any benefit.
displacementgroundbest.jpg


You will immediately see one difference in this version: the displacements aren't straight on the grid any more, but the corners have been dragged around.
displacementgroundbest2.jpg


Looking at the 2d image, we see that there is almost no displacement surface hidden under a brush, and thus, useless.
The method used to create this is vertex editing. If you dont know what that is, here' a tut:
http://developer.valvesoftware.com/wiki/Hammer_Vertex_Tool

The idea is, that the corners of the displacements are at the same positions as the corners of your walls, so no part of a displacement is hidden underneath walls.

We start with a single brush where we want our ground. Turn the top site into a displacement, power of 2 should be okay. Give it a ground texture, and go into vertex editing mode.
It should now look somewhat like this:
vertextut1.jpg


Now we try to move the corners of this displacement so, that they are at the same position as the corners of what is surrounding your displacements, for example buildings, or rock walls.
vertextut2.jpg


The displacements dont always perfectly fit when only aligning them by the corners, thats where we can divide one edge up into 2:
vertextut3.jpg

You only have to make sure, that the corners are exactly at the middle at the middle of the other displacements edge, or they wont sew.

Sometimes, you cant do it that way without getting really small displacements:
vertextut4.jpg

But you should try to keep the hidden part of the displacement as small as possible, to not give away anything, and to prevent possible shadow errors.

Now we just put displacements over your whole area, starting from the outside, going towards the center. The easiest way to work with them is to group all displacements in an area, that should sew together, and just edit them with all being selected.

3. Caves

For caves, you want to place the displacements, just like you would place normal brushes: Make a displacement for every wall, floor and ceiling. Be sure that they always share an edge, so you can sew them properly. To avoid leaks, you have to place another set of brushes directly behind the displacements, all world brushes, and textured in tools/toolsnodraw.

You can then just select just the walls and the ceiling (not the floor, picture is wrong here), subdivide it, and you already have round edges. Then drag them around until you have what you want, and dont forget to sew everything at the end.
cave1.jpg

cave2.jpg

cave3.jpg



4. Other utilizations of displacements

Displacements can not only be used to create rocks and ground. For example, you want a smooth round corner. With brushes, you need at least 8 of them to make it look good. Using displacements, you only need 2. Heres how:
Take a brush, make two sides of it displacements, and select both. Now put a copy of both brushes above them, and one underneath (we need the copies, because hammer would not subdivide them regularly without them). Select all displacements, subdivide them, and delete the copies above and below the original brush.

roundcorner.jpg

The steps, from left to right.

Another way for making round corners is shown http://www.snarkpit.net/snarkpower/articles/game/cat/pn/tp/146/Texture_alignment_through_arches_using_displacement_maps, applying it vertically (thanks to grazr). This will give you a cleaner result, but will also take more time to be created. Its your decision, what you want to use.

Another example would be wooden structures, making them look more interesting. Heres an example, how valve did it in 2fort:
2fortdisplacementsbeams.jpg


If you have brush fences in your map, displacements can be used to make them look more interesting, like here:
2fortdisplacementsfence.jpg


You can also use displacements for roofs, making them less flat, and providing another advantage: You can put tools/toolsskybox brushes directly above your buildings, while the displacement roofs are still being rendered. Valve uses this in badlands, where it doesnt have much room to place brushes for vis-blocking.
badlandsroof.jpg

If that roof was a world brush, it would not be rendered where the skybox textured brush is, leaving an ugly gap where you could see the sky through.


5. Useful shortcuts

shift + a opens the face edit sheet.

You can change the radius in the paint geometry tool by holding alt + mouse1, and moving your mouse forward or back.

While holding shift + mouse1, you can move displacement points up or down according to how far you move your mouse back or forward.

With alt + mouse2, you can change the angle to that of the currently active point.

6. Additional Information

http://forums.tf2maps.net/showthread.php?t=111
http://forums.tf2maps.net/showthread.php?t=798
http://developer.valvesoftware.com/wiki/Displacement
http://developer.valvesoftware.com/wiki/Hammer_Face_Edit_Disps

Download of the example map
 
Last edited:

littleedge

L1111: Clipping Guru
aa
Mar 2, 2009
986
605
You missed telling us what Subdivide did at the beginning.

Caves: Do not make four brushes in the form of a box and subdivide. That is a terrible way to make displacement caves. That makes unrealistic ones - caves aren't tubes.

You should work on your grid. You show plenty of examples of placing brushes off the grid.

You DO NOT have to make your displacement ground line up with your displacement walls. In your example, you should simply have your walls be 8 or so units under the displacements. There is no reason to go through the hassle of making your ground displacements sew with your walls. The only time you do this is for the TOP. Let's use Furnace as an example. You know the canyons outside of BLU spawn that you take to get to A and B? The ground and the walls are not sewn - they are a few units beneath, and the ground goes through the displacement walls. The ground ABOVE the walls is sewn because you have no way to hide the displacements.
 

keithgarry

L2: Junior Member
Apr 16, 2009
59
8
You missed telling us what Subdivide did at the beginning.

Caves: Do not make four brushes in the form of a box and subdivide. That is a terrible way to make displacement caves. That makes unrealistic ones - caves aren't tubes.

You should work on your grid. You show plenty of examples of placing brushes off the grid.

You DO NOT have to make your displacement ground line up with your displacement walls. In your example, you should simply have your walls be 8 or so units under the displacements. There is no reason to go through the hassle of making your ground displacements sew with your walls. The only time you do this is for the TOP. Let's use Furnace as an example. You know the canyons outside of BLU spawn that you take to get to A and B? The ground and the walls are not sewn - they are a few units beneath, and the ground goes through the displacement walls. The ground ABOVE the walls is sewn because you have no way to hide the displacements.

You don't have to bite his head off. He obviously put a lot of time and effort into this.

Thanks Nutomic. I learned something from that last bit about the skybox and displacement.
 

littleedge

L1111: Clipping Guru
aa
Mar 2, 2009
986
605
I didn't mean to bite his head off.

It is a nice tutorial. The bottom section was the best. Displacements don't have to be used for outside areas only, and not enough people use them to their advantage. Nutomic did well. I just wanted to give him feedback, and oftentimes my feedback is aggressive, which I apologize for.
 
Dec 25, 2007
566
439
Displacements are actually pretty cheap to render, so having a lot of power 3 or 4 disps is probably not a problem if your map has well optimised vis. (of course, if in doubt, use showbudget to check).
 

Nutomic

L11: Posh Member
Feb 7, 2009
888
177
You missed telling us what Subdivide did at the beginning.

Caves: Do not make four brushes in the form of a box and subdivide. That is a terrible way to make displacement caves. That makes unrealistic ones - caves aren't tubes.

You should work on your grid. You show plenty of examples of placing brushes off the grid.

You DO NOT have to make your displacement ground line up with your displacement walls. In your example, you should simply have your walls be 8 or so units under the displacements. There is no reason to go through the hassle of making your ground displacements sew with your walls. The only time you do this is for the TOP. Let's use Furnace as an example. You know the canyons outside of BLU spawn that you take to get to A and B? The ground and the walls are not sewn - they are a few units beneath, and the ground goes through the displacement walls. The ground ABOVE the walls is sewn because you have no way to hide the displacements.

Thanks, i will see how i can change that :)

Displacements are actually pretty cheap to render, so having a lot of power 3 or 4 disps is probably not a problem if your map has well optimised vis. (of course, if in doubt, use showbudget to check).

Sure, but you should only use a high power if you really need it, if not, you should stay as low as possible.
 

Acumen

Annoyer
aa
Jun 11, 2009
704
628
since you showed examples where displacements are used for walls and wooden structures - why not show how you can make that as well :)
i think that would be very interesting, too. if you mention these nifty tricks, i'd be glad to know how to realize them. a lot of the time, the best stuff in tutorials is kept short telling the readers "you'll find out about that on your own" which makes me a sad panda :(
 

Nutomic

L11: Posh Member
Feb 7, 2009
888
177
since you showed examples where displacements are used for walls and wooden structures - why not show how you can make that as well :)
i think that would be very interesting, too. if you mention these nifty tricks, i'd be glad to know how to realize them. a lot of the time, the best stuff in tutorials is kept short telling the readers "you'll find out about that on your own" which makes me a sad panda :(

I think there just is not much to explain, basically, you make a beam, a roof or whatever you need, just like you normally would, and turn the visible sides into displacements. Then you edit them via the dispalcement tool, until you get what you want.

Nothing i could really explain here.
 

Psy

The Imp Queen
aa
Apr 9, 2008
1,706
1,491
I'm pretty sure the only reason those beams are displacements is to get around either a) indices or b) the brush limit.
 

Acumen

Annoyer
aa
Jun 11, 2009
704
628
well the wodden stuff, oke, but the walls, i'd like to know, cause i read it often, but a nice insight on how to get the curved look without the rest messing up, would enlighten me :)
but that's just me, no need to work for just one lonely number :D
 

Nutomic

L11: Posh Member
Feb 7, 2009
888
177
well the wodden stuff, oke, but the walls, i'd like to know, cause i read it often, but a nice insight on how to get the curved look without the rest messing up, would enlighten me :)
but that's just me, no need to work for just one lonely number :D

You mean this?
roundcorner.jpg


Its right there in the tutorial ;)
 

lana

Currently On: ?????
aa
Sep 28, 2009
3,075
2,778
In case you want to know, subdivision is the process of taking any geometric shape and dividing it into further polygons which are then positioned and angled to make the object smoother. This process is repeated until each vertex in your displacement has been positioned at a different angle, making the object appear smooth.
414px-Catmull-Clark_subdivision_of_a_cube.svg.png


Great tutorial, I knew most of the things you said, but I think it will be useful to people newer to mapping for tf2.

anyways, is there any particular reason stickies and power 4 displacements dont like each other?

Power of 4 displacements build very complex collision meshes that in other source games work fine. However, in Team Fortress 2, the physics system has been very dumbed down. The collision mesh isn't built properly, and thus, any physics object that collides with it will crash. Supposedly it doesn't work in Episode 2 either, but I haven't been able to break it by dropping stuff on it.
 
Last edited:

Acumen

Annoyer
aa
Jun 11, 2009
704
628
hm, then i say you wrote it in a confusing manner :D
tested it, worked like a charm

my thanks yous are reserved !
 

grazr

Old Man Mutant Ninja Turtle
aa
Mar 4, 2008
5,441
3,814
roundcorner.jpg


I would not have said that was the most efficient or appropriate use for a displacement. The centre of the wall still curves in slightly and the wall appears warped where it eases into the curve of the corner. I would have said just cut a corner on a basic brush/use the arch tool.

A more accurate, although tedious approach to this kind of corner can be seen here.

Applying this vertically rather than horizontally gives you a much cleaner finish.
 

Nutomic

L11: Posh Member
Feb 7, 2009
888
177
I would not have said that was the most efficient or appropriate use for a displacement. The centre of the wall still curves in slightly and the wall appears warped where it eases into the curve of the corner. I would have said just cut a corner on a basic brush/use the arch tool.

A more accurate, although tedious approach to this kind of corner can be seen here.

Applying this vertically rather than horizontally gives you a much cleaner finish.

Seems to be a lot more work, but with a better result. I'll put it in as an alternative way to do it.
 

XFunc_CaRteR

L5: Dapper Member
May 14, 2009
248
17
Caves: Do not make four brushes in the form of a box and subdivide. That is a terrible way to make displacement caves. That makes unrealistic ones - caves aren't tubes.

The Guardian tunnels in Half Life 2 Ep 2 (I think that's the episode) were done like this, and they look perfect.

A tunnel can look like a tube. It depends on the tunnel now doesn't it? For example, a well...
 

grazr

Old Man Mutant Ninja Turtle
aa
Mar 4, 2008
5,441
3,814
The Guardian tunnels in Half Life 2 Ep 2 (I think that's the episode) were done like this, and they look perfect.

A tunnel can look like a tube. It depends on the tunnel now doesn't it? For example, a well...

The gaurdian tunnels had more than a simple subdivide used in their creation. But that said, those tunnels were supposed to be more rounded than normal, due to how they were made. TF2 tunnels should be jaggedy to not only fit with the theme but how they were created (pick axes and dynamite).