Math Nodes
In the Shader Designer, math nodes perform algebraic, logic, trigonometric, and other mathematical operations.
Note
When you work with math nodes in the Shader Designer, type promotion is especially evident. To learn how type promotion affects input parameters, see the "Promotion of inputs" section in Shader Designer Nodes.
Math node reference
Node |
Details |
Properties |
---|---|---|
Abs |
Computes the absolute value of the specified input per component. For each component of input X, negative values are made positive so that every component of the result has a positive value. Input:
Output:
|
None |
Add |
Computes the component-wise sum of the specified inputs per component. For each component of the result, the corresponding components of input X and input Y are added together. Input:
Output:
|
None |
Ceil |
Computes the ceiling of the specified input per component. The ceiling of a value is the smallest integer that's greater than or equal to that value. Input:
Output:
|
None |
Clamp |
Clamps each component of the specified input to a predefined range. For each component of the result, values that are below the defined range are made equal to the minimum value in the range, values that are above the defined range are made equal to the maximum value in the range, and values that are in the range are not changed. Input:
Output:
|
|
Cos |
Computes the cosine of the specified input, in radians, per component. For each component of the result, the cosine of the corresponding component, which is provided in radians, is calculated. The result has components that have values in the range of [-1, 1]. Input:
Output:
|
None |
Cross |
Computes the cross product of the specified three-component vectors. You can use the cross product to compute the normal of a surface that's defined by two vectors. Input:
Output:
|
None |
Distance |
Computes the distance between the specified points. The result is a positive scalar value. Input:
Output:
|
None |
Divide |
Computes the component-wise quotient of the specified inputs. For each component of the result, the corresponding component of input X is divided by the corresponding component of input Y. Input:
Output:
|
None |
Dot |
Computes the dot product of the specified vectors. The result is a scalar value. You can use the dot product to determine the angle between two vectors. Input:
Output:
|
None |
Floor |
Computes the floor of the specified input per component. For each component of the result, its value is the largest whole integer value that's less than or equal to the corresponding component of the input. Every component of the result is a whole integer. Input:
Output:
|
None |
Fmod |
Computes the component-wise modulus (remainder) of the specified inputs. For each component of the result, some integral (whole-number) multiple, m, of the corresponding component of input Y is subtracted from the corresponding component of input X, leaving a remainder. The multiple, m, is chosen such that the remainder is less than the corresponding component of input Y and has the same sign as the corresponding component of input X. For example, fmod(-3.14, 1.5) is -0.14. Input:
Output:
|
None |
Frac |
Removes the integral (whole-number) part of the specified input per component. For each component of the result, the integral part of the corresponding component of the input is removed, but the fractional part and sign are retained. This fractional value falls in the range [0, 1). For example, the value -3.14 becomes the value -0.14. Input:
Output:
|
None |
Lerp |
Linear Interpolation. Computes the component-wise weighted average of the specified inputs. For each component of the result, the weighted average of the corresponding components of the inputs X and Y. The weight is provided by Percent, a scalar, and is uniformly applied to all components. You can use this to interpolate between points, colors, attributes, and other values. Input:
Output:
|
None |
Multiply Add |
Computes the component-wise multiply-add of the specified inputs. For each component of the result, the product of the corresponding components of the inputs M and A is added to the corresponding component of input B. This operation sequence is found in common formulas—for example, in the point-slope formula of a line, and in the formula to scale and then bias an input. Input:
Output:
|
None |
Max |
Computes the component-wise maximum of the specified inputs. For each component of the result, the greater of the corresponding components of the inputs is taken. Input:
Output:
|
None |
Min |
Computes the component-wise minimum of the specified inputs. For each component of the result, the lesser of the corresponding components of the inputs is taken. Input:
Output:
|
None |
Multiply |
Computes the component-wise product of the specified inputs. For each component of the result, the corresponding components of the inputs X and Y are multiplied together. Input:
Output:
|
None |
Normalize |
Normalizes the specified vector. A normalized vector retains the direction of the original vector, but not its magnitude. You can use normalized vectors to simplify calculations where the magnitude of a vector is not important. Input:
Output:
|
None |
One Minus |
Computes the difference between 1 and the specified input per component. For each component of the result, the corresponding component of the input is subtracted from 1. Input:
Output:
|
None |
Power |
Computes the component-wise exponentiation (power) of the specified inputs. For each component of the result, the corresponding component of input X is raised to the power of the corresponding component of the input Y. Input:
Output:
|
None |
Saturate |
Clamps each component of the specified input to the range [0, 1]. You can use this range to represent percentages and other relative measurements in calculations. For each component of the result, the corresponding component values of the input that are less than 0 are made equal to 0, values that are larger than 1 are made equal to 1, and values that are in the range are not changed. Input:
Output:
|
None |
Sin |
Computes the sine of the specified input, in radians, per component. For each component of the result, the sine of the corresponding component, which is provided in radians, is calculated. The result has components that have values in the range [-1, 1]. Input:
Output:
|
None |
Sqrt |
Computes the square root of the specified input, per component. For each component of the result, the square root of the corresponding component is calculated. Input:
Output:
|
None |
Subtract |
Computes the component-wise difference of the specified inputs. For each component of the result, the corresponding component of input Y is subtracted from the corresponding component of input X. You can use this to compute the vector that extends from the first input to the second. Input:
Output:
|
None |
Transform 3D Vector |
Transforms the specified 3-D vector into a different space. You can use this to bring points or vectors into a common space so that you can use them to perform meaningful calculations. Input:
Output:
|
|