Difference between revisions of "Distance Shader"

From Terragen Documentation from Planetside Software
Jump to: navigation, search
(Updated descriptions and added example images.)
 
Line 1: Line 1:
[[Image:drex_module_144_image_0.png|center|Distance Shader]]
+
[[File:DistanceShdr_00_GUI.png|470 px | Distance Shader]]
  
'''Node Description and Purpose:'''<br />
+
== Overview ==
The Distance Shader generates colour based on a computation of distance into the scene from a specific camera. You can specify the "near" and "far" colours, and the distances within which the shading will be performed. The two colours are blended between those distances. The output of a Distance Shader can be used to control surface textures, populations, even clouds and other scene features by distance from the camera, allowing you to for example specify that there are no clouds near to the camera and that cloud coverage increases with distance.
+
The Distance Shader generates colour by computing the distance between a referenced camera and a given sample point within the scene. By associating “near” and “far” colours with “near” and “far” distances, you establish a blending range, i.e. a gradient, which can be used to apply colour to a surface or even as a mask for populations, cloud coverage, and surface textures.
 +
 
 +
'''Settings:'''
 +
 
 +
*'''Name:''' This setting allows you to apply a descriptive name to the node, which can be helpful when using multiple Distance shader nodes in a project. <br /n>
 +
 
 +
 
 +
*'''Enable:'''When checked, the node is active and the settings below will affect the surface. When unchecked, the node is ignored. <br /n>
 +
 
 +
 
 +
*'''Apply far colour:'''  When checked, the colour value defined by the colour swatch to the right, is used at the Far distance.  When unchecked, the shader's Main input is passed through.
 +
<ul>
 +
[[File:DistanceShdr_02_ApplyFarColour.jpg|800 px | Apply far colour off and on.]]
 +
</ul>
  
  
'''Node Type:''' Colour Shader<br />
+
*'''Apply near colour: ''' When checked, the colour value defined by the colour swatch to the right, is used at the Near distance.  When unchecked, the shader’s Main input is passed through.
 +
<ul>
 +
[[File:DistanceShdr_03_ApplyNearColour.jpg|800 px | Apply near colour off and on.]]
 +
</ul>
  
  
'''Settings:'''
+
*'''Far distance:''' This value represents the distance in meters from the camera assigned to the Camera setting below.  At this distance the colour defined in the Apply far colour setting is at one hundred percent, and any blending between the Apply near and Apply far colour values will be complete.  Distances beyond this value will take on the Apply far colour.
 
<ul>
 
<ul>
<li>
+
[[File:DistanceShdr_04_FarDistance.jpg|800 px | Far distance values from 10,000 metres to 100,000 metres.]]
'''Apply far colour:''' Check this checkbox to use the colour specified at right as the far colour. If you don't specify a colour the shader's input will be passed through.
+
</ul>
</li><li>
+
 
'''Apply near colour:''' Check this checkbox to use the colour specified at right as the near colour. If you don't specify a colour the shader's input will be passed through.
+
 
</li><li>
+
*'''Near distance: ''' This value represents the distance in meters from the camera assigned to the camera setting below. At this distance the colour defined in the Apply near colour setting begins to blend into the Apply far colour, effectively creating a gradient ramp between the two colours. When they are set to white and black, the shader can be used as a mask with varying degrees of softness or transition zones.  Distance values less than this value take on the Apply near colour value.
'''Far distance:''' This sets the furthest blending distance. The colour at this distance will be the far colour.
 
</li><li>
 
'''Near distance:''' This sets the distance where the near colour starts to blend with the far colour. The colour at this distance will be the near colour.
 
</li><li>
 
'''Distance mode:''' This popup allows you choose the way the blending is done. The popup has these options:
 
 
<ul>
 
<ul>
<li>
+
{|
<u>Distance (spherical):</u> This option causes the distances to be calculated in a sphere around the camera. The shape of blending will be circular, radiating out in all directions. Here's an example showing the blend radiating out around the camera:
+
|-
[[image:distance_shader_spherical_example.jpg|180px|thumb|center|Spherical blend example]]
+
| [[File:DistanceShdr_05_NearDistance.jpg|800 px | Near distance values from 0 metres to 25,000 metres. Far distance value = 100,000 metres.]]
</li><li>
+
|-
<u>Z depth (planar):</u> This option makes the blend happen in the direction the camera is looking. All points from the near distance back past the camera position will take on the near colour and the blend. The blend looks a bit like a line cutting across the scene perpendicular to the camera direction. Here's an example, showing how the blend is oriented to the camera:
+
|[[File:DistanceShdr_06_AsMask.jpg|none|400px|By setting the Far and Near colours to white and black, the shader can be used as a mask.]]
[[image:distance_shader_linear_example.jpg|180px|thumb|center|Planar blend example]]
+
|}
</li>
 
 
</ul>
 
</ul>
</li><li>
+
 
'''Camera:''' This allows you to choose a camera to use with the shader. You can create cameras which are only used with Distance shaders and not actually used to view the scene through. If you don't specify one the camera being used for rendering is used.
+
 
