# What does MixRGB do exactly?

Hi!

I know the question seems a bit silly, but recently I discover an unexpected behaviour with the node.

The setup is the following:

As you could check with a Greater/Less Than node, the noise texture does not exist within the 0-1 range, but between .25-.75 aproximately. Thus, if my Color1 input was 0, at least as I’ve always understood it, the output would range within the noise’s interval, isn’t it? It looks like this is the case, since the resulting image does not seem to have pure black, nor pure white. But. When I output the image setup, with both inputs set to 1… I get pure white!! How is that possible? Wouldn’t it be the highest white within the noise texture?

More at the theory level, what I thought the interpolation did was that the Factor range goes from 0 to 1, and if the Factor input does not reach some of those limits, the Color input corresponding with that limit would not appear (purely) in the output. But given this case, it seems like the lowest and highest values of the noise texture were “stretched” to fit the 0-1 range, thus making the interpolation “proportional” to the values of the Factor input, instead of the absolute 0-1 interval. This would explain why I get pure white when I output the shown setup.

Honestly, I’m I little confused by it, since this could affect the way I’ve been using this node (dozens of times lol) until now. Any insight on this?

Álex.

I’m a bit confused about why you felt you’d get any result other than white, but I can explain how the mixRGB node works.

The factor simply determines how to blend the two color inputs together. 0 means that it’s only using the first slot, 1 means it’s only using the second slot, and values in between blend the two colors by that amount (for example .5 would evenly mix the two colors). This is why factor behaves exactly like opacity in photoshop.

When you plug a texture into the factor slot, it has the same effect as an alpha mask. It looks at each pixel in the factor image and mixes the two colors according to the brightness of that pixel (the darker the pixel is, the more the resulting pixel color will favor the color in the first slot).

When you plug a value of 1 into a slot, it treats the color in the slot as white because its assuming you want the full value for each color channel (255, 255, 255), so it’s only natural that you can only get an output of white no matter what you use for the factor in this situation. You would have to change the value of the color in one of the slots to get something different.

3 Likes

Ok, I got it. What I don’t understand now is why I didn’t understand it before. Ugh. I think I conflated the example with Color1 being 1 with that of Color1 being 0 for a moment; thus the reasoning “with an input of 1 and a mask with around .75 as highest value I should get .75 instead of pure white”. So stupid of me.

Anyway, thanks!

2 Likes

You know, people on the internet can often be cruel and down right nasty, which often stops people from endevoring to seek an understanding of seemingly “silly” topics. The truth is, we’ve all got stuff to learn, so kudos to you for asking a question you thought might get you flack.

1 Like

Yeah, I suspected the answer would be dead obvious, but I posted it anyway. It was one of those moments when you got stuck at solving 1+1. The fact that I hadn’t parametrised the colour inputs before, nor set both to the same value bugged my mental picture of the process and my brain crashed. However it is fully operative again .