Difference between revisions of "Masking with Get Nodes"

From Terragen Documentation from Planetside Software
Jump to: navigation, search
(Added Masking with Get Nodes tutorial.)
 
m (Minor changes to wording and example images. Content files pending.)
Line 18: Line 18:
  
 
== Adding the blue function nodes ==
 
== Adding the blue function nodes ==
We need to add some function nodes, also known as blue nodes, in order to create the types of masks we need.  In the Node Network pane, press the “Tab” or “N” key to bring up the Quick Node Palette, and then start to type the word “Get”.  The node list in the Quick Node Palette will jump to the closest entry it can find to what you’ve typed.  Double click on the “Get altitude” node to add it to the Node Network pane.   
+
We need to add some function nodes, also known as blue nodes, in order to create the types of masks we need.  In the Node Network pane, press the “Tab” or “N” key to bring up the Quick Node Palette, and then start to type the word “Get”.  The node list in the Quick Node Palette will jump to the closest entry it can find to what you’ve typed.  Double click on the “Get altitude” node to add it to the Node Network pane.  To learn more about the Quick Node Palette click [[Quick_Node_Palette | here ]].
 
[[File:Tutorial_GetNodeMasking_03QuickNodePalette.png|none|800px|Use the Quick Node Palette to easily add any node to the project.]]
 
[[File:Tutorial_GetNodeMasking_03QuickNodePalette.png|none|800px|Use the Quick Node Palette to easily add any node to the project.]]
  
Line 45: Line 45:
  
  
Let’s look at what happens when we swap the outputs of the “Get altitude 01” node and the “Get altitude in texture 01” nodes to the “Subtract scalar 01” node’s inputs.  Drag the output of the “Get altitude 01” node to the “Input 2” of the “Subtract scalar 01” node, and the output of the “Get altitude in texture 01” to the “Main input” of the “Subtract scalar 01” node.  The white areas represent a “Favor Depressions” solution.
+
Let’s look at what happens when we swap the outputs of the “Get altitude 01” node and the “Get altitude in texture 01” nodes to the “Subtract scalar 01” node’s inputs.  Drag the output of the “Get altitude 01” node to the “Input 2” of the “Subtract scalar 01” node, and the output of the “Get altitude in texture 01” to the “Main input” of the “Subtract scalar 01” node.  Now the white areas represent a “Favor Depressions” solution.
 
[[File:Tutorial_GetNodeMasking_09SwapGets.png|none|800px|Switching the order of the Get Altitude nodes can create the inverse effect.]]
 
[[File:Tutorial_GetNodeMasking_09SwapGets.png|none|800px|Switching the order of the Get Altitude nodes can create the inverse effect.]]
  
Line 56: Line 56:
 
When the “Get altitude” node’s output is connected to the Main input of the Subtract scalar node, and the output of the Get altitude in texture” node is connected to the Input 2 of the Subtract scalar node, then the displaced terrain that is above the smooth version of the terrain is the result of the blue nodes, in other words the result favors the higher areas of the terrain, the term for which is “favors rises”.
 
When the “Get altitude” node’s output is connected to the Main input of the Subtract scalar node, and the output of the Get altitude in texture” node is connected to the Input 2 of the Subtract scalar node, then the displaced terrain that is above the smooth version of the terrain is the result of the blue nodes, in other words the result favors the higher areas of the terrain, the term for which is “favors rises”.
  
You might wonder how the smooth terrain is determined, and that’s where the Compute Terrain node comes in.  In the Node Network pane, double click on the “Compute Terrain” node to open its dialog pane.  By default the “Gradient patch size” value is set to 20.  Change the value to “200.0” and let the 3D Preview refresh. As you can see there are now larger areas in white but fewer of them.  This is because Terragen is sampling data points 200 meters apart to determine the shape of the smooth terrain.   
+
You might wonder how the smooth terrain is determined, and that’s where the Compute Terrain node comes in.  In the Node Network pane, double click on the “Compute Terrain” node to open its dialog window.  By default the “Gradient patch size” value is set to 20.  Change the value to “200.0” and let the 3D Preview refresh. As you can see there are now larger areas in white but fewer of them.  This is because Terragen is sampling data points 200 meters apart to determine the shape of the smooth terrain.   
 
[[File:Tutorial_GetNodeMasking_10ComputeTerrain200.png|none|800px|The Compute Terrain node determines the distance between the sample points.]]
 
[[File:Tutorial_GetNodeMasking_10ComputeTerrain200.png|none|800px|The Compute Terrain node determines the distance between the sample points.]]
  
