Difference between revisions of "Masking Populations with Inverted Fractals"

From Terragen Documentation from Planetside Software
Jump to: navigation, search
(Created tutorial for masking populations using inverted power fractal shaders)
 
(Uploading images to wiki tutorial.)
Line 1: Line 1:
 
There are times when you want to create distinct bands of certain populations, as shown in this reference image in which there are patterns of warm brownish-red colored trees juxtaposed with cool dark-green trees.   
 
There are times when you want to create distinct bands of certain populations, as shown in this reference image in which there are patterns of warm brownish-red colored trees juxtaposed with cool dark-green trees.   
  
Show the example image
+
'''Show the example image'''
  
In some cases sharing a mask between two populations and simply enabling the “Invert density shader” checkbox on one of them may achieve this result, but often times when a mask is used to limit the instanced objects to a section within the areas as defined by the population’s “Area length a” and “Area length b” parameters, then inverting the mask may not provide the solution you’re looking for.  This is because inverting the mask would allow the instances to be generated all the way to the extent of the area as defined by the population’s “Area length a” and “Area length b” parameters.
 
  
Tutorial_PowerFractalSubsets_14_SharingNodeInverted
+
In some cases sharing a mask between two populations and simply enabling the “Invert density shader” checkbox on one of them may achieve this result.
Tutorial_PowerFractalSubsets_18ExampleInvertingMasks.png
 
  
Let’s explore how to use two almost identical Power Fractals to provide the masks we need.
+
[[File:Tutorial_MaskPopInvFrac_14_SharingNodeInverted.png|Two Population nodes sharing the same node for their Density shader input.  Invert density shader is enabled on the second population.|800px]]
  
Vfxtut02 - Creating the Population Group mask
 
  
To create the first mask that will be used to band certain species of trees together, right-click in the Node Network view and select “Create Shader”, then “Colour Shader”, then “Power Fractal shader v3”.   
+
But often times when a mask is used to limit the instanced objects to a section within the areas as defined by the population’s “Area length a” and “Area length b” parameters, then inverting the mask may not provide the solution you’re looking forThis is because inverting the mask would allow the instances to be generated all the way to the extent of the area as defined by the population’s “Area length a” and “Area length b” parameters.
  
