Saturday, January 31, 2009

Lesson 12 - Advanced Displacements

Now im going to teach you about displacements.
First, I will give you a little information. I am going to tell you some of the common mistakes people make.

If you are New to Mapping Click this link and start at the beginning.

This is advanced displacements, if you don't know how to create a displacement, read Lesson 5, First, then try the advanced stuff. Lesson 5 Displacements

When creating displacements, the brush you use to create the displacement, should always start out as a square.(see p1)

You can make displacements out of rectangles, but the vertices will be stretched out and that makes it more difficult, to line up the edges of your displacements.(see p2)

if you were going to make a displacement out of the rectangle, first you should cut it in half, using the carve tool, to make two squares.(see p3)

Then when you create the displacements, the vertices will all be square and easier to manipulate.(see p4)

If you ever make a mistake, then you simply select the displacement, and click the destroy button. It will turn your displacement back into the original brush.(see p5)

Let's say you are starting your map.

We have our skybox and a ground texture. (see p6)

You can't just click on the ground and make a displacement out of it.(see p7)

If you do, then your map will not seal. Displacements are not solid. They are solid to the player, but not to Hammer. As you can see from this bottom view.
(see p8)

So if I were going to create a displacement, I would draw a new brush on top of the ground.(see p9)

Then I would texture the ground, and move it up about 1/3 from the bottom. If you left it on the bottom then when you push the displacement down it would hit the wall of your skybox. So move it up to give yourself working room, then create your displacement.(see p10)(note: I removed the sidewall just for illustration purposes)

As you can see I created my displacement, then I changed the bottom texture back into the skybox texture. We do not need to waste resources drawing the bottom that we will never see. Take notice of the vertices. This was created using a power of three. You have a choice of 2, 3 and 4. Default is three.(see p11)

I do not know why anyone would use 2. Three is good for creating mountains and hills. Power of 4 is good for creating more detail in your displacements, such as blast craters, Roads, piles of hay or boulders.

If you need to change the power of your displacement, after you have created it. Select the displacement, change the power in the face edit sheet. Then click apply.(see p12)

Now the vertices are smaller.(see p13)

Now you're ready to "paint the geometry". (That's another way of saying move the texture up-and-down.)

Click on the texture tool icon, then click on the displacement tab.(see p14)

Select your displacement, then click the paint geometry button.(see p15)

Now when the "displacement paint geometry dialog box" pops up, you'll see a little green wireframe globe that snaps from vertices to vertices. The globe cursor lets you know which vertices you are about to manipulate. I'm sure you can figure that out all on your own. Some people can't, so I have to say it. On the dialog box in the "effects" field, make sure the radial button next to "raise/lower" is selected. And the box next to "spatial" has the checkmark in it.(see p16)

On the dialog box you can see, "distance" and "radius". Distance is how far up-and-down you want the displacement to move per click. Five is good for that. Radius controls the size of the green globe. The bigger the globe the more vertices you can grab at one time. 155 is good for that.(see p17)

Paint the geometry, move stuff up in some areas, and push it down in others. Do not worry if it looks all crappy and pointy.(see p18)

You can get rid of all the pointy and sharp corners, by using the "smooth" option in the "effects" field on the "Displacement Paint Geometry" dialog box.(see p19)

When using the "smooth" option, you want to make the radius larger than it was when you created the hills and valleys. The the radius was 155. Now I moved it up to 200.(see p20)

Each time you click, it's smooths out the vertices a little. So the more you click, the more smoothing you'll see.
After you smooth them all out you're pretty much done with that.

And it looks much better

When you're ready to place your spawn points on a displacement, you must be very careful. You must take note of the yellow "bounding box" that surrounds the spawn point avatar. If you simply place the spawn point on top of the displacement, more than likely it will not work because part of the bounding box goes into the displacement. Hammer will detect an error and delete the spawn point. So after you place each avatar, on a displacement. You need to move them up a little, so that you can see the complete bounding box surrounding the spawn point avatar.(see p22)

The neat thing about displacements is, some of the textures have 2 textures in one. They are called alpha channels. All the textures that have the word "blend" in the title, are textures that use alpha channels. Alpha channels are used to give your displacements a more realistic feel. Some alpha channels change grass to dirt. Some change rock to grass. Some make the grass grow and make the grass go flat. You have to try them out to see what the alpha channels do.

To paint alpha channels click on the texture icon, the green rubic's cube.
Click the displacement tab.
Select your displacement.

Now instead of clicking "paint geometry", click "paint alpha".(see p23)

On the "Displacement Paint Alpha" dialog box, make sure raise/lower is selected in the "effects" field.
"Brush" - controls the size of the paintbrush.
"Value" - controls how much paint will be applied with each click of the mouse. You can set these to what ever works for you.(see p24)(Note: You can hold the mouse button down and move the mouse around on the displacement to paint it.)

Go ahead and paint alpha. You can use alpha to create trails, roads and such.(see p25)
(note: the invert alpha button switches between alpha channels, try it and see what I mean)

Now I will explain why you want to create your displacements from brushes that were square.

Let's say you have finished painting the terrain up-and-down. And then you notice a hole in your terrain where two or more displacements meet.(see p26)

To fix this error, you need to use the "sew" option. Select all the displacements surrounding the error. Then click the "sew" button.(see p27)

"Sew" will automatically connect the displacements, If your displacements were created from squares, and are the same power.(see p28)

Sometimes, the textures will not lineup automatically. This can be caused by displacements that are of different powers. Or the original brush is a different size square from the one you are trying to connect to.

If this is the case, you can correct this error by making a patch out of another displacement.

To do this, draw a brush completely covering the hole even overlappingly a bit on the edges.(see p29)

Texture the top of the brush the same as the ground.(see p30)

Then create the displacement.(see p31)

Using the paint geometry option, pull the edges down(see p32)

Play with it until you camouflage the error. People who play on your map, will never even know what happened here.
If I didn't have the patch highlighted you couldn't even see it. (see p33)

You can also create realistic looking rocks or boulders.

Create a brush slightly larger than the rock you wish to create.(see p34)

When you are ready to create the displacements, Select all sides of the brush except the bottom.(see p35)

Create your displacement.(see p36)

Texture your displacement using a rock texture.(see p37)
(note: textures that have the word "model" in the title, will show up black in your map, when looked at from certain angles, don't use these.)

Select the "displacement tab" on the "face edit sheet" dialog box. Select all sides of the brush.(see p38)

Now, click on the "subdivide" button. It rounds out all the corners. As you can see.(see p39)

Now, all you have to do is use "paint geometry" to push the displacements up, down, back and forth.
Take a look at this pull down menu.(see p40) This is where you can change the direction in which the vertices move. "Face normal" is default. It is up-and-down. The x-axis and the y-axis move the vertices back and forth or in and out. The z-axis is up-and-down, just like "face normal".

Try changing these values, paint the geometry and make the brush look more like a natural rock.(see p41)

I have a video you can watch, that will show you how to create cliffs.

Pupsters Day of Defeat Mapping - For more funny movies, click here
I hope you have fun, and learned little bit.

If you make a map that you think is good enough, send it to me.
If I like it, I'll play it on my server.

GoTo Lesson 13 - water