--- title: "Math Vector Shaders" url: "https://help.maxon.net/r3d/maya/en-us/Content/html/Math%2BVector%2BShaders.html" section_path: "Shaders > Math Shaders > Math Vector Shaders" description: "These shaders are currently not available in Maya! Please use built-in Maya math shaders." --- # Math Vector Shaders You are here: # Math Vector Shaders > **Important:** These shaders are currently not available in Maya! Please use built-in Maya math shaders. ## Introduction Redshift supports a wide variety of commonly used math operation shaders for both scalar (float) values and vectors. All math nodes that process vector values are listed here: ## Cross Product | | | --- | | | Returns the outer product perpendicular vector of *Input 1* and *Input 2* vectors, using the following formula: *out*.x = *Input1*.y\* *Input2*.z - *Input1*.z\* *Input2*.y\ *out*.y = *Input1*.z\* *Input2*.x - *Input1*.x\* *Input2*.z\ *out*.z = *Input1*.x\* *Input2*.y - *Input1*.y\* *Input2*.x ## Dot Product | | | --- | | | Returns the inner product of *Input 1* and *Input 2* vectors, using the following formula: *Input1*.x \* *Input2*.x + *Input1*.y \* *Input2*.y + *Input1*.z \* *Input2*.z ## Normalize | | | --- | | | Returns a normalized vector of *Input*, with a new vector length of 1.0. ## Vector Abs Every component of the *Input* vector will be returned as a positive value. For example, the vector (-1, 0, 1) will be returned as (1, 0, 1). ## Vector Add Returns the result of an addition of the two Input vectors *Input 1* and *Input 2*. For example:\ (0.5, 0, 0.2) + (0.5, 1, 0) would result in an output of (1.0, 1, 0.2) ## Vector Bias Returns a curved bias of *Input* by *Bias*, using the following Ken Perlin formula: pow(*Input*, log(*Bias*)/log(0.5))\ *Bias* components should be in the range between 0.0 and 1.0 Every *Input* vector component is using the matching component of the *Bias* vector to finally result in the output vector. This function will lead to a reduction of the color component values that have a mid-range brightness, especially if set to values of less than 0.5. *Bias* values greater than 0.5 will brighten the color component values with mid-range intensity correspondingly. Color components that are already very dark or bright will be less affected. A *Bias* value of 0.5 will result in no changes to the colors that are input. ## Vector Change Range In short, this node returns *Input* remapped from *Old Range* values to *New Range* values, with an optional clamp. This can be used to adapt, to remap and even to clamp colors or other vector values. For example:\ *Input* = 0.5, 1, 1\ *Old Range Min* = 0, 0, 0\ *Old Range Max* = 1, 1, 1\ *New Range Min* = 0, 0, 0\ *New Range Max* = 2, 0.5, 0.5 You can see that Input.x ist in the middle of the *Old Range.x* range, so the resulting x component is in the middle of the *New Range.x* range, which is 1. The other two components for *Input.y* and *Input.z* are equal to the same *Old Range Max* components and therefore will be equal to the same *New Range Max* components, which both have a value of 0.5.\ The resulting vector is 1, 0.5, 0.5 in this example. Using *Input* components that are not included in the *Old Range* will lead to results the are also outside of the *New Range*. For example using the *Input* 2, 1, 1 with the above settings would result in an output of 4, 0.5, 0.5, if *Clamp To New Range* is switched off. Switching this option on will limit the output values to what has been defined with *New Range Min* and *New Range Max*. ## Vector Div Returns *Input 1* / *Input 2*. ## Vector Exp Returns the exponential of *Input*, using the following formula: e^ *Input*, which is performed for all three vector components individually > **Note:** This is the inverse function of Ln. ## Vector Floor Returns the integer part of evry *Input* vector component. For example, the vector 1.5, 0.7, 0 will be returned as 1, 0, 0. ## Vector Frac Returns the fractional part of *Input*. For example, 1.5, 0.7, 0 will be returned as 0.5, 0.7, 0. ## Vector Gain Returns a contrast gain of *Input* by *Gain*, using the following Ken Perlin formula: Bias( 2 \* *Input* - *Gain* ) \* 0.5               ; if Input \< 0.5 1 - Bias(  2 - 2 \* *Input* - *Gain* ) \* 0.5    ; otherwise *Gain* and *Input* components should be in the range between 0.0 and 1.0 ## Vector Invert Returns (1, 1, 1) - *Input*.\ The *Input* components should be in a range between 0.0 and 1.0. ## Vector Length | | | --- | | | Returns the length of the vector *Input*. ## Vector Ln Returns the natural logarithm (to base e) of the *Input* vector components. > **Note:** This is the inverse function of Exp. ## Vector Log Returns the logarithm of the *Input* vector components to *Base*. > **Note:** This is the inverse function of Pow. ## Vector Max Compares identical vector components of *Input 1* and *Input 2* and outputs the largest values in the output vector. ## Vector Min Compares identical vector components of *Input 1* and *Input 2* and outputs the smallest values in the output vector. ## Vector Mix Returns *Input 1* linearly interpolated to *Input 2* by *Mix*. When *Mix* is 0.0, *Input 1* will be returned. When *Mix* is 1.0, *Input 2* will be returned. So the used formula is: *Out* = *Input 1* + (*Input 2* - *Input 1*) \* *Mix Amount*, with *Mix Amout* being a value between 0.0 and 1.0. ## Vector Mod Returns the modulo of *Input* by *Divisor*. For example 7 modulo 5 will be returned as 2 (7 divided by 5 is 1, leaving a rest of **2**. ## Vector Mul Returns *Input 1* \* *Input 2*, so every vector component of *Input 1* gets multiplied with the same component of *Input 2*. ## Vector Neg Returns 0 - *Input*, so the sign of each vector component value is reversed. ## Vector Pow Returns *Base*^ *Exponent* for every component of the vectors. > **Note:** This is the inverse function of Log. ## Vector Rcp Returns 1 / *Input*. Having Input component values of 0 would normally not be defined in math, but the node will just output 0 in these cases. ## Vector Saturate Returns *Input* clamped to values between 0 and 1, inclusively. For example -1.5 will be returned as 0.0 and 1.5 will be returned as 1.0, so all output values will be kept in the standard range for color components. ## Vector Sign Returns -1 if an *Input* component is a negavitve number and 1 otherwise. ## Vector Sqrt Returns the square-root of every *Input* component. ## Vector Sub Calculates a subtraction of the two input vectors. Returns *Input 1* - *Input 2*.