Surface Layer

From Terragen Documentation from Planetside Software
Jump to: navigation, search

Surface Layer


Overview[edit]

The Surface Layer is most often used to create surface textures for the terrain. As one of the more complex nodes in Terragen, its parameters have been grouped together based on a particular aspect of the surface that they affect.

Settings:

  • Name: This setting allows you to apply a descriptive name to the node, which can be helpful when using multiple Surface layer nodes in a project.
  • Enable: When checked, the node is active and the settings below will affect the surface. When unchecked, the node is ignored.

Colour Tab[edit]

Colour Tab

The settings below allow you to apply colour to the surface layer. The Apply colour and Colour function settings work together to define the final colour. The Enable test colour setting allows for quick visualizations of where the surface layer has been applied.

  • Apply colour: When checked, the colour defined by the colour swatch to the right of the setting is multiplied with the Colour function setting and their combined output determines the final colour for the surface layer.
    In this example the Apply colour is set to sRGB 0,64,38 and the Colour function is empty, therefore the terrain takes on the Apply colour value.


  • Colour function: When a shader or function node is assigned to this setting its colour component values are multiplied with the Apply colour’s component values to determine the final colour for the surface layer.
    In this example, a Distance shader provides a gradient between white (1.0) at its Apply far colour value and pink (sRGB decimal equivalent of 1,0.42,2.0) at its Apply near colour value.  When multiplied with the Apply colour’s green values the result is a green to blue gradient. Distant shader settings assigned to Colour function.


  • Enable test colour: When checked, the colour defined by the colour swatch to the right of the setting overrides the colour information from the Apply colour and Colour function settings. This allows you to quickly visualize where the surface layer has been applied.
    Enable test colour checked and unmasked. Enable test colour checked and masked by function nodes.


Luminosity Tab[edit]

Luminosity Tab

The settings below allow you to treat the surface layer as luminous, in other words it can glow and emit light. The three settings work together to determine the final luminosity value.

  • Luminous: When unchecked, the Luminosity settings are disabled and the surface will not glow or emit light. When checked, the surface layer will glow and affect other surfaces as if it were a light source. The value field and slider directly to the right of the setting provide control for increasing or decreasing the intensity of the luminosity effect.
    Luminous values between 0 and 10


  • Luminosity tint: This setting establishes the colour of the luminosity which can be different from the colour settings chosen for the Surface layer in the Colour tab.
    Luminous tint set to sRGB 255,0,0


  • Luminosity function: The values from the shader or function nodes assigned to this setting are multiplied with those of the Luminous and Luminosity tint settings to provide even more control over the luminous effect and where it appears in the project. For example, with grey scale functions you could use Painted shader or Image Map shader as a mask for the glow effect. Areas that are black will not glow and areas that are white will glow using the colour defined in the Luminosity tint setting. With colour functions you can create complex multi-colour glow effects.
    Get altitude in texture function nodes assigned to the Luminosity function. Using masks to limit the effect of luminosity and simulate city lights seen from orbit.


Displacement Tab[edit]

Displacement Tab

The Displacement tab allows you to control the three dimensional shape of the surface by means of displacement. This process moves the micropolygons that make up a rendered scene in 3D space to create their final shape. You provide the Surface Layer with the information it needs to perform displacement by assigning a shader or function nodes to the Displacement function setting.

The Displacement function expects scalar inputs, and will automatically convert colour values to scalar values. Assigned nodes which create displacement themselves may not give you the results you expect. For example, if a Simple Shape shader with its displacement enabled is assigned to the Surface Layer’s Displacement function no displacement will take place. In this case you need to enable the Simple Shape shader’s colour checkbox in order for displacement to be applied. Alternatively, you can use a Displacement Shader to Vector node to convert a node’s displacement output to a vector which can then be read by the Displacement function input, as the vector will be converted to scalar values.

