2
$\begingroup$

enter image description here

How does the above node setup work, and what will happen when I change the Fac value (0-1)? What calculation is the mix node doing here when set to Difference?

$\endgroup$
6
$\begingroup$

In Cycles a color is just a set of 3 numbers representing the red, blue, and green content of the color. To perform a mathematical operation on a color Cycles splits the color up into its RGB channels, performs the operation on each channel individually, and then combines them back into a Color datatype again.

The Mix RGB node, when set to difference, returns the absolute value of the first color minus the second color. Mathematically: Color = |Color1 - Color2|.

The Fac value controls how much this influences the output. So if Fac is 0 the output is always Color1, if Fac is 1 the output is always the exact result of the mix operation chosen (in your case, Difference). It basically just mixes Color1 back into the result of the operation. Mathematically: Color = |Color1 - Color2| * Fac + Color1 * (1-Fac).

$\endgroup$
  • $\begingroup$ Shouldn't it be Color = Color1 - (Fac * Color2)? $\endgroup$ – Ezra Aug 13 '16 at 4:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.