Add Vector

From Terragen Documentation from Planetside Software
Revision as of 20:44, 24 January 2022 by Redmaw (talk | contribs) (Updated descriptions and added example images.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Add Vector


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 Vector node adds two vectors together. It wants the incoming data to be vectors, but it will convert colours and scalars to vectors if necessary, by setting the vector component’s value to that of the incoming data component’s value. For example, if the incoming data were colour then the vector.x becomes, and if the incoming data were scalar, the vector.x would be set to the value of scalar.x.


Name: This setting allows you to apply a descriptive name to the node, which can be helpful when using multiple Add Vector 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 Vector[edit]

In the example images below, the box labeled Add Vector Output is used for illustration purposes because the shader preview windows can only display values up to 2.

The Add Vector node adds the Main Input component values with Input 2’s component values. Mathematically, this can be written as (Main Input X + Input 2 X), (Main Input Y + Input 2 Y), (Main Input Z + Input 2 Z)

The Add Vector adds the component values from the Main Input and Input 2.

If a shader or function nodes are not connected to Input 2, the Main Input is passed through as vector data.

When Input 2 is disconnected, the Main Input vector values are passed through.

If a shader or function nodes are not connected to the Main Input, nothing is passed through the node.

When the Main Input is disconnected, nothing is passed through.

Vector component values can be positive or negative, and there is no limitation to their value. They can often be quite large depending on what the source is.

Vector component values can be positive and negative.

When scalar data is used as the source, it is first converted to a vector, then added to each vector component’s value.

When the source data is scalar, it is first converted to vector data, then added to each of the vector component’s value.

When colour data is used as the source, it is first converted to a vector, then the red value is added to the X, green to the Y, and blue to the Z. Note that displacement values are ignored, only the colour component’s values are taken into consideration, and only vector data is output.

When the source data is colour, it is first converted to vector data, then added to the appropriate XYZ component’s value.

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.

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.

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.