Add Scalar: Difference between revisions
No edit summary |
m Disabled table of contents for now, until Fun With section has some examples. |
||
| (13 intermediate revisions by 3 users not shown) | |||
| Line 1: | Line 1: | ||
[[ | [[File:AddScalar_00a_GUI.png|none|470px|Add Scalar]] | ||
<!-- __TOC__ --> | |||
Input | == Overview == | ||
The Add family of nodes allow you to add the colour/scalar/vector coming into the Main Input with the colour/scalar/vector coming into Input 2. | |||
The Add Scalar node adds two scalars together. It 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 Add Scalar 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. | |||
* When the source of the incoming data is vector data, the Add Scalar node converts the data to scalar based on the length of the vector. The math for this is: square_root(x*x + y*y + z*z). | |||
[[Category: Add | |||
In the example image below, the Add Scalar node simply adds the scalar values from the nodes assigned to it. | |||
<ul> | |||
[[File:AddScalar_10_Scalar.JPG|none|800px|The Add Scalar node adds together the scalar data from the Main Input and Input 2.]] | |||
</ul> | |||
The Add Scalar node requires scalar data. One way to convert colour data to scalar data is shown below, where the Luminance to scalar node is used to convert the colour output of the Power fractal node. | |||
<ul> | |||
[[File:AddScalar_11_ColourInputsPF3.JPG|none|800px|The Add scalar node requires scalar data. One way to convert colour data to scalar data is by using a Luminous to scalar node.]] | |||
</ul> | |||
The Add Scalar node will automatically convert non-scalar data to scalar before adding them together as described above. Only scalar data is recognized and any displacement data a shader provides is ignored and not passed through. In the example below, the colour values from both Power fractal shaders are converted to scalar data and the displacement data discarded. Only scalar values are output by the Add Scalar node. | |||
<ul> | |||
[[File:AddScalar_12_PF3DisplaceIgnored.JPG|none|800px|The Add Scalar node will convert non-scalar values to scalar and ignores any displacement data.]] | |||
</ul> | |||
When Input 2 is unassigned, the Main Input’s component values are passed through, first converting them to scalar if necessary. | |||
<ul> | |||
[[File:AddScalar_13_MainInputOnly.JPG|none|800px|When Input 2 is unassigned, data from the Main Input is passed through as scalar data.]] | |||
</ul> | |||
When the Main Input is unassigned, the value zero (black) is passed through. | |||
<ul> | |||
[[File:AddScalar_14_Input2Only.JPG|none|800px|When the Main Input is unassigned, the value zero (black) is passed through.]] | |||
</ul> | |||
When colour sources are assigned to the Main Input or Input 2, the colour’s luminance value is used as described above. Only scalar data is output. | |||
<ul> | |||
[[File:AddScalar_15_ColourInputs.JPG|none|800px|Colour sources are converted to scalar by using the colour’s luminance value.]] | |||
</ul> | |||
When vector sources are assigned to the Main Input or Input 2, the node produces a scalar value based on the length of the vector as described above. Only scalar data is output. | |||
<ul> | |||
[[File:AddScalar_16_VectorInputs.JPG|none|800px|Vector sources are converted to scalar based on the length of the vector. The math is square_root(x*x + y*y + z*z).]] | |||
</ul> | |||
<!-- [[File:AddScalar_17_VectorAndColourInputs.JPG|400px]] --> | |||
'''Settings:''' | |||
*'''Name:''' This setting allows you to apply a descriptive name to the node, which can be helpful when using multiple Add Scalar nodes in a project. | |||
*'''Enable:''' When checked, the node is active and the Main Input value is added with the Input 2 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 added to the values of the Main Input. | |||
<!-- == Fun with Add Scalar == --> | |||
<br /n> | |||
[[Category: Add]] | |||
Latest revision as of 22:31, 28 January 2022

Overview
The Add family of nodes allow you to add the colour/scalar/vector coming into the Main Input with the colour/scalar/vector coming into Input 2.
The Add Scalar node adds two scalars together. It 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 Add Scalar 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.
- When the source of the incoming data is vector data, the Add Scalar node converts the data to scalar based on the length of the vector. The math for this is: square_root(x*x + y*y + z*z).
In the example image below, the Add Scalar node simply adds the scalar values from the nodes assigned to it.
The Add Scalar node requires scalar data. One way to convert colour data to scalar data is shown below, where the Luminance to scalar node is used to convert the colour output of the Power fractal node.
The Add Scalar node will automatically convert non-scalar data to scalar before adding them together as described above. Only scalar data is recognized and any displacement data a shader provides is ignored and not passed through. In the example below, the colour values from both Power fractal shaders are converted to scalar data and the displacement data discarded. Only scalar values are output by the Add Scalar node.
When Input 2 is unassigned, the Main Input’s component values are passed through, first converting them to scalar if necessary.
When the Main Input is unassigned, the value zero (black) is passed through.
When colour sources are assigned to the Main Input or Input 2, the colour’s luminance value is used as described above. Only scalar data is output.
When vector sources are assigned to the Main Input or Input 2, the node produces a scalar value based on the length of the vector as described above. Only scalar data is output.
Settings:
- Name: This setting allows you to apply a descriptive name to the node, which can be helpful when using multiple Add Scalar nodes in a project.
- Enable: When checked, the node is active and the Main Input value is added with the Input 2 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 added to the values of the Main Input.