---
title: "Color Arithmetic"
canonical: "https://documentation.chaos.com/space/VBLD/117638270/Color%20Arithmetic"
format: markdown
---
This page provides information about the Color Arithmetic node in V-Ray Node Editor in Blender. Overview The Color Arithmetic node performs an arithmetic operation between two colors/textures. For the example here, a Bitmap node is attached to  Color A , and  Color B  is set to an orange color. The  Mode  is set to output the  Product  of the two Color slots, and it is connected to the  Diffuse  of the V-Ray Material, resulting in an orange-tinted brick map. UI Path:  ||V-Ray Node Editor|| >  Shader  >  Add  >  Texture Utilities  >  V-Ray Color Arithmetic   Node Input Sockets This section describes the input sockets of the node. Some sockets have dedicated parameters, which are further described below, and some sockets are just inputs. Color A  – Input slot for the first texture. Color B  – Input slot for the second texture. Multiplier A  – This slot accepts float nodes to determine a multiplier for the first texture. You can also manually enter a float value. Multiplier B  – This slot accepts float nodes to determine a multiplier for the second texture. You can also manually enter a float value. Result Alpha  – This slot accepts float nodes to determine the alpha that will be output with the result. If no node is connected here, the alpha is determined by the result of the two textures. Properties Mode  – Specifies the calculation method for the two colors/textures:  Result A  – Returns the value of A (color_a*mult_a) Result B  – Returns the value of B (color_b*mult_b) Product  – Performs a multiplication operation and returns the product (A*B). Sum  – Performs an addition operation and returns the sum (A+B). Difference  – Performs a subtraction operation and returns the difference (A-B). Power  – Performs an exponentiation operation and returns the power (A^B). Division  – Performs a division operation and returns the quotient (A/B). Minimum  – Performs a comparison and returns the minimum value. Maximum  – Performs a comparison and returns the maximum value. Absolute Difference  – Performs a subtraction operation and returns the difference as an absolute value (abs(A-B)). Lower Intensity Color  – Returns the value of whichever  Color  parameter has the lowest intensity. Greater Intensity Color  – Returns the value of whichever  Color  parameter has the greatest intensity.   Sin  – Performs a sine function and returns the result (sin(A)). Cos  – Performs a cosine function and returns the result (cos(A)). Abs  – Returns the absolute value of the first argument (abs(color_a*mult_a) Ceil  – Performs a ceiling function that rounds up to the next integer that is equal to or greater than the largest argument - A or B (ceil(A)); (ceil(B)). Exp  – Performs an exponential function (e a+b ). Floor  – Performs a floor function that rounds down to the next integer that is equal to or smaller than the smallest argument - A or B (floor(A)); (floor(B)). Log  – Performs a natural logarithmic function (ln(A)). Log 10  – Performs a common logarithmic function (base 10) on the first argument (log(A)). Sqrt  – Performs a square root function (√A). Fmod  – Performs a division operation and returns the remainder (A%B).  Average  – Returns the average of A and B (((color_a*mult_a)+(color_b*mult_b))/2) Tan  – Performs a tangent function and returns the result (tan(A.0)). Asin  – Performs an arcsine function and returns the result (asin(A). Acos  – Performs an arccosine function and returns the result (acos(A)). Atan  – Performs an arctangent function and returns the result (atan(A)). Atan 2  – Performs an arctangent function with two arguments and returns the result (atan2(A,B)). Bias Schlick  – Performs a faster bias  approximation, described by Christophe Schlick, based on the original definition by Kenneth Perlin. 1 Gain Schlick  – Performs a faster gain  approximation, described by Christophe Schlick, based on the original definition by Kenneth Perlin. 2 Bias Perlin  –  Implements the original bias definition by Kenneth Perlin. 3 Gain Perlin  –  Implements the original gain definition by Kenneth Perlin. 4 Color A  – Specifies the first color/texture. Color B  – Specifies the second color/texture. Multiplier A  – A multiplier for Color A. Multiplier B  – A multiplier for Color B. Bias and Gain Equations The exact equations for the Christophe Schlick and Kenneth Perlin definitions are: bias_schlick(x, a) := x / ((1 / a - 2) * (1 - x) + 1) gain_shclick(x, a) :=
  { bias_schlick(2 * x, a) / 2 , if a < 0.5 }
  { (bias_schlick(2 * x - 1, 1 - a) + 1) / 2 , if a >= 0.5 } bias_perlin(x, a) := x ^ (ln(a) / ln(0.5)) gain_perlin(x, a) :=
  { bias_perlin(2 * x, 1 - a) / 2 , if a < 0.5 }
  { 1 - bias_perlin(2 - 2 * x, 1 - a) / 2 , if a >= 0.5 } References [*] Kenneth Perlin and Eric M Hoffert. Hypertexture. SIGGRAPH, 1989. [*] Christophe Schlick. Fast alternatives to Perlin’s bias and gain functions. Graphics Gems, 4, 1994