Subtract

The Subtract Node

This Node can be used to subtract two values, one from the other. You can specify the values to subtract, or supply one or two Node Inputs and the node will output the difference between the two values. When specifying values, you can input them directly to the node input boxes, or you can input them through the Inspector window:
The Inspector Window Inputs For The Subtract Node

The Subtract operator takes the first input and subtracts all subsequent inputs from it. For example, given the vec2(1, 2) input and subtracting a vec3(3, 4, 5) will output a vec3(-2, -2, -5), or given the input vec2(1, 2) and subtracting the float(3) will output the vec2(-2, -1). Note that the operator interprets any missing input as 0 and always returns a value in the largest vector type of its input.

 

 

Node Inputs

This node accepts the following the inputs:

 

  • X
    The input to be subtracted from. This can be either a scalar input or a vector input.

 

  • Y
    The input to subtract. This can be either a scalar input or a vector input.

 

Note that when using this node, the following rules will be applied depending on the input values:

Float - Float   = Float
Float - Vec2    = Vec2 (the float is converted to a Vec2 with 0 as the second component)
Float - Vec3    = Vec3 (the float is converted to a Vec3 with 0 as the second and third components)
Float - Vec4    = Vec4 (the float is converted to a Vec4 with 0 as the second and third and fourth components)
Vec2 - Vec2     = Vec2
Vec3 - Vec3     = Vec3
Vec4 - Vec4     = Vec4
Vec2 - Float    = Vec2 (the float is converted to a vec2 with 0 as the second component)
Vec3 - Vec2     = Vec3 (the vec2 is converted to a vec3 with 0 as the third component)
Vec4 - Vec2     = Vec4 (the vec2 is converted to a vec4 with 0 as the third and fourth components)
Vec3 - Float    = Vec3 (the float is converted to a vec3 with 0 as the second and third components)
Vec4 - Vec3     = Vec4 (the vec3 is converted to a vec4 with 0 as the fourth component)
Vec4 - Float    = Vec4 (the float is converted to a vec4 with 0 as the second and third and fourth components)

 

 

Node Output

The node will output either a scalar (float) value or a vector, depending on the inputs that were used.