Scalar to Boolean scalar

Scalar to Boolean scalar

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:

 

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.