We don’t recommend using Surface Layer displacement to create large features in a landscape. For the best results large features such as mountains should be created as part of the Terrain group and be connected above the Compute Terrain node. This ensures that one texture coordinate solution will exist in the project which all nodes have access to, and that textures and displacements will align properly.

  • Displacement direction: This popup has 5 options which allow you to choose the direction in which the displacement is applied in. Options that "(requires computed normal)" must have a Compute Terrain or Compute Normal node connected somewhere above the Surface Layer in the network to work properly. The popup has the following options
    Displacement direction options
      Along vertical: Displacement happens along the normal of the underlying planet or 3D object’s geometry.
      Along normal: Displacement happens along the current surface normal.
      Vertical only (requires computed normal): Displacement only happens along the normal of the underlying planet or 3d object’s geometry. The displacement is scaled by the difference between the object normal and the surface normal. Displacement is reduced as the angle between the normals approaches 90°.
      Lateral only (requires computed normal): Displacement only occurs in the lateral plane, that is perpendicular to the normal of the underlying object.
      Lateral normalized (requires computed normal): This is the same as Lateral only but the normal is normalised, that is scaled so it has a length of 1.

    Displace direction: Off
    Displacment direction: Along vertical
    Displacement direction: Along normal
    Displacment direction: Vertical only
    Displacement direction: Lateral only
    Displacement direction: Lateral normalized


  • Displacement multiplier: This multiplies the displacement values coming from the "Displacement function" input. A value of 1 leaves the incoming values unchanged. A value of 2 would make the incoming values twice as large. A value of 0.5 would make them half as large. Negative values will invert the displacement.
    Direction multiplier = 0.25
    Displacement multiplier = 0.5
    Displacement multiplier = 1.0


  • Displacement function: This setting allows you to assign shader or function nodes to use as displacement for the surface.
    Power fractal assigned to Displacement function


  • Displacement offset This value is added to incoming displacement values after they are multiplied by the “Displacement multiplier” setting. This creates the effect of offsetting the displacement by a set amount along the “Displacement direction”. Positive values push the displacement out so it looks almost as if it was sitting on a plinth. Negative values will sink the displacement back into the surface. It doesn't reverse the displacement, it's more like creating a hole in the surface and then applying the displacement to the bottom of the hole.
    Displacement offset = 0
    Displacement offset = 1
    Displacement offset = -1


Smoothing Tab[edit]

Smoothing Tab

The settings on this tab allow you to control how Terragen blends this Surface layer’s displacements and the displacements from its child layers, with an averaged, i.e. smoothed, version of the Terrain as computed by the last Compute terrain node in its node network branch..

  • Smoothing effect: When checked and the smoothing amount is 1, the Surface layer ignores any displacements coming before it in its node network branch, and using the averaged terrain from the last Compute Terrain node as a starting point, adds its own displacement and any displacements from its child layers. For example, a very common workflow is to create large terrain displacements in the Terrain group which ends in a Compute terrain node. Small scale displacements, such as a Strata and Outcrops shader, or the Fake stones shader might be added after the Compute terrain node in the Shaders group. When a Surface layer follows these small scale displacement nodes and its Smoothing effect is set to 1, then the small scale displacement nodes are ignored and the averaged smoothed version of the terrain from the Compute terrain node is used as the base on which to apply the Surface layer’s own displacements and those of its child layers.
    Node network view showing large scale displacement nodes placed within the Terrain group and culminating in a Compute terrain node.  Then followed by small scale displacements via the Strata and Outcrops and Surface layer shaders within the Shaders group

    Steps from example above culminate in the removal of the Strata and outcrop small displacements, while the Surface layer’s Fake stone child layer is added to the averaged smoothed terrain from the Compute terrain node.

    For Smoothing effect values less than 1, that fraction of the Surface layer’s displacement and those of its child layers is added to all the displacements upstream from it. Negative Smoothing effect values amplify the previous displacements, while a value of 0 is the same as disabling the Smoothing effect.
    Smoothing effect values from -1 to 1.


Coverage/Breakup Tab[edit]

Coverage/Breakup Tab


  • Coverage This setting controls how much of the surface layer is applied, almost like a transparency control for the overall surface layer. A value of 1 means the surface layer is fully applied and will cover all surfaces upstream of it in the node network, while smaller values allow only a portion of the surface layer to be applied so the upstream surfaces will show through. This applies to both the Surface layer’s colour and displacement values.
    Coverage applied from 0 to 1.


  • Fractal breakup When checked and the Coverage amount is less than 1.0, the coverage of the surface layer is broken up using the shader or function nodes assigned to the field at the right. This can introduce a greater sense of randomness and texture to the surface. The amount of breakup is controlled by the value and slider directly below. Higher values visually increase the contrast between the areas covered by the surface layer and those not covered.
    Fractal breakup applied from 0 to 2.


  • Invert breakup When checked, the fractal breakup pattern is inverted. If the Apply high colour and Apply low colour values under the Colour tab of the fractal breakup node are set to white and black respectively, then the light parts become dark and vice versa. If these settings contain colour values then the RGB colour components are inverted.
    Invert breakup disabled and enabled.


  • Only breakup colour When checked, the fractal breakup pattern only affects the colour of the surface layer and not the other characteristics of the surface layer.


  • Mask by shader: When checked, the surface layer is restricted to the area defined by the shader or function nodes assigned to this setting. White values in the mask allow the surface layer to be visible, while black values block the surface layer from showing. Grayscale values allow a portion of the surface layer to be visible.
    A Colour adjustment shader and Image map shader assigned as a mask to the surface layer.


  • Invert mask: When checked, the inverse of the shader or function nodes assigned as the mask is used as the mask.
    An image map shader and Colour adjustment shader assigned as a mask to the surface layer with the Invert mask checkbox enabled.


  • Mask as coverage: When checked, the surface layer’s coverage value is clamped at 1.
    Mask as coverage off and on.


