Displacement Grass

From Valve Developer Community
(Redirected from Creating Grass)
Jump to navigation Jump to search
English (en)Русский (ru)Translate (Translate)
Broom icon.png
This article or section needs to be cleaned up to conform to a higher standard of quality.
For help, see the VDC Editing Help and Wikipedia cleanup process. Also, remember to check for any notes left by the tagger at this article's talk page.

Without going into a detailed displacement tutorial this article is going to cover the basics of creating grass in random spots on a surface with a sample project where 3 brushes have been created to illustrate how blended textures can work for you. This article has examples for both HL2, HL2DM and CS:Source. The example maps can be downloaded at the bottom of the page.

Displacement.png

Creating the displacements

To produce grass the displacements will have to be created first. For this example displacements powers 2 and 3 are going to be used. A displacement power of 4 is really not needed for something like this unless you are trying to create something that is extremely smooth and round.

There are a few things you need to keep in mind, the most important being that displacement surfaces do not seal leaks and they don't block visibility.

In the face edit dialog, open the Displacement tab (shown below) and then select the brush you want to create the displacement on, and finally click the Create button.

This is where you will enter either 2, 3 or 4 as the power of your displacement. Notice that the brush on the left has a displacement power of 3 while the one in the center has a power of 2.

To have the blended grass all you need to do is apply the displacement power of 2, compile the map and the grass sprites will be added. You won't see these in Hammer but they will appear in the game.

For the brush on the left a power of 3 will be applied, and once the displacement is created some noise will be added.

Click the Noise button and give it the settings of Min 0.5 and Max 3.0, then apply those settings and look at your displacement. It now has nice looking random bumps. After using Noise, you may have to use the Sew tool.

Here's an explanation of the Noise feature, from Valve:

Add random noise to the selected displacement surface. The Min value sets the greatest distance in units that a point on the displacement will move downward along the face normal. Max sets the greatest distance upward along the face normal. Clicking OK will randomize the position of the points on the displacement somewhere between these two values.
WiseGrass03.jpg

Now one more feature, Paint Alpha, will be used on the brush on the left.

WiseGrass04.jpg

With the tool you are going to bring out some of the sandy area of our left brush and in those sandy areas you won't see grass or grass sprites. You should really experiment with the settings on this tool, and the brush sizes. For this example only the Raise/Lower options are used with a brush size of either 1 or 2 and radiuses of 25.0 and 117.0.

Texturing

The textures used in these examples are:

  • HL2 - nature/blendgrassgravel001b
  • CS:S - nature/blendgrassgravel003a

When you are looking for blending textures for your maps use the filter word blend and you will find blended textures for grass, sand and gravel. Feel free to experiment with these.

In these examples, the textures have been applied to every face of the displacement brushes but only 2 faces of the normal brush the player will start on. The reason is to show there will be no grass sprites on the normal brush but it will have the same grass texture as the other surfaces. The one face that faces the neighboring displacement brush has been textured for it can help to eliminate those flickering lines you see in maps at the edge of brushes.

Always texture your displacement brushes on all sides, this way you will not get the nodraw on displacement surface error. Additionally, the compiler is going to toss out those faces anyway, only the displaced faces will be created.

Because displacements don't seal your map you will always have another brush behind them. In this example the bottom brush is entirely textured with the nodraw texture. Thus a normal world brush textured with nodraw is sealing the map under the displacements.

Fine tuning the surroundings

Notice how well the three brushes blended together.

In the example maps, some static props have been added to show how simple things like weeds can be added. There are lots of SDK models you can use in your maps.

The models used here are:

  • models/props_foliage/cattails.mdl
  • models/props_foliage/Shrub_01a.mdl
Collisions: Not Solid
Disable Shadows: Yes

Notice that the shadows have been disabled. You can get some pretty odd effects when you place props like these in your grass, sometimes it's best to disable shadows for your foliage.

A small rock ledge has also been created using the Noise tool but with a higher setting of Max 7.0 and the same Min of 0.5 to create a blended rock area (it has only been done for the HL2 version but it's the same method for CS:S). This can be very helpful when you need to hide mating edges or anything odd, plus rocks like these are always nice in an outdoor map so they should hardly ever look out of place.

See also