Luminance to Scalar

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


The Luminance to scalar node calculates the luminance of the color values from the shader or function nodes assigned to the Main Input, then outputs the luminance as a scalar value.

The math for this is:

    luminance = 0.2125 * r + 0.7152 * g + 0.0724 * b

In the image below, an image map's colour values are converted to scalar based on each colour's luminance value.

An example of a texture’s colour values converted to scalar values based on each colour’s luminance value.

In following example, a Painted shader supplies three colour values, which are then used to displace the terrain surface according to the conversion formula, illustrating how much each colour contributes to the luminous value.

An example showing how much each colour component contributes to the luminance value. Displacement is based on the luminance value.
The Node Network view using a Painted Shader to displace the terrain based on each colour’s luminance value.


  • Name: This setting allows you to apply a descriptive name to the node, which can be helpful when using multiple Luminance to Scalar nodes in a project.
  • Enable: When checked, the node is active and the conversion operation will take place. When unchecked the values assigned to its Main Input, if any, are passed through, otherwise a value of 0 is passed through.

A scalar is a single number. 1, 200.45, -45, -0.2 are all examples of scalar values.

This is essentially the brightness of the colour. Terragen converts RGB colours to greyscale by taking the luminance of the colour.

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