Altitude Constraints Tab[edit]

Altitude Constraints Tab

The Altitude Constraints tab has settings which let you control where the surface layer appears by altitude or height. For example, if your surface layer represents snow you might not want it to appear below a certain height. You can use the 3D Preview to quickly and accurately select altitudes by right clicking in the pane at the altitude you want and selecting “Copy Altitude” from the context menu, then pasting the copied value into the text field for Minimum Altitude by highlighting its current value and pressing “Ctrl + V” on your keyboard. With the Limit minimum altitude checkbox enabled, the snow layer will only cover the terrain to the point at which you clicked in the 3D Preview.

  • Limit maximum altitude: When checked, the Maximum altitude constraint becomes active and the surface layer is limited to altitudes below the Maximum altitude value.
  • Maximum altitude: This setting controls the maximum height at which the surface layer will appear at.
    When enabled, the Maximum altitude determines the highest altitude the surface layer will be visible.


  • Max alt fuzzy zone: This controls the width of the fuzzy zone for the Maximum altitude constraint. The fuzzy zone is an area below the Maximum altitude which blends the surface layer with underlying layers. Fuzzy zones are explained in detail here.
    When enabled, the Max alt fuzzy zone can be used to fade the surface layer into the underlying layers.


  • Limit minimum altitude: When checked, the Minimum altitude constraint becomes active and the surface layer will not appear below the Minimum altitude value.
  • Minimum altitude: This setting controls the minimum height at which the surface layer will appear at.
    When enabled, the Minimum altitude determines the lowest altitude the surface layer will be visible.


  • Min alt fuzzy zone: This controls the width of the fuzzy zone for the minimum altitude constraint. The fuzzy zone is an area above the minimum altitude which blends the surface layer with underlying layers. Fuzzy zones are explained in detail here.
    When enabled, the Min alt fuzzy zone can be used to fade the surface layer into the underlying layers.
    The Maximum and Minimum altitudes and fuzzy zones may also be used concurrently to constrain the visible surface layer between them.


  • Altitude key: This popup menu has two options which are used to select how the altitude or height is based.
    Altitude key options
    Final position - When selected the altitudes are based on world space and not texture space.
    Position in terrain/texture - when selected the altitudes are based on texture space.


  • Use Y -


Slope Constraints Tab[edit]

Slope Constraints Tab

The Slope Constraints tab has settings which let you control where the surface layer appears according to slope. For example, if your surface layer represents grass you might want it to only grow on slopes that are relatively flat. You can use the 3D Preview to quickly and accurately select the angle of the sloping terrain by right clicking in the pane at the level of the sloping area you want and selecting “Copy Slope Angle” from the context menu, then pasting the copied value into the text field for Maximum slope angle by highlighting its current value and pressing “Ctrl + V” on your keyboard. With the Limit maximum slope checkbox enabled, the grass layer will only be visible on the terrain up to the point at which you clicked in the 3D Preview.

  • Limit maximum slope: When checked, the Maximum slope constraint becomes active and the surface layer will not be visible on slopes that are steeper than the Maximum slope angle.
  • Maximum slope angle: This setting controls the maximum slope the layer will be visible at.
    When enabled, the Maximum slope angle determines the steepest slope at which the surface layer will be visible.


  • Max slope fuzzy zone: This setting controls the width of the fuzzy zone for the maximum slope constraint. The fuzzy zone is an area of the surface layer that is less steep than the maximum slope and gets blended with underlying layers. Fuzzy zones are explained in detail here.
    When enabled, the Max slope fuzzy zone can be used to fade the surface layer into the underlying layers.


  • Limit minimum slope: When checked, the Minimum slope constraint becomes active and the surface layer will not be visible on slopes that are less steep than the Minimum slope angle.
  • Minimum slope angle: This setting controls the minimum slope the layer will be visible at. It will not appear on areas flatter than this angle.
    When enabled, the Minimum slope angle determines the flattest slope at which the surface layer will be visible.


  • Min slope fuzzy zone: This setting controls the width of the fuzzy zone for the minimum slope constraint. The fuzzy zone is an area of the surface layer that is steeper than the minimum slope and gets blended with underlying layers. Fuzzy zones are explained in detail here.
    When enabled, the Min slope fuzzy zone can be used to fade the surface layer into the underlying layers.
    The Maximum and Minimum slope angles and fuzzy zones may also be used concurrently to constrain the visible surface layer between them.


  • Slope key: This popup menu has three options which are used to select how the slope is calculated.
    Slope key options
      Final normal: This is the final normal computed after all the displacements have happened in the scene.
      Terrain normal: This is the terrain normal, normally obtained from the last Compute Terrain node.
      Planet/object normal: This the normal from the planet or object the surface layer is attached to, after displacement has been applied.
    Slope key set to Final normal, Terrain normal, and Planet/object normal


  • Use Y: Slope is calculated based on the chosen option in the Slope key setting and wherever you go on the planet (or object) the slopes remain relative to the surface. When this checkbox is enabled, the Y value from the normal will be used instead, which means the angle now becomes relative to the Y axis and as you move further from the planet origin the slope will change. This is most useful for creating global planet-wide effects. For normal surfacing situations you can ignore this setting.


