Distance Shader

From Terragen Documentation from Planetside Software
Revision as of 05:56, 14 March 2012 by Jo (talk | contribs)
Jump to: navigation, search
Distance Shader

Node Description and Purpose:
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.

Node Type: Colour Shader


  • Apply far colour: Check this checkbox to use the colour specified at right as the far colour. If you don't specify a colour black will be used.
  • Apply near colour: Check this checkbox to use the colour specified at right as the near colour. If you don't specify a colour black will be used.

  • Far distance: This sets the furthest blending distance. The colour used further out than this distance will be the far colour.

  • Near distance: This sets the distance where the near colour starts to blend with the far colour. If this distance is more than 0 the near colour will be used from the camera position to the near distance.

  • Distance mode: This popup allows you choose the way the blending is done. The popup has these options:

    • Distance (spherical): 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:
      Spherical blend example
    • Z depth (planar): 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:

      Planar blend example
  • 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.

  • Clamp far colour: When this is checked the far colour is clamped to 1.

  • Clamp near colour: When this is checked the near colour is clamped to 0.

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.