Displacement Grass: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(I cleaned this tutorial up a bit. Hope the author won't mind :))
m (Nesciuse moved page Displacement Grass/en to Displacement Grass without leaving a redirect: Move en subpage to basepage)
 
(22 intermediate revisions by 11 users not shown)
Line 1: Line 1:
To create grass that appears in random locations is a simple task in Source mapping.
{{LanguageBar}}


Without going into a detailed [[displacement]] tutorial we're going to cover the basics of achieving this effect with a sample project where I have created 3 brushes to illustrate how blended textures can work for you. In this example I've created a HL2/HL2DM example and a separate CS:Source example. As always '''the download is at the bottom of the tutorial'''.
{{cleanup}} <!--This page needs sections and possibly floating images-->


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'''.
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:S]]ource. The example maps can be downloaded at the bottom of the page.


The textures I've used for these examples are:<br />
[[File:Displacement.png|thumb|300px|right]]
<i>HL2 nature/blendgrassgravel001b<br />
CS:S nature/blendgrassgravel003a</i>


When you are looking for '''blend*''' 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.
== 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.  


I've applied the textures 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, and I've textured the one face that faces the neighboring displacement brush out of habit, this can help to eliminate those flickering lines you see in maps at the edge of brushes.  
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.


Always texture your displacement brushes on all sides, this way you won't get the ''nodraw on displacement surface'' error, and besides, the compiler is going to toss out those faces anyway, only the displaced faces will be created.  
In the [[Hammer_Face_Edit_Dialog|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.


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.
[[File:WiseGrass02.jpg|thumb|300px|right|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.]]


<center>[[Image:WiseGrass01.jpg]]</center>
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.  


To produce our grass we will first create the displacements. For this example we are going to use displacements powers 2 and 3. 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.  
For the brush on the left a power of 3 will be applied, and once the displacement is created some noise will be added.


With the [[Hammer_Face_Edit_Dialog|face edit dialog]] open click on the '''Displacement''' tab (shown below) and then select the brush you want to create the displacement on, and finally click the '''Create''' button.  
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.


This is where you will enter either 2, 3 or 4 as the power of your displacement.  
Here's an explanation of the Noise feature, from Valve:
<center>[[Image:WiseGrass02.jpg]]</center>
:''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.''


Notice that the brush on the left has a displacement power of 3 while the one in the center has a power of 2.  
[[File:WiseGrass03.jpg|thumb|300px|right]]


To have the blended grass all we 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.  
Now one more feature, '''Paint Alpha''', will be used on the brush on the left.  


'''That's all we're going to do for the center brush.'''
[[File:WiseGrass04.jpg|thumb|300px|right]]


For the brush on the left we're going to apply a power of 3 then once the displacement is created we're going to add some noise.  
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.


'''Noise?''' Sure. Similar to the plugins for most graphics programs Hammer can add Noise for you and apply it to your displacement surfaces.
== Texturing ==
The textures used in these examples are:


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''.
* '''HL2''' - {{code|nature/blendgrassgravel001b}}
* '''CS:S''' - {{code|nature/blendgrassgravel003a}}


'''Here's an explanation of the Noise feature, from Valve:'''
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.
<i>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.</i>


<center>[[Image:WiseGrass03.jpg]]</center>
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.  


Now we're going to use one more feature on the brush on the left, '''Paint Alpha'''.  
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.  


<center>[[Image:WiseGrass04.jpg]]</center>
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.
 
With the tool we 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 I only used the '''Raise/Lower''' option with a brush size of either 1 or 2 and radiuses of 25.0 and 117.0.
 
One final note about the two displacement brushes, I did have to '''Sew''' them after applying the Noise. To do this select the displacement surfaces you want to sew and then simply click the '''Sew''' button. The Sew option connects the edges of two or more selected displacement surfaces.
 
'''Per Valve:'''
<i>You can sew displacement surfaces in any of the following circumstances:<br />
Any two displacements whose base brushes surfaces share a common edge when coincident endpoints.<br />
Displacements with different resolution settings.<br />
A displacement surface to a non-displacement brush face, as long as the base face of the displacement shares a common edge.<br />
A displacement surface to another displacement surface where a shared edge is exactly half the width of the other (called a T-junction).</i>
 
I've also placed a few static props in the example maps to show how simple things like weeds can be added. There are lots of SDK models you can use in your maps.
 
The models I used are:<br />
<i>prop_static<br />
models/props_foliage/cattails.mdl<br />
models/props_foliage/Shrub_01a.mdl<br />
Collisions: Not Solid<br />
Disable Shadows: Yes</i>
 
Notice that I've disabled shadows. 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 weeds.
 
I've also created a small rock ledge 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 (I only did this in 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.
 
Here are a few shots of our three brushes in the game:
 
<center>[[Image:WiseGrass05.jpg]]</center>
 
Notice how well the three brushes blended together.
 
This rock ledge may look odd to some of you but here in the Smokie Mountains where I live rock ledges like this are common. This one is only meant as an example, in an actual map I would not have made it so long.


<center>[[Image:WiseGrass06.jpg]]</center>
== Fine tuning the surroundings ==
[[File:WiseGrass05.jpg|thumb|300px|right|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.


Have fun. 
The models used here are:


If you need further help please [http://www.akilling.org/akg/default.asp?akg=contact contact me] or [http://www.akilling.org/akg/forums/ use these forums].
* {{code|models/props_foliage/cattails.mdl}}
* {{code|models/props_foliage/Shrub_01a.mdl}}
: '''Collisions:''' ''Not Solid''
: '''Disable Shadows:''' ''Yes''


===See also===
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.


[[Prop_Types_Overview#Automatically Emitting prop_details on a Material|How to create a texture that automatically uses detail props]]<br />
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.  
[http://www.akilling.org/download/wiseGrass.zip The example used in this tutorial.]


[[Category:Tutorials]] [[Category:Level Design]]
== See also ==
* [[Prop_Types_Overview#Automatically Emitting prop_details on a Material|How to create a texture that automatically uses detail props]]
* [http://veazie.org/HL2/wiseGrass.zip The example used in this tutorial.]
[[Category:Tutorials]]
[[Category:Displacements]]

Latest revision as of 06:15, 12 July 2024

English (en)Русский (ru)中文 (zh)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