Started by Hetzen, September 19, 2019, 07:42:15 am

#### Hetzen

##### September 19, 2019, 07:42:15 amLast Edit: October 11, 2019, 09:27:26 am by Hetzen
Add Scalar takes the Main Input connection and adds it to the Input 2 connection and passes the result to the Output. Notice that the displacement from the Power Fractals has been stripped away and only the grey scalar value has been used in the output. If you want to add displacements together then the Merge Shader would be the node to use.

If Input 2 is disconnected, the Main Input passes through to the Output, again without the displacement, only the scalar grey value. If the Main Input is disconnected, nothing passes through. If you connect two colour sources, the Add Scalar node will take the luminance of the colour channels of each input to create a grey scale map of the inputs brightness and then add them together, ignoring the colour information. The maths being luminance = 0.2125 * r + 0.7152 * g + 0.0724 * b If you connect vector sources to the inputs, the node will look at the length the vector makes from a zero origin to produce a scalar value. The internal maths to do this is the  square_root(x*x + y*y + z*z). The preview panel can only show values up to 2 (the Preview Panel is set this way to see overlaid graphics), so the pure white areas have values beyond 2 in this example. There is no restriction to the size of the number being affected. #### Matt

##### September 19, 2019, 08:26:59 pm #1
This is a great introduction.

Two corrections:

When a colour is converted to a scalar, it uses the "luminance" of the colour using the following: luminance = 0.2125 * r + 0.7152 * g + 0.0724 * b

When a vector is converted to a scalar, it uses square_root(x*x + y*y + z*z), which is the length of the vector.

https://planetside.co.uk/wiki/index.php?title=Node_Input_Type_Conversion
Just because milk is white doesn't mean that clouds are made of milk.

#### Hetzen

##### September 20, 2019, 03:53:38 pm #2
Thanks Matt, I'll amend the header post.