Line 69: Line 69:
  
 
== Manipulating the blue function nodes output ==
 
== Manipulating the blue function nodes output ==
So far we’ve learned the difference between “favor rises” and “favor depressions” and how to choose an overall scale.  Now let’s learn how to manipulate the results of the Subtract scalar node by using the Colour adjust shader.  In the Node Network layout double click on the “Colour adjust shader 01” node to open its dialog window.   
+
So far we’ve learned the difference between “favor rises” and “favor depressions” and how to choose an overall scale.  Now let’s learn how to manipulate the results of the Subtract scalar node by using the Colour adjust shader.   
 +
 
 +
In the Node Network layout double click on the “Colour adjust shader 01” node to open its dialog window.   
 +
 
 +
[[File:ColoruAdj_00-2_GUI.png|none|470px|Colour Adjust shader.]]
  
 
On the Input levels tab, the Black point value and White point value are used to adjust the results of the Subtract scalar node.  Colour values below the Black point become black and those above the White point become white.  It’s important to understand that the results of the Subtract scalar node represent the difference between a smooth version and a displaced version of the terrain at a given sample point.
 
On the Input levels tab, the Black point value and White point value are used to adjust the results of the Subtract scalar node.  Colour values below the Black point become black and those above the White point become white.  It’s important to understand that the results of the Subtract scalar node represent the difference between a smooth version and a displaced version of the terrain at a given sample point.
 +
  
 
In the “favors depression” mode, which we’re in, lowering the black point softens the edges and spreads the mask outward, making the masked area larger.   
 
In the “favors depression” mode, which we’re in, lowering the black point softens the edges and spreads the mask outward, making the masked area larger.   
Line 90: Line 95:
  
 
In the “favors depressions” mode, lowering the white point towards the black point creates a harder edge around the masked area.  
 
In the “favors depressions” mode, lowering the white point towards the black point creates a harder edge around the masked area.  
[[File:Tutorial_GetNodeMasking_12-5_LowerWhtPnt_strip3.JPG|none|800px|Lowering the White point towards the Black point creates a harder edge around the mask.]]
+
[[File:Tutorial_GetNodeMasking_12-5-2_LowerWhtPnt_strip3.JPG|none|800px|Lowering the White point towards the Black point creates a harder edge around the mask.]]
  
  
Line 118: Line 123:
  
  
On the Colour tab enable the “Apply colour” checkbox, then click on the color swatch button to the right of the “Diffuse colour” slider to open the color picker pane.  Choose a color that you want for the stones.
+
On the Colour tab enable the “Apply colour” checkbox, then click on the color swatch button to the right of the “Diffuse colour” slider to open the Color picker window.  Choose a color that you want for the stones.
 
[[File:Tutorial_GetNodeMasking_18FakeStonesColourTabCropped.png|none|800px|Set the colour of the stones with the Apply colour settings.]]
 
[[File:Tutorial_GetNodeMasking_18FakeStonesColourTabCropped.png|none|800px|Set the colour of the stones with the Apply colour settings.]]
  
Line 127: Line 132:
  
 
== Masking with the blue function nodes - Vegetation population ==
 
== Masking with the blue function nodes - Vegetation population ==
Next we’ll add a population of plants, using the fern object from the Walli Plant Pack #1 available as a free download on the Planetside Software website.
+
Next we’ll add a population of plants, using the fern object from the Walli Plant Pack #1 available as a free download on the Planetside Software website.  To see all of the available free content for Terragen click [https://planetside.co.uk/free-downloads/ here ].
 
