Add Scalar

From Terragen Documentation from Planetside Software
Jump to navigation Jump to search
Add Scalar
Add Scalar


Overview

The Add family of nodes allow you to add the colour/scalar/vector coming into the Main Input with the colour/scalar/vector coming into Input 2.

The Add Scalar node adds two scalars together. It wants the incoming data to be scalars, but it will convert colours and vectors to scalars if necessary.

  • When the source of the incoming data is colour data, the Add Scalar node converts the data to scalar based on the luminance of the colour. The math for this is: 0.2125 * r + 0.7152 *g + 0.0724 * b.
  • When the source of the incoming data is vector data, the Add Scalar node converts the data to scalar based on the length of the vector. The math for this is: square_root(x*x + y*y + z*z).


In the example image below, the Add Scalar node simply adds the scalar values from the nodes assigned to it.

    The Add Scalar node adds together the scalar data from the Main Input and Input 2.
    The Add Scalar node adds together the scalar data from the Main Input and Input 2.


The Add Scalar node requires scalar data. One way to convert colour data to scalar data is shown below, where the Luminance to scalar node is used to convert the colour output of the Power fractal node.


The Add Scalar node will automatically convert non-scalar data to scalar before adding them together as described above. Only scalar data is recognized and any displacement data a shader provides is ignored and not passed through. In the example below, the colour values from both Power fractal shaders are converted to scalar data and the displacement data discarded. Only scalar values are output by the Add Scalar node.


When Input 2 is unassigned, the Main Input’s component values are passed through, first converting them to scalar if necessary.

    When Input 2 is unassigned, data from the Main Input is passed through as scalar data.
    When Input 2 is unassigned, data from the Main Input is passed through as scalar data.


When the Main Input is unassigned, the value zero (black) is passed through.

    When the Main Input is unassigned, the value zero (black) is passed through.
    When the Main Input is unassigned, the value zero (black) is passed through.


When colour sources are assigned to the Main Input or Input 2, the colour’s luminance value is used as described above. Only scalar data is output.

    Colour sources are converted to scalar by using the colour’s luminance value.
    Colour sources are converted to scalar by using the colour’s luminance value.


When vector sources are assigned to the Main Input or Input 2, the node produces a scalar value based on the length of the vector as described above. Only scalar data is output.

    Vector sources are converted to scalar based on the length of the vector. The math is square_root(x*x + y*y + z*z).
    Vector sources are converted to scalar based on the length of the vector. The math is square_root(x*x + y*y + z*z).


Settings:

  • Name: This setting allows you to apply a descriptive name to the node, which can be helpful when using multiple Add Scalar nodes in a project.
  • Enable: When checked, the node is active and the Main Input value is added with the Input 2 value. When unchecked, only the Main Input value is passed through the node.
  • Input 2: The values from the shader or function nodes assigned to this setting are added to the values of the Main Input.