Mixing two RGB color vectors to get resultant

yos picture yos · Dec 12, 2009 · Viewed 17.2k times · Source

I am trying to mix two source RGB vectors to create a third "resultant vector" that is an intuitive mix of the first two.

Ideally, I would be able to emulate "real paint mixing characteristics", but for simplicity, I am trying to find a method where the resultant looks intuitively like what you'd get from combining the two source rgb's.

minimally, these characteristics:
RED + BLACK = DARK RED
RED + WHITE = LIGHT RED

optimally, also with real paint characteristics:
RED + BLUE = PURPLE
RED + YELLOW = ORANGE
(etc)

--

I am currently doing this the "lazy way" by adding the two source RGB vectors/255, then normalizing (and multiplying by 255). So, using this: [Red = <1,0,0> * 255] + [Blue = <0,0,1> * 255] gives Magenta=<1,0,1>/sqrt(2) * 255, though the other colors are less intuitive or even visible... I need a better method! Please help :-)

Answer

John picture John · Dec 12, 2009

Is what you suggested the same as a weighted average?

Average R = w1*R1 + w2*R2 + w3*R3 + ... + wn*Rn

Average G = w1*G1 + w2*G2 + w3*G3 + ... + wn*Gn

Average B = w1*B1 + w2*B2 + w3*B3 + ... + wn*Bn

The w's are the weighting fractions and the sum of them is 1.

R1 is the red component of the first color to mix, for example.

So if you wanted to mix two colors evenly, it would be:

Average R = 0.5*R1 + 0.5*R2

Average G = 0.5*G1 + 0.5*G2

Average B = 0.5*B1 + 0.5*B2

As for mapping the resultant color to a named color ("dark red") maybe just do a lookup table and pick the closest one?