</li><li>
+
*'''Distance mode:''' This popup menu has two options to let you choose the manner in which the distance from the camera is determined.
'''Clamp far colour:''' When this is checked, all distances greater than the far distance will have the far colour. When it is unchecked, additional colours will be extrapolated beyond the far distance.
+
<ul>
</li><li>
+
[[File:DistanceShdr_01_DistanceModes.png|271 px | Distance mode options]] <br /n>
'''Clamp near colour:''' When this is checked, all distances less than the near distance will have the near colour. When it is unchecked, additional colours will be extrapolated below the near distance.
+
 
</li>
+
<u>Distance (spherical):</u> This option causes distances to be calculated in a sphere around the camera. Blending will be circular, radiating out from the camera’s position  in all directions. <br /n>
 +
<u>Z depth (planar):</u> This option causes distances to be calculated in the direction the camera is looking. Points behind the camera and up to the Near distance value take on the value of the Apply near colour. Points in between the Near and Far distance values smoothly transition from the Apply near and Apply far colours.  Points farther away from the Far distance take on the Apply far colour value. <br /n>
 +
[[File:DistanceShdr_07_DistanceModes.jpg|800 px | Spherical distance modes radiate from around the camera’s position, while planar distance modes project out into the scene based on the camera’s rotation.]]
 
</ul>
 
</ul>
  
 +
 +
*'''Camera:''' The Distance shader bases its calculations on the position and rotation values from the  camera assigned to this setting.  You can assign or create a new camera by clicking on the green plus button to the right of the setting.  If no camera is assigned, the render camera is used. <br /n>
 +
 +
 +
*'''Clamp far colour:'''> When checked, colour values for distances greater than the Far distance value will be clamped, or maxed-out, at the Far colour value.  When unchecked, additional colour values can be extrapolated beyond the far distance.  <br /n>
 +
 +
 +
*'''Clamp near colour:'''> When checked, colour values for distances less than the Near distance value will be clamped to the Near colour value.  When unchecked, additional colour values can be extrapolated below the near distance.
 +
<br /n>
  
  
 
[[Category:Colour Shader]]
 
[[Category:Colour Shader]]

Latest revision as of 23:25, 19 July 2021

Distance Shader

Overview[edit]

The Distance Shader generates colour by computing the distance between a referenced camera and a given sample point within the scene. By associating “near” and “far” colours with “near” and “far” distances, you establish a blending range, i.e. a gradient, which can be used to apply colour to a surface or even as a mask for populations, cloud coverage, and surface textures.

Settings:

  • Name: This setting allows you to apply a descriptive name to the node, which can be helpful when using multiple Distance shader 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.


  • Apply far colour: When checked, the colour value defined by the colour swatch to the right, is used at the Far distance. When unchecked, the shader's Main input is passed through.
    Apply far colour off and on.


  • Apply near colour: When checked, the colour value defined by the colour swatch to the right, is used at the Near distance. When unchecked, the shader’s Main input is passed through.
    Apply near colour off and on.


  • Far distance: This value represents the distance in meters from the camera assigned to the Camera setting below. At this distance the colour defined in the Apply far colour setting is at one hundred percent, and any blending between the Apply near and Apply far colour values will be complete. Distances beyond this value will take on the Apply far colour.
    Far distance values from 10,000 metres to 100,000 metres.


  • Near distance: This value represents the distance in meters from the camera assigned to the camera setting below. At this distance the colour defined in the Apply near colour setting begins to blend into the Apply far colour, effectively creating a gradient ramp between the two colours. When they are set to white and black, the shader can be used as a mask with varying degrees of softness or transition zones. Distance values less than this value take on the Apply near colour value.
    Near distance values from 0 metres to 25,000 metres.  Far distance value = 100,000 metres.
    By setting the Far and Near colours to white and black, the shader can be used as a mask.


  • Distance mode: This popup menu has two options to let you choose the manner in which the distance from the camera is determined.
    Distance mode options
    Distance (spherical): This option causes distances to be calculated in a sphere around the camera. Blending will be circular, radiating out from the camera’s position in all directions.
    Z depth (planar): This option causes distances to be calculated in the direction the camera is looking. Points behind the camera and up to the Near distance value take on the value of the Apply near colour. Points in between the Near and Far distance values smoothly transition from the Apply near and Apply far colours. Points farther away from the Far distance take on the Apply far colour value.
    Spherical distance modes radiate from around the camera’s position, while planar distance modes project out into the scene based on the camera’s rotation.


  • Camera: The Distance shader bases its calculations on the position and rotation values from the camera assigned to this setting. You can assign or create a new camera by clicking on the green plus button to the right of the setting. If no camera is assigned, the render camera is used.


  • Clamp far colour:> When checked, colour values for distances greater than the Far distance value will be clamped, or maxed-out, at the Far colour value. When unchecked, additional colour values can be extrapolated beyond the far distance.


  • Clamp near colour:> When checked, colour values for distances less than the Near distance value will be clamped to the Near colour value. When unchecked, additional colour values can be extrapolated below the near distance.


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