Effects Tab[edit]

Effects Tab

The settings on this tab allow you to fine tune where the surface layer will appear, based on a comparison between the displaced version of the terrain and a smoother version of the terrain. It’s important to understand how several other project settings affect this comparison.

A Compute Terrain node calculates the average terrain and stores this information so that Surface Layers have access to it later. It doesn’t change the terrain displacement, unless the Smooth terrain checkbox is enabled. The node’s Gradient Patch Size setting controls the size in metres that the terrain is sampled at when calculating the average displacement. The larger the patch size, the more influence a terrain feature which is further away, laterally, from the sample point will have. This allows larger depressions and rises to be detected. Smaller values will pick out depressions and rises that occur as smaller scales. Note also, that different patch sizes tend to need different settings for the Intersect Underlying feature to get similar results. Often, the larger the patch size, the higher the parameters' values need to be, but this is not a general rule.


    Comparison of the Compute terrain’s Patch size setting


When the settings on the Surface Layer’s Effects tab are enabled, the surface layer compares the current surface displacement against the smoother, averaged version of the terrain calculated by the most recent Compute Terrain node. The results are “weighed” based on how far the displacement is above or below the averaged terrain. This is also referred to as “favor rises” and “favor depressions”.


  • Intersect underlying: This popup menu has three options which allow you to select the basis for how the Surface layer effect is applied.
    Intersect underlying options
      Favor depressions: This setting causes the surface layer to appear more strongly wherever the terrain is lower than nearby areas, the depressions, and appear weaker where the terrain is higher than nearby areas, the rises.
      Favor rises: This setting does the opposite of Favor depressions. Points that are higher than the averaged nearby terrain, the rises, are weighted more strongly than points that are lower, the depressions.
      Displacement intersection: This setting compares this surface layer, including any of this layer's displacements and the displacements performed by its child layers to the averaged terrain. When selected, the Smoothing effect setting is automatically enabled and the surface takes on a different displacement from the underlying terrain. The Smoothing effect is not always needed when using this mode and other displacements provided by this layer's children or by previous Surface Layers can allow for interesting effects as they intersect each other.
    Intersect underlying options favoring depressions and rises


  • Intersection zone: This setting defines in metres the range of displacements that fall into the Fuzzy transition zone when comparing the displaced surface with the average surface. Higher values result in softer transitions, while lower values result in sharper transitions.
    Favor depressions, Patch size 50, with Intersection zone values from 0 - 10.
    Favor rises, Patch size 100, with Intersection zone values from 0 - 10.


  • Intersection shift: This setting controls the height of the intersection zone wherever the surface has full coverage according to coverage, altitude constraints, slope constraints and blend shaders. Internally it offsets the surface layer in metres for the comparison between the displaced version of the terrain and averaged version, effectively changing the point of intersection between the two. Very small changes to the intersection calculation can have much larger apparent changes on the surface. The smaller the displacements that make up the terrain, the larger these apparent changes.
    Favor depressions, Patch size 50, Intersection zone 10, with Intersection shift values between -8 and 8
    Favor rises, Patch size 100, Intersection zone 10, with Intersection shift values between -8 and 8


  • Fuzzy zone softness: This setting is one of the last effects that a Surface Layer calculates, and it changes the rate at which a partially-weighted surface approaches full weight. Where a surface is partially weighted, perhaps within the fuzzy zone of an altitude constraint or the transition zone of the Intersect Underlying feature, the weight can be boosted. This allows different effects than are possible with other settings that affect coverage. More importantly, it does not affect displacement. A low value allows the colour transition to be much sharper than the displacement transition.


  • Better colour / shade continuity: When enabled, the Fuzzy zone softness calculations use a higher quality exp() function instead of the fast approximation used in previous versions of Terragen. Fast approximation is usually good enough for colour/shade distributions, but it can cause visible segmentation of the fuzzy zone when used to constrain displacements.


  • Better displacement continuity: When enabled, the Fuzzy zone softness calculations use a higher quality exp() function instead of the fast approximation used in previous versions of Terragen. Fast approximation is usually good enough for colour/shade distributions, but it can cause visible segmentation of the fuzzy zone when used to constrain displacements.

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 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.

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 scalar is a single number. 1, 200.45, -45, -0.2 are all examples of scalar values.

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.

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.