[[File:Tutorial_GetNodeMasking_18-1_WalliPlantPackFerns.jpg|none|800px|Ferns from the Walli Plant Pack #1.]]
 
[[File:Tutorial_GetNodeMasking_18-1_WalliPlantPackFerns.jpg|none|800px|Ferns from the Walli Plant Pack #1.]]
  
Line 135: Line 140:
 
Start by adding a new Surface layer like we did in the previous steps and be sure to check its “Enable test colour” checkbox and give it a different test colour.  The new Surface layer will override the colour of our terrain temporarily.   
 
Start by adding a new Surface layer like we did in the previous steps and be sure to check its “Enable test colour” checkbox and give it a different test colour.  The new Surface layer will override the colour of our terrain temporarily.   
  
In the Node Network layout, select the “Colour adjust shader 01” and press “Ctl C” to copy the shader, then press “Ctl V” to paste a new copy into the Node Network layout.  Double click on the new node to open its dialog window.  Rename the node to something descriptive like “Colour adjust shader Plants”.   
+
In the Node Network layout, select the “Colour adjust shader 01” and press “Ctrl+C” to copy the shader, then press “Ctrl+V” to paste a new copy into the Node Network layout.  Double click on the new node to open its dialog window.  Rename the node to something descriptive like “Colour adjust shader Plants”.   
  
 
Drag the output of the “Subtract scalar 01” node to the “Main input” of the  “Colour adjust shader Plants” node, then drag the output of the “Colour adjust shader Plants” node to the “Mask shader” input of the “Surface layer 02” node.
 
Drag the output of the “Subtract scalar 01” node to the “Main input” of the  “Colour adjust shader Plants” node, then drag the output of the “Colour adjust shader Plants” node to the “Mask shader” input of the “Surface layer 02” node.
Line 155: Line 160:
  
  
Click again on the green “Plus” button to the right of the “Use density shader” parameter and select “Go to Distribution shader v4 01”.  When the Distribution shader’s dialog pane opens click on the “Altitude constraints” tab and check the “Enable maximum altitude” checkbox and enter a value of “150.0” for the “Maximum altitude” and a value of “50.0” for the “Max alt fuzzy zone” value..
+
Click again on the green “Plus” button to the right of the “Use density shader” parameter and select “Go to Distribution shader v4 01”.  When the Distribution shader’s dialog window opens click on the “Altitude constraints” tab and check the “Enable maximum altitude” checkbox and enter a value of “150.0” for the “Maximum altitude” and a value of “50.0” for the “Max alt fuzzy zone” value..
 
[[File:Tutorial_GetNodeMasking_21DistributionShaderAltContraints.png|none|800px|Set the Altitude constraints to limit how far up the mountains the population can go.]]
 
[[File:Tutorial_GetNodeMasking_21DistributionShaderAltContraints.png|none|800px|Set the Altitude constraints to limit how far up the mountains the population can go.]]
  
Line 175: Line 180:
 
Press the “Tab” or “N” key to bring up the Quick Node Palette and select “Power fractal shader v3 - Colour” from the list.   
 
Press the “Tab” or “N” key to bring up the Quick Node Palette and select “Power fractal shader v3 - Colour” from the list.   
  
Double click on the Power fractal node to open its dialog pane and rename it to something descriptive like “Power fractal shader Tints”, then under the “Scale” tab set the “Feature scale” to “3.0” and the “Lead-in scale” value to “100.0”.   
+
Double click on the Power fractal node to open its dialog window and rename it to something descriptive like “Power fractal shader Tints”, then under the “Scale” tab set the “Feature scale” to “3.0” and the “Lead-in scale” value to “100.0”.   
  
 
On the “Colour” tab enable the “Apply low colour” then click on its “Color swatch” to the right of the slider and select a color around the sRGB values of 198,213,124.   
 
On the “Colour” tab enable the “Apply low colour” then click on its “Color swatch” to the right of the slider and select a color around the sRGB values of 198,213,124.   
Line 189: Line 194:
  
  
Before adding any remaining plant populations, I’m going to move the camera closer to the mountains.  This artistic choice is due having set the scale of the plants so large in order to see them, and if we don’t address this now any populations we add down the line will also need to be “larger than life”.
+
Before adding any remaining plant populations, I’m going to move the camera closer to the mountains.  This artistic choice is due to having set the scale of the plants so large in order to see them, and if we don’t address this now any populations we add down the line will also need to be “larger than life”.
  
With the camera repositioned, add a scale reference object to the scene.  Click the “Add Object” button and select “Object” and then “Cube”.
+
With the camera repositioned, let's add an object to serve as a human-sized scale reference to the scene.  Click the “Add Object” button and select “Object” and then “Cube”.
 
[[File:Tutorial_GetNodeMasking_28AddCubeCropped.png|none|589px|One way to add a size reference object is to add a cube to the project.]]
 
[[File:Tutorial_GetNodeMasking_28AddCubeCropped.png|none|589px|One way to add a size reference object is to add a cube to the project.]]
  
Line 263: Line 268:
  
  
In order to get more variation in the grasses, two more grass populations were added using the same techniques described above.  Each population has its own power fractal shader to randomize the tint colour slightly.  The detailed settings for these nodes can be seen in the project file that accompanies this tutorial.
+
In order to get more variation in the grasses, two more grass populations were added using the same techniques described above.  Each population has its own power fractal shader to randomize the tint colour slightly.   
 +
 
 +
[[File:Tutorial_GetNodeMasking_40_FinalGrassesFerns.jpg|none|800px|Final placement of vegetation.]]
  
[[File:Tutorial_GetNodeMasking_40_FinalGrassesFerns.jpg|none|800px|Final placement of vegitation.]]
 
  
 +
The detailed settings for these nodes can be seen in the project file that accompanies this tutorial.
 
<br />
 
<br />

Revision as of 19:41, 17 February 2021

Masking with Get Nodes


Overview[edit]

With Terragen’s powerful masking capabilities, we have many ways to control the shaders that provide colour, texture, displacements and even populations within our project. Often by using a Distribution shader’s altitude and slope constraint parameters we can achieve the look and level of control we’re after quite quickly.

In this tutorial we’ll explore a way of creating masks using some of the blue functions nodes and introduce the concepts of “favor depressions” and “favor rises” as another way to mask or isolate regions of the terrain. Using these techniques we can do things like limit a population of shrubs to a ravine, or limit a population of grasses to the top of an exposed area of the terrain.


Getting started[edit]

Let’s start with the default Terragen scene and begin by disabling the Simple shape shader that flattens the ground. Click on the “Terrain” button below the Main Menu, then click on the “Plus” sign to the left of the “Fractal terrain 01” node in the Object Node List to reveal its child node, the Simple shape shader 01 node. Select the Simple shape shader node and uncheck its “Enable” checkbox. Alternatively, you could select the Simple shape shader node in the Node Network pane and press the “D” key to disable the node. Once you do that the mountainous terrain will fill the 3D viewport.

Start by disabling the Simple shape shader that flattens the terrain in the default Terragen project.


Let’s move the camera closer to the terrain because eventually we’ll be adding a lot of populations, and just for fun enable the “HD” button for higher detail. It’s located above the 3D viewport.

Enable higher detail in the 3D Preview by clicking on the HD button.


Adding the blue function nodes[edit]

We need to add some function nodes, also known as blue nodes, in order to create the types of masks we need. In the Node Network pane, press the “Tab” or “N” key to bring up the Quick Node Palette, and then start to type the word “Get”. The node list in the Quick Node Palette will jump to the closest entry it can find to what you’ve typed. Double click on the “Get altitude” node to add it to the Node Network pane. To learn more about the Quick Node Palette click here .

Use the Quick Node Palette to easily add any node to the project.


Repeat these steps to add nodes for “Get altitude in Atmosphere”, “Subtract scalar” and “Colour adjust “. When you’re done the Node Network pane will look like this.

The blue function nodes added to the project via the Quick Node Palette.


Let’s connect the blue nodes together so they can work their magic. Click on the “Output” triangle below the “Get altitude 01” node and drag a line to the “Main input” of the “Subtract scalar 01” node. In a similar way, drag the output of the “Get altitude in texture” node to the “Input 2” of the “Subtract scalar 01” node. Drag one more connection line from the output of the “Subtract scalar 01” node to the “Main input” of the “Colour adjust shader”.

The blue function nodes wired together to create a mask.


Visualizing the blue function nodes output[edit]

In order to visualize what these nodes are doing, let's set up a temporary shader to view the results. Click on the “Shaders” button below the Main Menu, then click on the “Add Layer” button and select “Surface Layer”.

Surface layer shader can be used to help visualize where an effect will be seen.


Click on the green “Plus” button to the right of the “Mask by shader” field and select “Assign Shader” then the “Colour adjust shader 01” from the list. Alternately, you can drag a connecting line from the “Colour adjust shader 01” output to the “Surface layer 01” Mask shader input.

Assign the Colour adjust shader to the Surface layer’s Mask by shader setting.


When that’s done, you’ll see something like this. The areas in white represent the mask we’ve created by linking the blue function nodes together, and the way in which we’ve connected them will yield a “Favor Rises” solution. More on that in a moment.

The temporary Surface layer now displays where the effect will take place on the terrain.


Let’s look at what happens when we swap the outputs of the “Get altitude 01” node and the “Get altitude in texture 01” nodes to the “Subtract scalar 01” node’s inputs. Drag the output of the “Get altitude 01” node to the “Input 2” of the “Subtract scalar 01” node, and the output of the “Get altitude in texture 01” to the “Main input” of the “Subtract scalar 01” node. Now the white areas represent a “Favor Depressions” solution.

Switching the order of the Get Altitude nodes can create the inverse effect.


How the blue function nodes work[edit]

It’s pretty easy to imagine some of the uses for these types of masks, so let's try to understand what is happening in the node set up. Internally, Terragen is comparing a smooth version of the terrain, the “Get altitude node”, with the displaced version of the terrain, the “Get altitude in texture” node. The difference between the two results in the mask we see.

When the “Get altitude in texture” node’s output is connected to the Main input of the Subtract scalar node, and the output of the “Get altitude” node is connected to the Input 2 of the Subtract scalar node, then the displaced terrain that is below the smooth version of the terrain is the result of the blue nodes, in other words the result favors the lower areas of the terrain, the term for which is “favors depressions”.

When the “Get altitude” node’s output is connected to the Main input of the Subtract scalar node, and the output of the Get altitude in texture” node is connected to the Input 2 of the Subtract scalar node, then the displaced terrain that is above the smooth version of the terrain is the result of the blue nodes, in other words the result favors the higher areas of the terrain, the term for which is “favors rises”.

You might wonder how the smooth terrain is determined, and that’s where the Compute Terrain node comes in. In the Node Network pane, double click on the “Compute Terrain” node to open its dialog window. By default the “Gradient patch size” value is set to 20. Change the value to “200.0” and let the 3D Preview refresh. As you can see there are now larger areas in white but fewer of them. This is because Terragen is sampling data points 200 meters apart to determine the shape of the smooth terrain.

The Compute Terrain node determines the distance between the sample points.


Change the “Gradient patch size” value to “2000.0” and then to “2.0” to see the different results.

The Compute Terrain node set to 2000 metres.


For the “Gradient patch size” value set to “2.0”, I’ve enabled the Ray-traced Preview mode by checking the “RTP” button above the 3D Preview and checking the “Enable test colour” checkbox for the surface layer so that the mask can be seen more clearly. The reason behind the smaller differences is because the smooth version of the terrain more closely matches the displaced version of the terrain.

The Computer Terrain node set to 2 metres.


Manipulating the blue function nodes output[edit]

So far we’ve learned the difference between “favor rises” and “favor depressions” and how to choose an overall scale. Now let’s learn how to manipulate the results of the Subtract scalar node by using the Colour adjust shader.

In the Node Network layout double click on the “Colour adjust shader 01” node to open its dialog window.

Colour Adjust shader.

On the Input levels tab, the Black point value and White point value are used to adjust the results of the Subtract scalar node. Colour values below the Black point become black and those above the White point become white. It’s important to understand that the results of the Subtract scalar node represent the difference between a smooth version and a displaced version of the terrain at a given sample point.


In the “favors depression” mode, which we’re in, lowering the black point softens the edges and spreads the mask outward, making the masked area larger.

Lowering the Black point softens the edges and spreads the mask outwards.


In the “favors depression” mode, raising the black point towards the white point, hardens the edge of the mask and constricts it, making the masked area smaller.

Raising the Black point hardens the edge and constricts it.


In the “favors depressions” mode, raising the black point above the white point, inverts the mask and eventually fills it in.

Raising the Black point above the White point inverts the mask and fills it in.


In the “favors depression” mode, raising the white point softens the lower edges but shrinks the size of the mask as well.

Raising the white point softens the lower edges but shrinks the size of the mask.


In the “favors depressions” mode, lowering the white point towards the black point creates a harder edge around the masked area.

Lowering the White point towards the Black point creates a harder edge around the mask.


In the “favors depression” mode, lowering the white point below black point inverts the masked areas and begins to soften the edges while reducing the area covered by the mask.

Lowering the White point below the Black point inverts the mask, softens the edges and reduces the coverage.


In the “favors depressions” mode, lowering the black point and raising the white point expands and dissipates the strength of the coverage of the mask.

Lowering the Black point and raising the White point expands and dissipates the strength of the mask.


Now that we have an idea of how to manipulate the results of the Subtract scalar node with the Colour adjust shader node, we can use the Surface layer’s Altitude constraints to further refine the mask. With the Surface Layer selected go to the “Altitude constraints” tab and enable the “Limit maximum altitude” checkbox and enter a value of “150.0” in the “Maximum altitude” field and a value of “50.0” in the “Max alt fuzzy zone” field. This will softly constrain the mask we’re creating to the lower altitudes.

Use the Surface layer’s Altitude constraints to limit how far up the mountains the mask can go.


Masking with the blue function nodes - Fake stones[edit]

There are a number of ways to use these masks. Let’s simulate a bunch of small rocks that have slipped down or are exposed on the sides of the terrain defined by our “favors depression” mask. With Surface layer 01 selected click on the “Add Child Layer” button, then select “Displacement Shader” and finally select “Fake Stones”.

Adding a child layer of Fake Stones.


On the Fake stone shader 01 “Scale/Density” tab set the value of the “Stone scale” to “0.55” and the “Stone density” value to about “0.45”. These values control the size of the stones and how tightly packed they are.

Use the Stone scale and Stone density values to control the size and spacing of the stones.


On the Shape tab set the “Stone tallness” value to “0.5”. This parameter and the “Pancake effect” parameter control how flat the stones are.

Stone tallness sets the height of the stone, and Pancake effect flattens the stone.


On the Colour tab enable the “Apply colour” checkbox, then click on the color swatch button to the right of the “Diffuse colour” slider to open the Color picker window. Choose a color that you want for the stones.

Set the colour of the stones with the Apply colour settings.


Here’s a rendered image of the fake stones

Rendered image showing the placement of the fake stones.


Masking with the blue function nodes - Vegetation population[edit]

Next we’ll add a population of plants, using the fern object from the Walli Plant Pack #1 available as a free download on the Planetside Software website. To see all of the available free content for Terragen click here .

Ferns from the Walli Plant Pack #1.


We don’t want to cover all the fake stones with the plant population, so we need some way to adjust the mask we’re using for the fake stones, and we also need to be able to visualize what we’re doing.

Start by adding a new Surface layer like we did in the previous steps and be sure to check its “Enable test colour” checkbox and give it a different test colour. The new Surface layer will override the colour of our terrain temporarily.

In the Node Network layout, select the “Colour adjust shader 01” and press “Ctrl+C” to copy the shader, then press “Ctrl+V” to paste a new copy into the Node Network layout. Double click on the new node to open its dialog window. Rename the node to something descriptive like “Colour adjust shader Plants”.

Drag the output of the “Subtract scalar 01” node to the “Main input” of the “Colour adjust shader Plants” node, then drag the output of the “Colour adjust shader Plants” node to the “Mask shader” input of the “Surface layer 02” node.

On the “Input levels” tab of the “Colour adjust shader Plants” set the “Black point” value to “1.1” and the “White point” value to “2.2”. These adjustments will tighten the mask, drawing its edges in towards the center.

Fine tuning the mask for the population area with the Colour adjustment shader.


Now that we know where we want the plants to be, we can add a Population. Click on the “Objects” button below the Main Menu, then click on the “Add Object” button and select “Population” then select “Tgo reader”. When the file requestor dialog window appears, navigate to your object folder and choose the type of plant you want to use.

Adding the population.


Click on the “Preview colour” checkbox so that we can easily identify the population by the colour indicated by the colour swatch.

Reposition the Population node within the terrain so that more plants will be visible to us from the current camera position by entering a value of “750.0” in the z axis field of the “Area centre” parameter.

We want to incorporate the same altitude constraints as in our original Surface layer, so click on the green “Plus” button to the right of the “Use density shader” field then select “Create new Shader”, then “Color Shader” and then “Distribution shader v4”.

Assign a new Distribution shader as the mask for the population.


Click again on the green “Plus” button to the right of the “Use density shaderparameter and select “Go to Distribution shader v4 01”. When the Distribution shader’s dialog window opens click on the “Altitude constraints” tab and check the “Enable maximum altitude” checkbox and enter a value of “150.0” for the “Maximum altitude” and a value of “50.0” for the “Max alt fuzzy zone” value..

Set the Altitude constraints to limit how far up the mountains the population can go.


On the Coverage/Breakup tab click on the green “Plus” button to the right of the “Mask by shader” field and select “Assign shader” and then “Colour adjust shader Plants”. What we end up with is a mask that is made up of our adjusted “favor depressions” mask and the altitude constraints from the distribution shader.

Assigning the mask for the vegetation.


The plant species we’ve chosen for this tutorial are fairly small, so change the “Object spacing in a,b” values to about “3.0” and under the “Scale” tab set the “Minimum scale” to “2.0” and the “Maxium scale” value to “10.0”. Press the “Populate Now” button to see how the plants are instanced across the landscape. Change the “Preview colour” as needed to see the instances better.

You can set the colour of the instances via the Preview colour picker.


We want the plants to conform to the surface of the terrain, so under the “Rotation” tab, enable the “Lean to terrain/object normal”, set the “Lean effect” value to “1.0”, the “Don’t lean if slow below” value to “5.0”, and the “Reduce lean if slope below” value to “5.0”. These values allow the instanced plant objects to lean in the direction of the terrain in which they’ve “grown” out of. Press the “Populate Now” button again.

The Lean effect settings allow the individual plants to lean in the direction of the terrain surface.


Before we add more plant populations, let’s give this population a little colour variation using Terragen’s Tinting feature. We’ll add a Power fractal node in the Node Network layout so that it’s easily accessible to any other populations we may wish to add.

Press the “Tab” or “N” key to bring up the Quick Node Palette and select “Power fractal shader v3 - Colour” from the list.

Double click on the Power fractal node to open its dialog window and rename it to something descriptive like “Power fractal shader Tints”, then under the “Scale” tab set the “Feature scale” to “3.0” and the “Lead-in scale” value to “100.0”.

On the “Colour” tab enable the “Apply low colour” then click on its “Color swatch” to the right of the slider and select a color around the sRGB values of 198,213,124.

Use a Power fractal shader to set the tinting values for the instanced plant objects.


Make sure the Population object is selected in the Object list and then go to its “Colour” tab and right click on the green “Plus” sign next to the “Tint diffuse colour” and select “Assign Shader” and then “Power fractal shader v3 Tints”.

Internally, Terragen will generate a color value between the Power fractal’s “Apply high colour” component value and the “Apply low colour” component value and multiply these values by the 3D object’s diffuse component values, which in this case will result in a slightly darker value and one that leans towards a yellow green color.

Press the “Populate Now” button.

Assign the Power fractal shader as the Tint diffuse colour.


Before adding any remaining plant populations, I’m going to move the camera closer to the mountains. This artistic choice is due to having set the scale of the plants so large in order to see them, and if we don’t address this now any populations we add down the line will also need to be “larger than life”.

With the camera repositioned, let's add an object to serve as a human-sized scale reference to the scene. Click the “Add Object” button and select “Object” and then “Cube”.

One way to add a size reference object is to add a cube to the project.


On the Cube object’s “Transform” tab change the XYZ values of the “Size” parameter to “0.5, 2.0, 0.5”. This scale represents the approximate size of a human.

Reposition the cube object so that it is near some of the plant objects and resting on the terrain surface. To reposition the cube object, right click in the 3D preview and select “Select Object or Shader” and then select “Cube 01”. Once selected the object’s axis handles will appear allowing you to move, rotate, scale or drop the object to the terrain. Select a handle and drag it around to manipulate the object in the scene.

You can select any object in the project by right clicking in the 3D Preview and choosing Select Object or Shader.


Another way to move the object directly to where you want is to right click in the 3D preview and select “Copy Coordinates”, then click on the “Copy/paste coordinates” button to the right of the “Centre” values and select “Paste coordinates”.

You can copy coordinates from your project by right clicking in the 3D Preview and choosing Copy Coordinates.


Duplicate the cube a few times and reposition them around the plant populations in the scene so we have a good reference for the scale of a human character to base the scale of the plant populations we want to add. To duplicate the cube, simply select the “Cube 01” node in the Node Network layout and press “Ctrl+C” to copy the node and then “Ctrl+V” to paste the node.

With the objects displayed in bounding box mode we can clearly see how unnaturalistic the scale of the plants are in relationship to the scale of the reference cubes.

Select the plant population and reduce its “Minimum scale” value and “Maximum scale” value to something more or less in scale with the cube object. Press the “Populate Now” button to apply the changes to the instanced plant objects.

Rescaling the plant objects closer to real world scale.


Render showing reference cubes for scale.


Masking with the blue function nodes - Grass clumps[edit]

Now we can add some grass clump objects to the same area by repeating the above steps and keeping in mind to use similar scale values for the populations.

Let’s create a mask that “favors rises” and add grass populations to it. Duplicate the “Subtract scalar 01” node by copy and pasting it in the Node Network layout. Rename it to something more descriptive like “Subtract scalar Favor Rises”.

Connect the output of the “Get altitude 01” node to the “Main input” of the new “Subtract scalar Favor Rises”. Connect the output of the “Get altitude in Texture 01” node to the “Input 2” of the new “Subtract scalar Favor Rises” node.

Use the Quick Node Palette to add a new “Colour adjust shader” then rename it to something descriptive like “Colour adjust shader Grasses”. Connect the output of the “Subtract scalar Favor Rises” node to the “Main input” of the “Colour adjust shader Grasses” node.

Setting up the mask for the grass populations.


We can repurpose Surface layer 02 to visualize the new mask we’re creating for the “Favor Rises”. Select “Surface layer 02” in the Shader’s list and enable its test colour, then assign the “Colour adjust shader Grasses” to the “Mask by shaderparameter. The 3D preview will update and display the new mask as the test colour. Change the “Black point” value to “-1.0” in order to expand the mask a bit more towards the fake stone area.

Assigning the Colour adjust shader to the Surface layer and enabling its Test Colour shows us where the grass will be.


Return to the Objects list and add a new object, this time selecting the “Grass clump” as the population type.

Use Terragen’s built-in grass clump object to create grasslands and meadows.


Initialize the population settings with the following values so we can see the results more clearly when we populate the scene. Reposition the population by setting the Z axis value of the “Area Centre” to “750.0”. Set the “Spacing variation in a,b” values to “0.0” so that each instanced grass clump will be aligned. Assign the “Colour adjust shader Grasses” node to the “Use density shaderparameter. Enable the “Clip to camera” checkbox.

On the “Rotation” tab set the “Maximum Y rotation” value to “0.0”, enable the “Lean to terrain/object normal” checkbox, set the “Lean effect” value to “1.0”, the “Don’t lean if slow below “ value to “5.0” and the “Reduce lean if slope below” value to “15.0”.

Press the “Populate Now” button and you’ll see that the grass clumps are constrained to the masked area and more or less conform to the terrain.

The pink areas indicate where the grass clumps can exist.  The white bounding boxes show each grass clump.


However we need to change the diameter of the grass clumps in order for them to conform more accurately to the shape of the terrain. To do this, select the grass Clump object, “Pop Grass clump 01/Grass clump 01” from the Object node list and on the “Grass Clump” tab change the “Clump diameter” to a smaller value, like “4.0”.

Return to the population node, “Pop Grass clump 01”, and change the value of the “Object spacing in a,b” to “4.0”, then press the “Populate Now” button.

Reducing the size of the grass clump will help to conform it to the shape of the hill.


Enable the “RTP” button at the top of the 3D preview to enter Ray-traced preview mode. Viewed this way it appears that the clumps of grass are floating above the terrain.

Enabling the RTP button will give you a better idea of the placement of the grass clumps.


So it’s now a matter of refining the proper size of the grass clump, the spacing between the grass clumps, and then to randomize the grass clumps with the “Spacing variation in a,b” parameter” and the “Maximum Y rotation” parameter.

The final settings for this population of grass clumps, which I renamed to “Low Grasses”, was a value of “0.5” for the “Object spacing a,b”, a value of “0.075” for the “Spacing variation in a,b”, a value of “360.0” for the “Maximum Y rotation”, and a value of “5.0” for the “Reduce lean if slope below”.

The final distribution of grass clumps.


For the “Low Grasses” grass clump object settings, the “Number of blades” value was set to “800.0”, the “Clump diameter” value was set to “2.0”, and the “Blade length” was set to “0.25”. On the Surface Shader tab the Default shader’s “Diffuse colour” was set to a light brown color and the “Translucency” was set to “0.25” in order for some of the shadows to show through the grass blades which helps to achieve a more naturalistic look.

Grass clump settings.


In order to get more variation in the grasses, two more grass populations were added using the same techniques described above. Each population has its own power fractal shader to randomize the tint colour slightly.

Final placement of vegetation.


The detailed settings for these nodes can be seen in the project file that accompanies this tutorial.

A shader is a program or set of instructions used in 3D computer graphics to determine the final surface properties of an object or image. This can include arbitrarily complex descriptions of light absorption and diffusion, texture mapping, reflection and refraction, shadowing, surface displacement and post-processing effects. In Terragen 2 shaders are used to construct and modify almost every element of a scene.

A single object or device in the node network which generates or modifies data and may accept input data or create output data or both, depending on its function. Nodes usually have their own settings which control the data they create or how they modify data passing through them. Nodes are connected together in a network to perform work in a network-based user interface. In Terragen 2 nodes are connected together to describe a scene.

The Node List is a part of the Terragen interface that shows a list of nodes along the left side of the application window. The Node List generally shows only those nodes that are relevant to the current Layout (e.g. Terrain, Atmosphere). It sometimes includes buttons or other controls that are specific to a particular Layout as well. The Node List is hierarchical and each level is collapsible.

A scalar is a single number. 1, 200.45, -45, -0.2 are all examples of scalar values.

A sample refers to a value or set of values at a point in time and/or space. The defining point of a sample is that it is a chosen value out of a continuous signal. In Terragen 2 it is usually a mathematical (procedural) function that is being sampled.

A parameter is an individual setting in a node parameter view which controls some aspect of the node.

The bounding box is a box which surrounds (or bounds) an object or shader. This box shows the maximum extents of the item inside it. Sometimes abbreviated as "b-box".