4
$\begingroup$

I know in a lot of node setups, people use the image texture's color output as a mix factor. How does Cycles use an image texture to do this? Does it use the brightness in particular parts of the image to represent different numerical values? How does that translate, and how can it represent different amounts of these values on different parts of the mesh?

$\endgroup$
5
$\begingroup$

You're correct, it uses brightness. Or rather, luminance. The color output contains three values, R G and B. When a color output (yellow socket) is plugged into a scalar input (gray socket), it is automatically converted as if using an RGB to BW node.

For example, this can be observed by plugging an image texture into a math node set to multiply by 1:

enter image description here

Before multiplying the values, the R G and B channels are turned into a single grayscale channel. Since we're multiplying by 1, the values are unchanged.

This is the same as the more "proper" method of using a RGB to BW node:

enter image description here

By default blender converts the R G B channels to a single channel while trying to preserve the luminance (see wikipedia).

To do this, the RGB to BW node does something like this:

enter image description here

Once the color channels are converted to a single channel, this can be used to set the mix factor for each pixel (using just the mix factor slider is equivalent to using a solid color image). See How does fac differ with manual control versus node control?.

If you want to use images with very specific values, then you'll want to pay close attention to color management. See: What exactly does the "Non-color data" option for image/environment textures do?

$\endgroup$
  • $\begingroup$ So white represents a 1, and black represents a 0? Thanks for the awesome answer! $\endgroup$ – Anson Savage Jun 10 '15 at 21:56
  • $\begingroup$ Also, if you had an almost white pixel, that represented a 0.9, and then you had it run through a multiply by two node, how would it go into a scalar plug like factor? The maximum value is 1 as far as I know. How would Cycles handle that? Also, if you were to use an invert node, would it invert the colors negatively? (Eg. 0.6 would be -0.6) Or does it do an inverse relationship? (Eg. 0.6 represents 0.4) Thanks again! $\endgroup$ – Anson Savage Jun 10 '15 at 22:03
  • $\begingroup$ @AnsonSavage if it exceeds the maximum, it is clamped (however, the maximum is not always 1); if you invert the color it does 1-(color of pixel) , assuming all values are in the normal range. $\endgroup$ – someonewithpc Jun 10 '15 at 22:23
  • $\begingroup$ @someonewithpc Is the color of the pixel represented on a scale of 0 to 1 in this case? $\endgroup$ – Anson Savage Jun 10 '15 at 22:51
  • 2
    $\begingroup$ Mixing and matching concepts. Colours extend from zero to infinity in a scene referred model, which Cycles is, so suggesting otherwise is completely false. There is no such creature as white nor black in the model. Albedo is another creature altogether, which is labeled "diffuse colour" for example, which is not a colour at all but rather a measure of reflectance. This is precisely why >1.0 values result in "pretty weird effects" as per @gandalf3, as it is reflecting back more light than hits it. $\endgroup$ – troy_s Mar 8 '16 at 10:10

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.