|
|
Line 1: |
Line 1: |
| This is a list of the mathematical shader processes that are available in the [[Shader Editor]] under the Math tab.
| |
|
| |
|
| {| {{Table}}
| |
| {{Tablehead|Process|Description}}
| |
| |-
| |
| {{Process|Absolute Value|Shader_abs.png|Value '''A'''|Value of size matching '''A'''|Calculates the absolute value of each component of the input '''A'''.}}
| |
| |-
| |
| {{Process|Add|Shader_add.png|Values '''A''' and '''B'''|Value of size matching larger of '''A''' and '''B'''|Calculates the componentwise sum of the inputs '''A''' and '''B'''.}}
| |
| |-
| |
| {{Process|Average|Shader_avg.png|Values '''A''' and '''B'''|Value of size matching larger of '''A''' and '''B'''|Calculates the componentwise average of the inputs '''A''' and '''B'''.}}
| |
| |-
| |
| {{Process|Cosine|Shader_cos.png|Scalar '''A'''|Scalar|Calculates the cosine of the input '''A''', where the input is measured in radians.}}
| |
| |-
| |
| {{Process|Cross Product|Shader_xpd.png|3D vectors '''A''' and '''B'''|3D vector|Calculates the cross product of the inputs '''A''' and '''B'''.}}
| |
| |-
| |
| {{Process|Divide|Shader_div.png|Value '''A''', Scalar '''B'''|Value of size matching '''A'''|Calculates the quotient of each component of the input '''A''' and the scalar input '''B'''.
| |
|
| |
| ''Tip:'' If you're dividing by a constant value, then it would be more efficient to multiply by the reciprocal of the constant. For example, you should multiply by 0.5 instead of dividing by 2.0.}}
| |
| |-
| |
| {{Process|Dot Product 3D|Shader_dp3.png|3D vectors '''A''' and '''B'''|Scalar|Calculates the dot product of the inputs '''A''' and '''B'''.}}
| |
| |-
| |
| {{Process|Dot Product 4D|Shader_dp4.png|4D vectors '''A''' and '''B'''|Scalar|Calculates the dot product of the inputs '''A''' and '''B'''.}}
| |
| |-
| |
| {{Process|Exp Base 2|Shader_ex2.png|Scalar '''A'''|Scalar|Calculates 2 raised to the power given by the input '''A'''.}}
| |
| |-
| |
| {{Process|Expand|Shader_expand.png|Value '''A'''|Value of size matching '''A'''|Multiplies each component of the input '''A''' by 2.0 and then subtracts 1.0.}}
| |
| |-
| |
| {{Process|Floor|Shader_flr.png|Value '''A'''|Value of size matching '''A'''|Calculates the floor of each component of the input '''A'''. To calculate a ceiling, negate the input and output of the Floor process.}}
| |
| |-
| |
| {{Process|Fraction|Shader_frc.png|Value '''A'''|Value of size matching '''A'''|Calculates the fraction of each component of the input '''A'''. The fraction of a number is the difference between that number and its floor.}}
| |
| |-
| |
| {{Process|Invert|Shader_invert.png|Value '''A'''|Value of size matching '''A'''|Subtracts each component of the input '''A''' from 1.0.}}
| |
| |-
| |
| {{Process|Linear Interpolate|Shader_lrp.png|Values '''A''', '''B''', and '''t'''|Value of size matching largest of '''A''', '''B''', and '''t'''|Calculates the linear interpolation between the components of '''A''' and '''B''' using the components of the input '''t''' as the interpolation parameter.}}
| |
| |-
| |
| {{Process|Log Base 2|Shader_lg2.png|Scalar '''A'''|Scalar|Calculates the logarithm base 2 of the input '''A'''. If the input is not positive, then the result is undefined.}}
| |
| |-
| |
| {{Process|Magnitude 3D|Shader_magnitude3d.png|3D vector '''A'''|Scalar|Calculates the magnitude of the input '''A'''.}}
| |
| |-
| |
| {{Process|Maximum|Shader_max.png|Values '''A''' and '''B''' (required), value '''C''' (optional)|Value of size matching larger of '''A''', '''B''', and '''C'''|Calculates the componentwise maximum of the inputs '''A''', '''B''', and '''C'''. If input '''C''' is omitted, then the maximum of only '''A''' and '''B''' is calculated.}}
| |
| |-
| |
| {{Process|Minimum|Shader_min.png|Values '''A''' and '''B''' (required), value '''C''' (optional)|Value of size matching larger of '''A''', '''B''', and '''C'''|Calculates the componentwise minimum of the inputs '''A''', '''B''', and '''C'''. If input '''C''' is omitted, then the minimum of only '''A''' and '''B''' is calculated.}}
| |
| |-
| |
| {{Process|Multiply|Shader_mul.png|Values '''A''' and '''B'''|Value of size matching larger of '''A''' and '''B'''|Calculates the componentwise product of the inputs '''A''' and '''B'''.}}
| |
| |-
| |
| {{Process|Multiply Add|Shader_mad.png|Values '''A''', '''B''', and '''C'''|Value of size matching largest of '''A''', '''B''', and '''C'''|Calculates the componentwise product of the inputs '''A''' and '''B''' and then adds the components of the input '''C'''.}}
| |
| |-
| |
| {{Process|Normalize 3D|Shader_normalize3d.png|3D vector '''A'''|3D vector|Normalizes the input '''A'''. If the input is the zero vector, then the result is undefined.}}
| |
| |-
| |
| {{Process|Power|Shader_pow.png|Scalars '''A''' and '''B'''|Scalar|Calculates the input '''A''' raised to the power of the input '''B'''. If the input '''A''' is negative, then the result is undefined. If the input '''A''' is zero and the input '''B''' is not positive, then the result is undefined.
| |
|
| |
| ''Tip:'' If you're just squaring a value, then it would be more efficient to multiply the value by itself. That is, you should calculate '''A''' × '''A''' using the '''Multiply''' process instead of raising '''A''' to the power of 2.}}
| |
| |-
| |
| {{Process|Reciprocal|Shader_rcp.png|Scalar '''A'''|Scalar|Calculates the reciprocal of the input '''A'''. If the input is zero, then the result is undefined.}}
| |
| |-
| |
| {{Process|Reciprocal Square Root|Shader_rsq.png|Scalar '''A'''|Scalar|Calculates the reciprocal square root of the input '''A'''. If the input is not positive, then the result is undefined.}}
| |
| |-
| |
| {{Process|Round|Shader_round.png|Value '''A'''|Value of size matching '''A'''|Rounds each component of the input '''A''' to the nearest integer.}}
| |
| |-
| |
| {{Process|Saturate|Shader_sat.png|Value '''A'''|Value of size matching '''A'''|Clamps each component of the input '''A''' to the range [0,1].}}
| |
| |-
| |
| {{Process|Set if Equal|Shader_seq.png|Value '''A''' (required), Value '''B''' (optional)|Value of size matching larger of '''A''' and '''B'''|For each component of the inputs '''A''' and '''B''', the corresponding component of the output is set to 1.0 if the component of '''A''' is equal to the same component of '''B''', and 0.0 otherwise. If input '''B''' is omitted, then it is assumed to be a vector of zeros.}}
| |
| |-
| |
| {{Process|Set if Greater Equal|Shader_sge.png|Value '''A''' (required), Value '''B''' (optional)|Value of size matching larger of '''A''' and '''B'''|For each component of the inputs '''A''' and '''B''', the corresponding component of the output is set to 1.0 if the component of '''A''' is greater than or equal to the same component of '''B''', and 0.0 otherwise. If input '''B''' is omitted, then it is assumed to be a vector of zeros.}}
| |
| |-
| |
| {{Process|Set if Greater Than|Shader_sgt.png|Value '''A''' (required), Value '''B''' (optional)|Value of size matching larger of '''A''' and '''B'''|For each component of the inputs '''A''' and '''B''', the corresponding component of the output is set to 1.0 if the component of '''A''' is greater than the same component of '''B''', and 0.0 otherwise. If input '''B''' is omitted, then it is assumed to be a vector of zeros.}}
| |
| |-
| |
| {{Process|Set if Less Equal|Shader_sle.png|Value '''A''' (required), Value '''B''' (optional)|Value of size matching larger of '''A''' and '''B'''|For each component of the inputs '''A''' and '''B''', the corresponding component of the output is set to 1.0 if the component of '''A''' is less than or equal to the same component of '''B''', and 0.0 otherwise. If input '''B''' is omitted, then it is assumed to be a vector of zeros.}}
| |
| |-
| |
| {{Process|Set of Less Than|Shader_slt.png|Value '''A''' (required), Value '''B''' (optional)|Value of size matching larger of '''A''' and '''B'''|For each component of the inputs '''A''' and '''B''', the corresponding component of the output is set to 1.0 if the component of '''A''' is less than the same component of '''B''', and 0.0 otherwise. If input '''B''' is omitted, then it is assumed to be a vector of zeros.}}
| |
| |-
| |
| {{Process|Set if Not Equal|Shader_sne.png|Value '''A''' (required), Value '''B''' (optional)|Value of size matching larger of '''A''' and '''B'''|For each component of the inputs '''A''' and '''B''', the corresponding component of the output is set to 1.0 if the component of '''A''' is not equal to the same component of '''B''', and 0.0 otherwise. If input '''B''' is omitted, then it is assumed to be a vector of zeros.}}
| |
| |-
| |
| {{Process|Sine|Shader_sin.png|Scalar '''A'''|Scalar|Calculates the sine of the input '''A''', where the input is measured in radians.}}
| |
| |-
| |
| {{Process|Square Root|Shader_sqrt.png|Scalar '''A'''|Scalar|Calculates the square root of the input '''A'''. If the input is negative, then the result is undefined.}}
| |
| |-
| |
| {{Process|Subtract|Shader_sub.png|Values '''A''' and '''B'''|Value of size matching larger of '''A''' and '''B'''|Calculates the componentwise difference of the inputs '''A''' and '''B'''.}}
| |
| |-
| |
| {{Process|Sum of Products|Shader_sumproducts.png|Values '''A''', '''B''', '''C''', and '''D'''|Value of size matching largest of '''A''', '''B''', '''C''', and '''D'''|Calculates the componentwise products of the inputs '''A''' and '''B''' and the componentwise products of the inputs '''C''' and '''D''' and then calculates the componentwise sum of the results.}}
| |
| |}
| |
|
| |
| == See Also ==
| |
|
| |
| * [[Shader Editor]]
| |
| * [[Basic Shader Processes]]
| |
| * [[Complex Shader Processes]]
| |
| * [[Interpolant Shader Processes]]
| |
|
| |
| [[Category:Shaders]]
| |