Scalar to Boolean Scalar: Difference between revisions
jrfconvert import |
Conformed layout & updated GUI image. |
||
| (5 intermediate revisions by one other user not shown) | |||
| Line 1: | Line 1: | ||
<div style="float:right; border-style:solid; padding:20px"><categorytree mode=pages hideroot=off>Boolean</categorytree></div> | |||
= | |||
[[ | [[File:ScalarToBooleanScalar_00_GUI.png|none|470px|Scalar to Boolean Scalar]] | ||
< | |||
==Overview== | |||
The Scalar to Boolean scalar node converts a scalar value to a Boolean scalar value. A Boolean has a value of either 1 or 0. There is an optional Threshold value which lets you control how the conversion to a Boolean value happens.<br /><br /> The default conversion, without using a threshold value, is that the Input value is converted to 0 if it equals 0, and it is converted to 1 if it is not equal to 0. As an example:<br /><br />'''Input''' of 0 '''becomes''' 0<br />'''Input''' of 0.5 '''becomes''' 1<br />'''Input''' of 2 '''becomes''' 1<br />'''Input''' of -0.5 '''becomes''' 1<br /><br /> Optionally, you can control the conversion to a Boolean by using a threshold value. In this case the Input value is converted to 0 if it is less than the threshold value, and converted to 1 if it is greater than or equal to the threshold value. As an example, using a threshold value of 2 :<br /><br />'''Input''' of 0 '''becomes''' 0 ( 0 is less than 2 )<br />'''Input''' of 0.5 '''becomes''' 0 ( 0.5 is less than 2 )<br />'''Input''' of 2 '''becomes''' 1 ( 2 is greater than or equal to 2 )<br />'''Input''' of 6 '''becomes''' 1 ( 6 is greater than or equal to 2 ) <br />'''Input''' of -0.5 '''becomes''' 0 ( -0.5 is less than 2 )<br /><br />'''Settings: '''<br /> | |||
* '''Name:''' This setting allows you to apply a descriptive name to the node, which can be helpful when using multiple Scalar to boolean scalar nodes in a project. | |||
* '''Enable:''' When checked, the node is active, and when unchecked the node is ignored. | |||
* '''Use threshold value: '''If this check box is checked then the supplied threshold value is used to convert the scalar to a Boolean. | |||
* '''Threshold value: '''This is the value that is used for the threshold value, as described above. | |||
<br />'''Error conditions:'''<br /> | |||
* It is an error for there to be no '''Input''' value. In that case 0 is output from the node. | |||
* It is an error for there to be no '''Threshold value''' shader connected when the '''Use threshold value''' check box is checked. In this case the default conversion, described above, is used. | |||
<br /n> | |||
[[Category: Boolean]] | |||
Latest revision as of 04:32, 6 April 2022

Overview
The Scalar to Boolean scalar node converts a scalar value to a Boolean scalar value. A Boolean has a value of either 1 or 0. There is an optional Threshold value which lets you control how the conversion to a Boolean value happens.
The default conversion, without using a threshold value, is that the Input value is converted to 0 if it equals 0, and it is converted to 1 if it is not equal to 0. As an example:
Input of 0 becomes 0
Input of 0.5 becomes 1
Input of 2 becomes 1
Input of -0.5 becomes 1
Optionally, you can control the conversion to a Boolean by using a threshold value. In this case the Input value is converted to 0 if it is less than the threshold value, and converted to 1 if it is greater than or equal to the threshold value. As an example, using a threshold value of 2 :
Input of 0 becomes 0 ( 0 is less than 2 )
Input of 0.5 becomes 0 ( 0.5 is less than 2 )
Input of 2 becomes 1 ( 2 is greater than or equal to 2 )
Input of 6 becomes 1 ( 6 is greater than or equal to 2 )
Input of -0.5 becomes 0 ( -0.5 is less than 2 )
Settings:
- Name: This setting allows you to apply a descriptive name to the node, which can be helpful when using multiple Scalar to boolean scalar nodes in a project.
- Enable: When checked, the node is active, and when unchecked the node is ignored.
- Use threshold value: If this check box is checked then the supplied threshold value is used to convert the scalar to a Boolean.
- Threshold value: This is the value that is used for the threshold value, as described above.
Error conditions:
- It is an error for there to be no Input value. In that case 0 is output from the node.
- It is an error for there to be no Threshold value shader connected when the Use threshold value check box is checked. In this case the default conversion, described above, is used.