# Difference between revisions of "Multiply Scalar"

(Updated to be correct for scalars, not using the colour example.) |
|||

Line 1: | Line 1: | ||

[[Image:drex_module_75_image_0.png|485pxpx|Multiply Scalar]] | [[Image:drex_module_75_image_0.png|485pxpx|Multiply Scalar]] | ||

− | + | __TOC__ | |

+ | |||

+ | == Overview == | ||

+ | The Multiply family of nodes allow you to multiply the colour/scalar/vector coming into the Main Input by the color/scalar/vector coming into Input 2. | ||

+ | |||

+ | The Multiply Scalar node 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 Multiply 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 Multiply 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). | ||

+ | |||

+ | All nodes in this family have just one setting, which lets you assign a shader or function nodes to Input 2. | ||

− | |||

[[Category:Multiply]] | [[Category:Multiply]] |

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

## Contents

## Overview[edit]

The Multiply family of nodes allow you to multiply the colour/scalar/vector coming into the Main Input by the color/scalar/vector coming into Input 2.

The Multiply Scalar node 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 Multiply 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 Multiply 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).

All nodes in this family have just one setting, which lets you assign a shader or function nodes to Input 2.

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