Difference between revisions of "Scalar to Boolean Scalar"

From Terragen Documentation from Planetside Software
Jump to: navigation, search
 
Line 13: Line 13:
 
<!-- imported from file: module_125.html-->
 
<!-- imported from file: module_125.html-->
  
[[Category: Boolean| ]]
+
[[Category: Boolean]]

Latest revision as of 18:27, 1 June 2011

Scalar to Boolean Scalar

Node Description & Purpose: 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 )

Node Type: Function

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.

A scalar is a single number. 1, 200.45, -45, -0.2 are all examples of scalar values.

A single object or device in the node network which generates or modifies data and may accept input data or create output data or both, depending on its function. Nodes usually have their own settings which control the data they create or how they modify data passing through them. Nodes are connected together in a network to perform work in a network-based user interface. In Terragen 2 nodes are connected together to describe a scene.

A shader is a program or set of instructions used in 3D computer graphics to determine the final surface properties of an object or image. This can include arbitrarily complex descriptions of light absorption and diffusion, texture mapping, reflection and refraction, shadowing, surface displacement and post-processing effects. In Terragen 2 shaders are used to construct and modify almost every element of a scene.