Tutorial_Generic_FromNodeNetworkAddPowerFracCropped.png
+
[[File:Tutorial_MaskPopInvFrac_18ExampleInvertingMasks.png|Inverting the mask for the second Population in orange fills the entire area as defined by the population's Area Length a/b parameters.|800px]]
  
Double click on the Power Fractal node to open up its dialog pane, then give it a descriptive name. 
 
  
Tutorial_Generic_PowerFractalV3GUICropped.png
+
Let’s explore how to use two almost identical Power Fractals to provide the masks we need.  To create the first mask that will be used to band certain species of trees together, right-click in the Node Network view and select “Create Shader”, then “Colour Shader”, then “Power Fractal shader v3”. 
 +
[[File:Tutorial_Generic_FromNodeNetworkAddPowerFracCropped.png|Adding a Power Fractal shader from the Node Network layout.|800px]]
 +
 
 +
 
 +
Double click on the Power Fractal node to open up its dialog pane, then give it a descriptive name.
 +
 
 +
[[File:Tutorial_Generic_PowerFractalV3GUICropped.png|The Power Fractal shader node Scale tab|800px]]
 +
 
  
 
To help visualize the mask on the terrain, we can add a new shader by clicking on the “Shader” button located right below the main menu, then click “Add Layer” and select “Surface Layer”.
 
To help visualize the mask on the terrain, we can add a new shader by clicking on the “Shader” button located right below the main menu, then click “Add Layer” and select “Surface Layer”.
  
Tutorial_GUI_ShadersAddLayerSurfaceLayer.png
+
'''Tutorial_GUI_ShadersAddLayerSurfaceLayer.png'''
  
 
In the Node Network view drag the output of the Power Fractal node to the input of the Surface Layer’s “Mask by shader” input.
 
In the Node Network view drag the output of the Power Fractal node to the input of the Surface Layer’s “Mask by shader” input.
 
+
[[File:Tutorial_MaskPopInvFrac_01PowerFracSurfLayer.png|800px]]
 
Tutorial_PowerFractalSubsets_01PowerFracSurfaceLayer.png
 
Tutorial_PowerFractalSubsets_01PowerFracSurfaceLayer.png
  
 
We want to create a fairly high contrast mask without a lot of roughness to begin with, so on the Power fractal shader’s Colour tab, set the “Color contrast” value to “1.0”, the “Color roughness” value to “0.0”, and the “Color offset” value to about “-0.3”.   
 
We want to create a fairly high contrast mask without a lot of roughness to begin with, so on the Power fractal shader’s Colour tab, set the “Color contrast” value to “1.0”, the “Color roughness” value to “0.0”, and the “Color offset” value to about “-0.3”.   
 
+
[[File:Tutorial_MaskPopInvFrac_02PowerFracColourTab.png|800px]]
 
Tutorial_PowerFractalSubsets_02PowerFracColourTab.png
 
Tutorial_PowerFractalSubsets_02PowerFracColourTab.png
  
 
On the Tweak Noise tab set the “Noise flavour” to “Perlin ridges”.  The “ridge” noise patterns are the opposite of the “billow” patterns and means they have narrow sharp ridges which drop down to rounded bottoms.
 
On the Tweak Noise tab set the “Noise flavour” to “Perlin ridges”.  The “ridge” noise patterns are the opposite of the “billow” patterns and means they have narrow sharp ridges which drop down to rounded bottoms.
 
+
[[File:Tutorial_MaskPopInvFrac_03PowerFracTweakNoiseTab.png|400px]]
 
Tutorial_PowerFractalSubsets_03PowerFracTweakNoiseTab.png
 
Tutorial_PowerFractalSubsets_03PowerFracTweakNoiseTab.png
  
 
On the Warping tab set the “Lead-in warp effect” to “1 Octave Perlin warp” and the “Lead-in warp amount” value to “2.0”.  This will warp and displace the fractal pattern in a random wavy fashion.
 
On the Warping tab set the “Lead-in warp effect” to “1 Octave Perlin warp” and the “Lead-in warp amount” value to “2.0”.  This will warp and displace the fractal pattern in a random wavy fashion.
 
+
[[File:Tutorial_MaskPopInvFrac_04PowerFracWarpingTab.png|400px]]
 
Tutorial_PowerFractalSubsets_04PowerFracWarpingTab.png
 
Tutorial_PowerFractalSubsets_04PowerFracWarpingTab.png
  
 
On the Scale tab adjust the “Feature scale” and “Lead-in scale” to fit your terrain and scene.  Use the measuring tool if necessary.   
 
On the Scale tab adjust the “Feature scale” and “Lead-in scale” to fit your terrain and scene.  Use the measuring tool if necessary.   
 
+
[[File:Tutorial_MaskPopInvFrac_05PowerFracScaleTab.png|400px]]
 
Tutorial_PowerFractalSubsets_05PowerFracScaleTab.png
 
Tutorial_PowerFractalSubsets_05PowerFracScaleTab.png
  
Line 48: Line 51:
  
 
To visualize this second mask, add another Surface Layer and assign the second power fractal to its “Mask by shader” input.  Enable the Surface Layer’s test colour and change the test colour to anything other than the default pink.
 
To visualize this second mask, add another Surface Layer and assign the second power fractal to its “Mask by shader” input.  Enable the Surface Layer’s test colour and change the test colour to anything other than the default pink.
 
+
[[File:Tutorial_MaskPopInvFrac_06PowerFracSecondBand.png|400px]]
 
Tutorial_PowerFractalSubsets_06PowerFracSecondBand.png
 
Tutorial_PowerFractalSubsets_06PowerFracSecondBand.png
  
 
An added benefit to this method, is now that you have two Power fractals, you can make subtle adjustments to the parameters of one of the patterns to create variations or adjustments if needed.  For example, you could adjust the “Colour offset” value to expand or contract the shape of the fractal pattern which would allow the instanced objects of one population to encroach into the pattern of the other population.
 
An added benefit to this method, is now that you have two Power fractals, you can make subtle adjustments to the parameters of one of the patterns to create variations or adjustments if needed.  For example, you could adjust the “Colour offset” value to expand or contract the shape of the fractal pattern which would allow the instanced objects of one population to encroach into the pattern of the other population.
 
+
[[File:Tutorial_MaskPopInvFrac_19ExamplePowFracOffset.png|400px]]
 
Tutorial_PowerFractalSubsets_19ExamplePowFracOffset.png
 
Tutorial_PowerFractalSubsets_19ExamplePowFracOffset.png
  
 
Now that we have our two masks set up, we can apply them to a population.  Add the first population, and so that we can visualize exactly how the instances are being distributed, zero out the “Spacing variation in a,b” and the “Maximum Y rotation” values.  Apply one of the power fractals as a mask then click Populate Now, and the result will show an aligned grid of trees exactly as defined by the mask.   
 
Now that we have our two masks set up, we can apply them to a population.  Add the first population, and so that we can visualize exactly how the instances are being distributed, zero out the “Spacing variation in a,b” and the “Maximum Y rotation” values.  Apply one of the power fractals as a mask then click Populate Now, and the result will show an aligned grid of trees exactly as defined by the mask.   
 
+
[[File:Tutorial_MaskPopInvFrac_07AddPopulation2Crop.png|400px]]
 
Tutorial_PowerFractalSubsets_07AddPopulation2Crop.png
 
Tutorial_PowerFractalSubsets_07AddPopulation2Crop.png
 +
[[File:Tutorial_MaskPopInvFrac_09PopulateBandATrees.png|400px]]
 
Tutorial_PowerFractalSubsets_09PopulateBandATrees.png
 
Tutorial_PowerFractalSubsets_09PopulateBandATrees.png
  
 
Repeat this procedure for a second group of trees using the other power fractal as the mask.
 
Repeat this procedure for a second group of trees using the other power fractal as the mask.
 
+
[[File:Tutorial_MaskPopInvFrac_08AssignDensityShaderAddPopulation2.png|400px]]
 
Tutorial_PowerFractalSubsets_08AssignDensityShader.png
 
Tutorial_PowerFractalSubsets_08AssignDensityShader.png
 +
[[File:Tutorial_MaskPopInvFrac_10PopulateBandBTrees.png|400px]]
 
Tutorial_PowerFractalSubsets_10PopulateBandBTrees.png
 
Tutorial_PowerFractalSubsets_10PopulateBandBTrees.png
  
 
Now that you’ve established the two masking bands and see that they’re working as desired, you can randomize the populations by returning some value to the “Spacing variation in a,b” and their rotations, and minimum and maximum scales.   
 
Now that you’ve established the two masking bands and see that they’re working as desired, you can randomize the populations by returning some value to the “Spacing variation in a,b” and their rotations, and minimum and maximum scales.   
 
+
[[File:Tutorial_MaskPopInvFrac_11PopulationsRandomized.png|400px]]
 
Tutorial_PowerFractalSubsets_11PopulationsRandomized.png
 
Tutorial_PowerFractalSubsets_11PopulationsRandomized.png
  
 
Next, you can add additional tree populations and choose which band they will be distributed in by selecting the appropriate power fractal as the mask.
 
Next, you can add additional tree populations and choose which band they will be distributed in by selecting the appropriate power fractal as the mask.
 
+
[[File:Tutorial_MaskPopInvFrac_16ExtraPopulations.png|400px]]
 
Tutorial_PowerFractalSubsets_16ExtraPopulations.png
 
Tutorial_PowerFractalSubsets_16ExtraPopulations.png
  
 
+
[[File:Tutorial_MaskPopInvFrac_17Final.png|400px]]
 
Tutorial_PowerFractalSubsets_17Final.png
 
Tutorial_PowerFractalSubsets_17Final.png

Revision as of 16:41, 27 August 2019

There are times when you want to create distinct bands of certain populations, as shown in this reference image in which there are patterns of warm brownish-red colored trees juxtaposed with cool dark-green trees.

Show the example image


In some cases sharing a mask between two populations and simply enabling the “Invert density shader” checkbox on one of them may achieve this result.

Two Population nodes sharing the same node for their Density shader input.  Invert density shader is enabled on the second population.


But often times when a mask is used to limit the instanced objects to a section within the areas as defined by the population’s “Area length a” and “Area length b” parameters, then inverting the mask may not provide the solution you’re looking for. This is because inverting the mask would allow the instances to be generated all the way to the extent of the area as defined by the population’s “Area length a” and “Area length b” parameters.

Inverting the mask for the second Population in orange fills the entire area as defined by the population's Area Length a/b parameters.


Let’s explore how to use two almost identical Power Fractals to provide the masks we need. To create the first mask that will be used to band certain species of trees together, right-click in the Node Network view and select “Create Shader”, then “Colour Shader”, then “Power Fractal shader v3”. Adding a Power Fractal shader from the Node Network layout.


Double click on the Power Fractal node to open up its dialog pane, then give it a descriptive name.

The Power Fractal shader node Scale tab


To help visualize the mask on the terrain, we can add a new shader by clicking on the “Shader” button located right below the main menu, then click “Add Layer” and select “Surface Layer”.

Tutorial_GUI_ShadersAddLayerSurfaceLayer.png

In the Node Network view drag the output of the Power Fractal node to the input of the Surface Layer’s “Mask by shader” input. Tutorial MaskPopInvFrac 01PowerFracSurfLayer.png Tutorial_PowerFractalSubsets_01PowerFracSurfaceLayer.png

We want to create a fairly high contrast mask without a lot of roughness to begin with, so on the Power fractal shader’s Colour tab, set the “Color contrast” value to “1.0”, the “Color roughness” value to “0.0”, and the “Color offset” value to about “-0.3”. Tutorial MaskPopInvFrac 02PowerFracColourTab.png Tutorial_PowerFractalSubsets_02PowerFracColourTab.png

On the Tweak Noise tab set the “Noise flavour” to “Perlin ridges”. The “ridge” noise patterns are the opposite of the “billow” patterns and means they have narrow sharp ridges which drop down to rounded bottoms. Tutorial MaskPopInvFrac 03PowerFracTweakNoiseTab.png Tutorial_PowerFractalSubsets_03PowerFracTweakNoiseTab.png

On the Warping tab set the “Lead-in warp effect” to “1 Octave Perlin warp” and the “Lead-in warp amount” value to “2.0”. This will warp and displace the fractal pattern in a random wavy fashion. Tutorial MaskPopInvFrac 04PowerFracWarpingTab.png Tutorial_PowerFractalSubsets_04PowerFracWarpingTab.png

On the Scale tab adjust the “Feature scale” and “Lead-in scale” to fit your terrain and scene. Use the measuring tool if necessary. Tutorial MaskPopInvFrac 05PowerFracScaleTab.png Tutorial_PowerFractalSubsets_05PowerFracScaleTab.png

Once you’re happy with the mask, copy and paste the Power fractal node to duplicate it. Double click on the new power fractal node to open its dialog window, then give it a descriptive name and go to its Colour tab. Our goal is to invert the fractal noise pattern colours. First uncheck the “Apply high colour” checkbox to disable the “Apply high colour” parameter. The effect of this is to pass “black” or a value of “0.0” through this part of the fractal pattern and the Power fractal node’s output. Next, check the “Apply low colour” checkbox to enable it and set the “Apply low colour” value to “white” or “1.0”. Now we have the exact inverse of the other Power fractal.

To visualize this second mask, add another Surface Layer and assign the second power fractal to its “Mask by shader” input. Enable the Surface Layer’s test colour and change the test colour to anything other than the default pink. Tutorial MaskPopInvFrac 06PowerFracSecondBand.png Tutorial_PowerFractalSubsets_06PowerFracSecondBand.png

An added benefit to this method, is now that you have two Power fractals, you can make subtle adjustments to the parameters of one of the patterns to create variations or adjustments if needed. For example, you could adjust the “Colour offset” value to expand or contract the shape of the fractal pattern which would allow the instanced objects of one population to encroach into the pattern of the other population. Tutorial MaskPopInvFrac 19ExamplePowFracOffset.png Tutorial_PowerFractalSubsets_19ExamplePowFracOffset.png

Now that we have our two masks set up, we can apply them to a population. Add the first population, and so that we can visualize exactly how the instances are being distributed, zero out the “Spacing variation in a,b” and the “Maximum Y rotation” values. Apply one of the power fractals as a mask then click Populate Now, and the result will show an aligned grid of trees exactly as defined by the mask. Tutorial MaskPopInvFrac 07AddPopulation2Crop.png Tutorial_PowerFractalSubsets_07AddPopulation2Crop.png Tutorial MaskPopInvFrac 09PopulateBandATrees.png Tutorial_PowerFractalSubsets_09PopulateBandATrees.png

Repeat this procedure for a second group of trees using the other power fractal as the mask. Tutorial MaskPopInvFrac 08AssignDensityShaderAddPopulation2.png Tutorial_PowerFractalSubsets_08AssignDensityShader.png Tutorial MaskPopInvFrac 10PopulateBandBTrees.png Tutorial_PowerFractalSubsets_10PopulateBandBTrees.png

Now that you’ve established the two masking bands and see that they’re working as desired, you can randomize the populations by returning some value to the “Spacing variation in a,b” and their rotations, and minimum and maximum scales. Tutorial MaskPopInvFrac 11PopulationsRandomized.png Tutorial_PowerFractalSubsets_11PopulationsRandomized.png

Next, you can add additional tree populations and choose which band they will be distributed in by selecting the appropriate power fractal as the mask. Tutorial MaskPopInvFrac 16ExtraPopulations.png Tutorial_PowerFractalSubsets_16ExtraPopulations.png

Tutorial MaskPopInvFrac 17Final.png Tutorial_PowerFractalSubsets_17Final.png

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.

Graphical User Interface, a general term that refers to the interface of any program running in a modern graphical operating system and which does not operate exclusively from the commandline.

Literally, to change the position of something. In graphics terminology to displace a surface is to modify its geometric (3D) structure using reference data of some kind. For example, a grayscale image might be taken as input, with black areas indicating no displacement of the surface, and white indicating maximum displacement. In Terragen 2 displacement is used to create all terrain by taking heightfield or procedural data as input and using it to displace the normally flat sphere of the planet.

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

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.