# Difference between revisions of "Mix Colour"

Line 14: | Line 14: | ||

<!-- imported from file: module_49.html--> | <!-- imported from file: module_49.html--> | ||

− | [[Category:Mix | + | [[Category:Mix]] |

## Latest revision as of 18:36, 1 June 2011

**Node Description & Purpose: **

The Mix family of nodes is used to blend or interpolate between the two input values. If the value coming from the node attached to the Mix controller input is 0 then the value of the Input node will be output. If the value coming from the Mix controller node is 1 then the value of the Input 2 node will be output. If the Mix controller value is somewhere between 0 and 1 then the output will be a blended combination of the two input values.

The inputs are mixed using linear interpolation according to the following formula:

Output **=** Input **+** Mix controller value **x** (Input 2 **-** Input)

Mix colour mixes colours on a component-wise basis. The Mix controller can be either a colour or a scalar:

Output.red = Input.red **and** Input 2.red **mixed by the** Mix controller's red value

Output.green = Input.green **and** Input 2.green **mixed by the** Mix controller's green value

Output.blue = Input.blue **and** Input 2.blue **mixed by the** Mix controller's blue value

Mix vector mixes vectors on a component-wise basis, but the Mix controller value is always converted to a scalar if it is not already a scalar:

Output.x = Input.x **and** Input 2.x **mixed by the** Mix controller's scalar value

Output.y = Input.y **and** Input 2.y **mixed by the** Mix controller's scalar value

Output.z = Input.z **and** Input 2.z **mixed by the** Mix controller's scalar value**Node Type: ** Function**Settings: **

**Input 2**: This is where you specify the node for the Input 2 value.**Mix controller**: This is where you specify the node that is used to control the mixing between the Input and Input 2 values. If you do not specify a mix controller, a value of 0.5 is used.

**Error conditions**

- It is an error for there to be no
**Input**value. In this case 0 is output for scalars, and colours and vectors will have all their components set to 0. - It is an error for there to be no
**Input 2**value. In this case the**Input**value is output. - If there is no
**Mix controller**node attached then a value of 0.5 is used for mixing the input values.

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.