# Difference between revisions of "Mix Scalar"

(jrfconvert import) |
|||

Line 3: | Line 3: | ||

[[Image:drex_module_50_image_0.png|485pxpx|Mix Scalar]] | [[Image:drex_module_50_image_0.png|485pxpx|Mix Scalar]] | ||

+ | |||

+ | |||

+ | '''Node Description & Purpose: '''<br /> 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.<br /><br /> The inputs are mixed using linear interpolation according to the following formula:<br /><br /> Output '''<nowiki>=</nowiki>''' Input '''+''' Mix controller value '''x''' (Input 2 '''-''' Input)<br /><br /> Mix colour mixes colours on a component-wise basis. The Mix controller can be either a colour or a scalar:<br /><br /> Output.red = Input.red '''and''' Input 2.red '''mixed by the''' Mix controller's red value<br /> Output.green = Input.green '''and''' Input 2.green '''mixed by the''' Mix controller's green value<br /> Output.blue = Input.blue '''and''' Input 2.blue '''mixed by the''' Mix controller's blue value<br /><br /> 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:<br /><br /> Output.x = Input.x '''and''' Input 2.x '''mixed by the''' Mix controller's scalar value<br /> Output.y = Input.y '''and''' Input 2.y '''mixed by the''' Mix controller's scalar value<br /> Output.z = Input.z '''and''' Input 2.z '''mixed by the''' Mix controller's scalar value<br /><br />'''Node Type: ''' Function<br /><br />'''Settings: '''<br /> | ||

+ | |||

+ | * '''Input 2'''<nowiki>: This is where you specify the node for the Input 2 value.</nowiki> | ||

+ | * '''Mix controller'''<nowiki>: 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.</nowiki> | ||

+ | |||

+ | <br />'''Error conditions'''<br /> | ||

+ | |||

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

+ | |||

__NOTOC__ | __NOTOC__ | ||

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

## Revision as of 01:09, 29 April 2011

**Mix Scalar**[edit]

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