Population Colour Tinting Techniques
The Terragen Populator has a rich feature set that distributes 3D object instances in very realistic ways. But even with variation in placement, scale and rotation, each population is limited to one piece of geometry, and the textures or materials it was created with, which can result in a visible repetition that limits the realism of the end result. What you want is each object to be slightly different, and one solution is to use the populator’s colour tinting tools.
Let’s explore this in an empty scene by creating a population of rocks. Click on the “Objects” button beneath the Main Menu, then click on the “Add Object” button and select “Population” from the drop down menu and finally select “Rock” from the population types list.
Two new nodes appear in the object list, the first one is the population node and the second one is the geometry node that will be instanced by the populator.
Let’s create an evenly spaced and orderly array of rock objects in order see the tinting effects most clearly.
Select the “Pop Rock 01” item from the Object List and under the Distribution tab reduce the size of the area to be populated by entering a value of “100.0” in the “Area length a” and the “Area length b” fields. Set the “Object spacing in a,b” value to “5.0” and the “Spacing variation in a,b” value to “0.0”.
Under the Rotation tab set the “Maximum Y rotation” value to “0.0”.
Under the Scale tab set both the “Minimum scale” value and “Maximum scale” value to “4.0”.
Click the “Populate Now” button, and then pull back your camera view until you get a good view of the rocks. Click on the “RTP” button to view the scene in Ray-Traced Preview mode.
The rock object’s Surface shader is assigned the “Default shader 01”, which gives each instance of the rock a diffuse colour value of 0.5. You can see this by selecting the “Pop Rock 01/Rock 01” item in the object list and clicking on the green “Plus” button to the right of the Surface shader field and selecting “Go to Default shader 01”.
To apply colour variation to the rock population, return to the Objects layout and select the “Pop Rock 01” item from the Object list. Under the Colour tab click on the green “Plus” button to the right of the “Tint diffuse colour” field and select “Create new shader”, then “Colour shader” and finally “Power fractal shader v3”.
Open the Power fractal shader by once again clicking on the green “Plus” sign to the right of the “Tint diffuse colour” field and selecting “Go to Power fractal shader v3 01”. Rename the Power fractal node to something descriptive like “Rock tints”. Click on the “Open shader in new preview” button to the right of the Name field to display the power fractal pattern in its own window. Under the Scale tab reduce the “Lead-in scale” value to 100, to better match the scale of the area being populated with rocks.
We want to increase the contrast of the fractal noise pattern. Under the Colour tab set the “Colour contrast” value to “1.0”, the “Colour offset” value to around “-0.4” and the “Colour roughness” value to “0.0”.
As you can see in this rendered frame, the rocks are now shaded in a variety of gray values. Internally, Terragen multiplied the rocks diffuse color value by the value supplied by the tinting function. We’ll get into the math in a moment, but generally speaking, this has the effect of darkening each rock.
Let’s repeat this step once more but this time use colours other than black and white for the fractal noise pattern. Click on the “Apply high colour” colour swatch and choose a red colour with RGB values of “255,0,0” or linear values of “1.0,0.0,0.0”. Enable the “Apply low colour” by clicking on the checkbox and then click on its color swatch and choose a green colour with RGB values of “0,255,0” or linear values of “0.0,1.0,0.0”.
Now we see that the rocks have taken on the hues of reds and greens and yellows
Let’s review our progress so far to understand the math that is taking place internally in Terragen.
The diffuse colour value of a particular spot on an object is made up of its three colour component values; one value for each of the red, green and blue components. The rock object’s diffuse colour value is 0.5 for each of its colour components.
The power fractal shader assigned to the population’s “Tint diffuse colour” generates a tint colour for each instanced object. The generated colour will be somewhere between the “Apply high colour” and “Apply low colour” values, but if either of the High and Low colours are disabled then a value of 0.0, or black, is used for that colour. Each instanced object will get a different tint colour based on the position of the instanced object in 3D space in relationship to the noise patterns of the fractal. Terragen multiplies the object’s diffuse colour RGB values by the RGB values of the generated tint colour.
Using the last image as an example, the rock object’s diffuse colour red component value was 0.5 and that was multiplied by a value between the High colour red component value which is 1.0 and the Low colour red component value which is 0.0. This means that the maximum red component value would be 0.5 and there’s a good chance it would be less. This is repeated for the other color components as well to determine the final colour value.
There is one other consideration in determining the final colour value and that is the “Diffuse colour multiplier” value located on the Colour tab. The value in this field is multiplied by the diffuse colour in order to provide a way to adjust the overall colour value. For example, the rock object’s diffuse colour value of 0.5 would be multiplied by the Diffuse colour multiplier, which defaults to 1.0, so there would be no change, but if the Diffuse colour multiplier value was 2.0, then the rock object’s diffuse colour value would be 1.0, which would be twice the diffuse value as before.
In conclusion, the math behind the final tinting value looks something like this: Object’s diffuse colour component value * Diffuse colour multiplier * Tint diffuse colour component value = Resulting diffuse colour component value
In our examples so far, the object being tinted had a single diffuse colour value to start with, but most of the time we’ll be populating objects that use texture maps which contain many diffuse colour values. We can examine this more closely by modifying the rock object’s texture.
Select the “Pop Rock 01/Rock 01” item in the Object List and under the Surface Shader tab click on the green “Plus” button to the right of the Surface shader field, and select “Go to Default shader 01”.
Click on the green “Plus” button to the right of the “Colour function” field and select “Create new Shader”, then “Colour Shader”, and then “Power fractal shader v3”.
Click on the same green “Plus” button and this time select “Go to Power fractal shader v3”, and when the dialog pane opens, give the Power fractal shader a descriptive name like “Rock Object Colours”. Open the Power fractal shader node’s 3D preview by clicking on the “Open shader preview in new window” button and zoom in until the 3D preview scale is about 4 meters.
On the Scale tab change the “Feature scale” to “0.1” and the “Lead-in scale” to “1.0” because the scale of the rock object is about 1 meter.
On the Colour tab enable the “Apply low colour” checkbox and click on the “Color swatch” to the right of the parameter field. In the Colour picker pane select a colour around the linear values of “0.39,0.34,0.21”, or RGB values of “99,86,54”.
Finally, adjust the “Colour offset” until there is a good contrast between the “Apply high colour” and “Apply low colour” values in the noise pattern.
Select the “Pop Rock 01” node from the Object list and temporarily disable the “Tint diffuse colour” by unchecking the checkbox to the left of the field. Here is a rendered frame so we can see the new texture for the rocks.
Enable the “Tint diffuse colour” by checking the checkbox to the left of the field. Here is a rendered frame so we can see the new texture for the rocks and the tint applied.
Now set the “Diffuse colour multiplier” value to “2.0”. Here is a rendered frame so we can see the new texture for the rocks, twice as diffuse, with the tint applied.
Last of all, set the “Diffuse colour multiplier” value to “0.5” and this is the rendered frame so we can see the new texture for the rocks, half as diffuse, with the tint applied.
Any type of shader can be used as the source for tinting the population. Here is an example of using an image shader as the source for tinting the population. By setting the rock object’s diffuse value to “1.0” the instanced objects take on the colour values from the image texture map.
Knowing how the tinting process works behind the scene gives us a lot of control for adjusting the final colors of our instances. Keep in mind that generally speaking, applying a tint colour will darken final colors of the object instances, and that by applying a value greater than 1.0 to the “Diffuse colour multiplier” can help lighten them back up.
Download this project file to further explore tinting populations in Terragen. File:Tutorial_WIki_TintingPopulations.zip
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.
A parameter is an individual setting in a node parameter view which controls some aspect of the node.