Surface Mapping and Shading
In Terragen 2 Surface Mapping, in other words texturing, is accomplished using one or more “shaders” - nodes that affect the surface of objects and terrains, controlling colour, displacement, and other aspects. Basic surface mapping focuses on a small number of shader nodes, primarily the Surface Layer and Fractal Breakup nodes. You can also accomplish a wide range of spectacular and more unusual effects using the power of the Node Network. We’ll cover the basics here for now and you can refer to the Advanced Techniques sections (when available) to learn more.
If you haven’t already done so, click on the Shaders tab to get started.
The Shaders List
On the left you will see the Shader List showing all the current shader nodes in the order in which they are processed. Nodes at the top of the list are at the bottom or base of your surface map and they will be covered by nodes further down the list (depending on distribution settings). This is similar to how the Terragen 0.9 surface map system worked. Child layers are also present and again work similarly to Terragen 0.9 – child nodes are restricted to the coverage of their parent, but they cover the parent as well.
At the top of the Shader List you have buttons to add a standard layer and child layer. Under Add Layer your first and most frequently used option is Surface Layer. A sub-menu shows you additional Surface Shaders you can use. Child layers can only be added when an appropriate parent layer is selected, generally a Surface Layer. Not all shader nodes allow child nodes. Please see the Node Reference for details on additional Surface Shaders and child layer compatibility.
As noted above layers higher in the list are covered by layers below them, so naturally it is useful to have a way to rearrange and otherwise manipulate each layer. The Move buttons at the bottom of the Shader List will move the currently selected node up or down. You can also completely remove the selected node by pressing the Delete key. Currently you may only have one node at a time selected.
Just as in other node lists, clicking on a node in the Shader List will bring up its settings on the bottom-left. Additionally, like the Terrain and Atmosphere layouts, a small realtime shader preview is shown to the right of the node list for any currently selected node. The preview is currently just a simple flat square, but the standard camera controls can be used in this area to adjust your view. This can be useful when experimenting with displacement since the default view is directly from above.
The Base Colours Node
Looking at the contents of the Shader List itself you will notice there is a single shader node to begin with which is logically named “Base colours”. This node will form the basis of most of your surface map systems, just as the “Surface Map” default layer was the basis for any Terragen 0.9 surface map tree. However, unlike the base layer in Terragen 0.9, the Base colours node has somewhat different settings from a typical surface layer. Click on Base colours to bring up its settings pane and we’ll take a detailed look at how it works.
At the top you’ll see the common node controls to enable/disable the node and change the node Name (note: name must be unique). Below that is a control called Seed which is not found in standard Surface Layers (but is present in many other nodes). The Seed value represents the current, specific state of a noise function. These functions are used throughout Terragen to generate random but realistic detail for everything from terrains and surface maps to clouds. A specific seed value will always produce the same results in a given node provided all other settings are the same. You can use the Random Seed button to get a different random look to your fractal noise.
At the bottom you’ll find more standard node settings which deal with the “blend shader” functionality. Blend shaders work similarly to traditional masking in practice, although the actual process and specifics are different. Briefly, to use a blend shader simply check the Blend By Shader box and then type a valid, existing shader name into the box to the right. Alternatively you may select the node from a list by clicking the bottom to the right of the box. Once a valid Blend shader is connected you will see the output of your current node is now controlled by the Blend shader input. The effect will vary depending both on the node type and the Blend shader you select.You can also invert the Blend shader or use “Fit Blend Shader To This” for greater control. Blend shaders and these additional settings are covered in more detail in the Advanced Techniques sections.
Now let’s look at each of the various settings tabs. The Scale tab is selected by default and you will find several controls for scale here. Scale basically controls the overall size and distribution of the patterns in a surface layer. These patterns are generated by a fractal noise shader which is internal and in the case of the Base Colours node. The Feature Scale setting determines the overall average scale of features in the shader and this will have the most noticeable immediate effect on scale. The Lead-in Scale is essentially the size of the largest features that will be present in the shader output and naturally Smallest Scale then determines the size of the smallest features. All of these are measured in meters, the default unit of measurement in Terragen 2.
The range between the Lead-in Scale and Smallest Scale will determine the number of “octaves” of noise that are generated. This value can be changed directly if you have an idea of a specific detail range you want, but generally it’s easiest to adjust the other Scale values. Note however that the more octaves each of your shader nodes are generating, the longer your scene will take to render. The effect is not significant for only a few shader nodes but it can quickly add up, especially when displacement is involved.
The Color tab is where a lot of the real functionality of the Base Colours node is controlled. One of the most important aspects of any surface layer is of course the color. Here you actually have two colors to work with, a “high” color and a “low” color. These do not correspond to the actual height of the terrain, so you can really just think of them as color 1 and color 2. The Base Colours node uses two colors to provide an easy and quick way to add some contrast and variation to the default surface map and to provide more interest in your base surface layer. The controls on this Color tab adjust the distribution and blending of these two colors, which then defines the most significant aspect of the surface itself – color.
Try unchecking on or the other of the Apply Color boxes to see the scene with a single color. You will note that the top gray color has the largest effect and that this layer alone still retains some darker areas even with the dark color turned off. This is due to the internal fractal noise functions which we discussed earlier when looking at the Scale tab.
Now make sure both colors are turned on and we’ll experiment with the colors themselves. First try adjusting the slider for High Color. You will see an immediate effect on the color swatch to the right as you adjust the slider. This slider controls the overall brightness of the color. To select the actual color simply click the color swatch on the right to bring up a standard color picker. Use these controls to pick your color then click OK. Notice that any adjustment you have made to the brightness slider on the right of the color picker is also reflected in the slider for this color.
Try picking different colors for both high and low colors. You should now see a good mix between them in both the small shader preview to the right and the larger 3D preview (provided you have not moved the camera yet). As you can see adjusting colors is fairly easy and you can quickly create a good basis for your surface map.
Color Contrast is a simple setting that controls the contrast between the two colors you have selected. Note that if one color is disabled then Color Contrast instead controls the contrast of the single color blended with black. The black default color will have the same distribution as the disabled color would have.
Color Offset controls the weighting of each color in the final output of the Base Colours node. The default setting of 0 is in the middle, signifying that neither color is favored. Adjusting it to the left and into negative values will favor the Low Color, while adjusting to the right and into positive values will favor High Color. This really just controls the amount of each color relative to the other.
Color Roughness simply controls the level of roughness used in the blending of the two colors. All other settings being equal a higher roughness value will create a noisier blend of both colors, with smaller and more distinct bits of each color in the final mix. Lower roughness values will tend to create smoother and more gentle blending. This is also heavily affected by Contrast and the Scale settings.
The Clamp check boxes below allow you to control how Terragen handles color values that are greater than 1 or less than 0. The significance of such extreme values is covered in detail in the Advanced Techniques sections, for now just know that you can achieve certain effects using color values above outside of the normal 0-1 range. In general you will not need to use these in a basic scene, so you can leave the clamps enabled, which “clamps” the color to be within the range of 0-1.
Let’s move on to the Displacement tab, where you can experiment with some of the new power of Terragen 2 for adding real dimensionality to your surfaces. Displacement is a technique that adds real 3-dimensional depth to your surfaces. It is essentially a step beyond traditional bump mapping, which similarly interprets color data input as virtual “depth” and adds shading to simulate the 3rd dimension. Displacement takes the same color data and derives real 3d values from it which it then applies to the surface in question, creating bumps, spikes, and many other details. Displacement can be used to create features both large and small and in fact it is used throughout Terragen 2 to create terrain, water and other elements as well. Refer to the Terrain and Water section for details.
At the top of the Displacement tab is a simple checkbox for enabling and disabling displacement for the Base Colours node. If you are not using displacement you should just leave it disabled as it will increase render time when enabled.
To the right is a drop-down menu to control how the displacement is applied to the surface. The default is “Along Normal”, which displaces the surface outward relative to the surface “normal” – a 3-dimensional vector which is perpendicular to the surface itself at that point. So essentially if you have a mountain and you apply displacement to it, the displacement will be perpendicular to the mountain surface, not perpendicular to the ground. A vertical cliff would be displaced directly outward from the cliff, parallel to the ground. The other basic option is Along Vertical – essentially perpendicular to the ground.
There are 3 additional options, all of which require a “computed normal” – Vertical Only, Lateral Only, and Lateral Normalized. These specify only vertical or lateral displacement (as relative to the terrain normal), and a normalized lateral displacement respectively. The normal is provided by the “Compute Terrain” node by default, but in some cases (use of additional extreme displacements) you will want to recompute the normal, in which case you can use the Compute Normal node. More details about these nodes and their uses can be found under Advanced Techniques.
The Displacement Amplitude is one of the most fundamental controls on this tab. It controls the actual level of displacement of the surface – i.e. how “tall” the features will be. The actual size of the features is controlled by the scale of the displacement function, in this case on the Scale tab of the Base Colours node. The Amplitude is measured in meters, the default Terragen 2 units. By default it will be at 1, which will barely be noticeable.
Check the Apply Displacement box and try increasing Amplitude to around 100 to see the effect of displacement on your terrain. If other settings for scale have been left at the defaults, you should see a very rough surface over your flat terrain. Note that this is fully 3 dimensional – you could fly your camera down into these “bumps” if you so desired. Values will greatly depend on the scale you have defined, but in general you will not want the amplitude to be greater than the Feature Scale, and in many cases much less.
The Displacement Offset controls a simple positive or negative offset from where the displacement begins. Normally the displacement will use incoming color data to determine how much the surface is displaced in a given area – black is no displacement and white is maximum displacement (the Amplitude value). A positive offset value will start all displacement from that value, rather than from the original surface. In order to get a mix of bumps and dips from your displacement (both positive and negative values), you can also use a negative Offset, which will cause the displacement to be based on a point under or inside the base surface, thus allowing dark (black) to represent “inward” and light (white) to represent “outward” displacement. Gray would essentially be neutral – no displacement.
Displacement Roughness is similar to the Roughness setting in the Color tab. Quite simply it controls how rough the displacement will be. This also works in concert with the Displacement Spike Limit, which controls how “spiky” or varied and rough the displacement is. Lower values here mean less spikes and lower roughness.
The rest of the Displacement tab settings you may safely ignore for now. They are described in more detail in the Node Reference.
The Tweak Noise tab also holds a lot of powerful settings. Here you can directly manipulate the actual shape and character of the noise function which controls the color blending and displacement.
We begin with the Noise Flavour – the actual noise type being used. The choices are: Perlin: A fairly standard Perlin-type noise function which produces familiar patterns that resemble simple cloud shapes Perlin Billows: A Perlin variation that produces more billowing shapes, similar to cumulus clouds or cauliflower Perlin Ridges – A very commonly used noise function which resembles ridges, river networks, or arcing electrity Perlin Mix 1 and 2: These are mixes of the standard Perlin and the other two Perlin variations
Noise Variation controls the strength and effect of the variations in the noise function. High values produce large areas of similar variations, either high or low contrast, a fairly unusual look for a Perlin noise function. Lower values produce more standard and evenly varied noise output.
The Variation Methods are simply different ways of controlling this variation. The best way to understand their effect is to experiment with them.
Buoyancy From Variation essentially defines the “contrast” of areas of variation. With high Variation values negative values of Bouyancy will increasingly darken half the range of the noise output while lightening the other half. Positive values will reverse this effect, with the previously dark half now light. Medium values strike a balance. With lower values of Variation Buoyancy will simply affect contrast.
The Clumping of Variation has an often subtle effect. Basically it does what it says – it controls how much the variation patches “clump” together. High values will cause even larger areas of homogenous values.
Finally we have the Noise Stretch Values. These are simple numerical values relative to a baseline of 1. They are useful for changing the relationships of each dimension’s noise contribution. For example if you wanted to create long, stretched striations in your texture, you could increase the X or Z scale, thus stretching your noise function along that axis. As with all other dimensions X and Z are the terrain axis (parallel to the terrain) while Y is “up” or perpendicular to the terrain.
At last we reach the Warping tab. First is the Distort Normal function, a specialized setting that implements a certain distortion effect on the noise function that is relative to the normal of the terrain it is being applied to (terrain normals are discussed earlier as well as in more depth under Advanced Techniques). This distortion affects the entire range of scales in the noise function. Note that this will have virtually no effect if your underlying terrain has no shape – i.e. a flat terrain. The basic effect is to create a simple correlation between terrain shape and texture shape, so rough terrain gets rough textures, and smoother terrain gets smooth textures.
The Lead-in Warp Effect controls another warping of the noise function at the same scale as the Lead-in Scale (i.e. large scale). Currently there are only two options – 1 Octave Perlin Warp and None. 1 Octave Perlin Warp simply warps the base noise function with another single octave noise function. This will add large swirl-like patterns to your noise function. The check-box options just below control certain specifics of this warping effect. Less Warp At Feature Scale tells it to preserve more of the character of the base noise function at the Feature Scale, meaning you will get larger warping but your smaller-scale terrain features will be less affected. Allow Vertical Warp simply controls whether “vertical” warping will be performed by this warp function.
We have now covered all aspects of the Base Colours shader node. Hopefully you have been experimenting along the way and will come away with a better idea of how to use some of these settings to create certain effects in your scenes. Hands-on tutorials on the practical use of many of these functions will be provided over time.
The Surface Layer Node
In Terragen 2 the functionality of a basic Surface Layer is now separated into several major components. This is based around the Surface Layer itself, which provides color, luminosity, environment-based distribution and other basic functions, some of which can also be controlled by external shaders.
Fractal Breakup is an important function not provided natively in the Surface Layer node. The Breakup Shader input is used to specify a shader for this purpose. Breakup Shaders give shape to the basic color and other functions that the Surface Layer provides by modulating the contribution of these functions to the final scene based on the patterns they generate. The default Fractal Breakup node gives realistic noise and non-uniform shape to the Surface Layer’s color distribution. You may of course plug many other different nodes into the Breakup Shader input to achieve different effects, but we’ll deal with the default configuration for now.
First go to the Add Layer menu and create a new Surface Layer to experiment with. You will find your terrain suddenly turns completely white; the Surface Layer defaults to full coverage and a white color, but this is easily changed.
The Surface Layer node consists of two sets of tabs, along with the standard node controls discussed above – Name and Enable, specifically. The top tab group controls the basic characters of the Surface Layer, including color, luminosity, and displacement. All 3 of these functions can be controlled using external shaders. The bottom tab group focuses on the distribution of the Surface Layer’s effect on the terrain with controls like Altitude and Slope response and Fractal Breakup.
Let’s start with the top group. First we have the Colour tab, which is simple enough. We can turn the color on and off with Apply Colour. A Surface Layer does not necessarily need to contribute diffuse color information to the scene, it may instead be used only for Luminosity or Displacement for example, so it is useful to have this option. Further down we can adjust the actual color values just as we did with the Base Colours node above. The slider controls brightness of the chosen color while clicking the color swatch to the right will open a color picker for picking specific hues. Finally there is a place to specify an external Color Shader which can be used to control color output of the Surface Layer in very powerful ways. For most uses the built-in color settings should be fine however.
The Luminosity tab is next. Luminosity literally makes a surface appear to give off light or be lit from within. Currently surfaces cannot truly emit light so they do not contribute to global illumination or other lighting calculations, but the actual appearance of the surface will be as if it is self-lit rather than simply lit by the available light sources. Because Luminosity is a less frequently used feature it is disabled by default. The controls here are similar to the Colour tab, except that color is called Luminosity Tint. There is also a separate slider at the top for controlling luminosity amount. While Colour only allowed specifying the color’s brightness value, with Luminosity you can specify both the Luminosity “amount” and the Luminosity Tint brightness and color. Experiment with different values here to gain a better understanding of how these controls interact.
Several of the controls on the Displacement tab are similar to those found in the Base Colours node, but there are a few important differences. Most importantly, since the Surface Layer does not have its own internal noise function, it requires a Displacement Function for Displacement to have any effect. Until a valid Displacement Function is specified here the other settings will have no effect.
The Displacement Direction settings are the same as those in Base Colours so we won’t review that here. Displacement Multiplier is a literal multiplier for the incoming values from the Displacement Function input and it acts similarly to Amplitude. The Displacement Function has already been mentioned; essentially you can connect any node that provides color (or the output of which can be converted automatically to color) and use that as your Displacement Function. Displacement Offset also works the same as in Base Colours.
Finally there is the Smoothing tab. There are only two settings here, one to enable the Smoothing Effect and one to control its strength. The Smoothing Effect operates on color and displacement output of the Surface Layer, smoothing their resulting effect on the scene. This setting works well in conjunction with Intersect Underlying, which we’ll discuss shortly.
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 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 vector is a set of three scalars, normally representing X, Y and Z coordinates. It also commonly represents rotation, where the values are pitch, heading and bank.