# Difference between revisions of "Add Scalar"

(Capitalizing S in Add Scalar) |
(Edited overview for clarity.) |
||

Line 5: | Line 5: | ||

== Overview == | == Overview == | ||

− | The Add family of nodes allow you to add the colour/scalar/vector coming into the Main Input | + | 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 wants the incoming data to be scalars, but it will convert colours and vectors to scalars if necessary. | + | 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 component's luminance values. The math for this is: 0.2125 * r + 0.7152 *g + 0.0724 * b. | + | * When the source of the incoming data is colour data, the Add Scalar node converts the data to scalar based on the component's luminance values. 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 from the zero origin. The math for this is: square_root(x*x + y*y + z*z) | + | * 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 from the zero origin. The math for this is: square_root(x*x + y*y + z*z). |

− | |||

− | |||

## Revision as of 01:48, 21 January 2022

## Contents

## Overview[edit]

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 component's luminance values. 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 from the zero origin. The math for this 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.

## Fun with Add Scalar[edit]

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.

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

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.