Add Multiplied Scalar: Difference between revisions
Changed wording of conversion based on luminance. |
m Added additional description and example images to Overview section, to illustrate the math behind the Add Multiply family of nodes. |
||
| Line 21: | Line 21: | ||
For vector data, the 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). | For vector data, the 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). | ||
</ul> | </ul> | ||
In the image below, you can see the mathematical effect of the Add Mulitplied family of nodes on a given value from the Main Input. When the value assigned to Input 2 is: | |||
* -2.0, the value of the node’s output is the inverse of the Main Input values. <br /n> | |||
* -1.0, the value of the node’s output is zero. <br /n> | |||
* 0.0, the value of the nodes output is the same as the Main Input values. <br /n> | |||
* 1.0, the value of the node’s output is double that of the Main Input values. <br /n> | |||
<ul> | |||
[[File:AddMultipliedFamily_01_CurveComparision.jpg|none|800px|A comparison of Add Multiplied family of node’s output to that of the Main Input, as the value from Input 2 is changed.]] | |||
</ul> | |||
The Add Multiplied family of nodes can be applied to terrain, clouds, and textures, etc. Here, the same values as above are applied to the displacement of a surface.. | |||
<ul> | |||
[[File:AddMultipliedFamily_02_DisplacedSurfaceComparision.jpg|none|800px|A comparison of the effect on surface displacement from the Add Multiplied family of node’s output, as the value from Input 2 is changed.]] | |||
</ul> | |||
The following image illustrates how the Add Multiplied family of nodes might be used to manipulate the Density fractal assigned to a cloud layer’s Density shader input. | |||
<ul> | |||
[[File:AddMultipliedFamily_03_Cloudsv3_Density.jpg|none|800px|A comparison of the effect from the Add Multiplied family of nodes on a cloud layer’s Density setting, as the value from Input 2 is changed.]] | |||
</ul> | |||
In this example, the Add Multiplied Colour node was used to modify the colour values applied to a surface. Visually speaking, colour values below 0 show up as black, and values above 1 will be white; however if you examine the RGB values listed in the small pixel indicator in the bottom right of each section, which sampled a pixel value of (0.5,0.5,0.5) you’ll see that the output value is precisely that of the above examples. | |||
<ul> | |||
[[File:AddMultipliedFamily_04_AddColour_Textures.jpg|none|800px|A comparison of the effect from an Add Multiplied Colour node on a surface texture. The small pixel indicator in the bottom right corner of each section indicates the precise pixel value of a sampled pixel of 0.5, 0,5,0.5. | |||
]] | |||
</ul> | |||
Latest revision as of 00:46, 2 February 2022

Overview
The Add Multiplied family of nodes will multiply the Main Input with Input 2 and add that result with the Main Input.
Mathematically it looks like this:
-
(Main Input * Input 2) + Main Input
When the incoming data is not scalar data, the node first converts the data to scalar as follows:
-
For colour data, the node converts the data to scalar based on the luminance of the colour. The math for this is: 0.2125 * r + 0.7152 *g + 0.0724 * b.
For vector data, the 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).
In the image below, you can see the mathematical effect of the Add Mulitplied family of nodes on a given value from the Main Input. When the value assigned to Input 2 is:
- -2.0, the value of the node’s output is the inverse of the Main Input values.
- -1.0, the value of the node’s output is zero.
- 0.0, the value of the nodes output is the same as the Main Input values.
- 1.0, the value of the node’s output is double that of the Main Input values.

The Add Multiplied family of nodes can be applied to terrain, clouds, and textures, etc. Here, the same values as above are applied to the displacement of a surface..

The following image illustrates how the Add Multiplied family of nodes might be used to manipulate the Density fractal assigned to a cloud layer’s Density shader input.

In this example, the Add Multiplied Colour node was used to modify the colour values applied to a surface. Visually speaking, colour values below 0 show up as black, and values above 1 will be white; however if you examine the RGB values listed in the small pixel indicator in the bottom right of each section, which sampled a pixel value of (0.5,0.5,0.5) you’ll see that the output value is precisely that of the above examples.

In the example images below, a proxy box labeled Add Multiplied Scalar Output is used for illustration to see the numerical output values.
In this example, the source data is scalar.
When the source data is colour, it is first converted to scalar data. Note that the node ignores the displacement data.
If a shader or function nodes are not connected to Input 2, the Main Input passes through to the Output.
If a shader or function nodes are not connected to the Main Input, nothing passes through the node.
All nodes in this family have just one setting, which lets you assign a shader or function nodes to Input 2.
Settings:
- Name: This setting allows you to apply a descriptive name to the node, which can be helpful when using multiple Add Multiplied Scalar nodes in a project.
- Enable: When checked, the node is active and the Main Input value is first multiplied by Input 2 value, and the result is added to the Main Input 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 multiplied with the values of the Main Input. The result of that is added to the Main Input value.
Fun with Add Multiplied Scalar
The Add Multiplied Scalar node can be used to exaggerate the high or low values from the Main Input.
In this example, the displacement of the mound increases as the value of the Constant Scalar is raised. Note how the values in the Add multiplied scalar preview window are brighter than those of the Transform input shader preview window.
In the example below, the steepness of a river gorge or canyon can be controlled by increasing the value of the Constant Scalar.