Sorry in advance about my way of expressing this - I am not really a math person to be fair. However, I have been pretty obsessed with an idea I got and that idea requires me to understand something about color mixing in the real world. It turns out that what I want to do is not trivial (to me at least).
Some context: Imagine you're an artist and you want to paint your own Mona Lisa. To do this you have a reference photo of the real Mona Lisa. You have sketched an outline of the sections of where the colors will go and it is time to color it. There's only one problem - You're a noob and you don't know how to achieve the target colors. The target color is a brown nuance based on a shadow near her eye: R:114 G:78 B:42
You have several factory-mixed and known industry colors:
Cadmium Red: R:227 G:0 B:34, Cadmium Yellow: R:255 G:246 B:0, Titanium White: R:243 G:244 B:247, Ivory Black: R:35 G:31 B:32, Burnt Umber: R:127 G:50 B:36, Cobolt Blue: R:0 G:71 B:171, Phtalo Blue: R:0 G:15 B:137, and a few others..
If you take an amount of Cadmium Yellow and mix it with an equal amount of Burnt Umber then you end up changing the RGB. It [originally cadmium yellow] now has a new RGB after being mixed with Burnt Umber. relative to the first amount of cadmium yellow, R is reduced, G is reduced even more and B is increased slightly.
I can visually approximate a target color by mixing it intuitively. With different colors, there is some mix-ratio of those colors that will produce the target color. I want to know, how to know that ratio!
I know that there are several things in play here, as the amount of resin/color pigments, etc., but let's assume that I can figure out to compensate for that myself at some later point if I get that far. My problem seems to be, to figure out how some physical color with a given RGB interacts with another physical color with another RGB and how that interaction manifests in the RGB of the mixture.
It doesn't have to be RGB by the way if some other system makes this easier.
Question: How can I figure out what ratio to mix colors to achieve a target color (or visually approximating it at least)?
I don’t know how mixing of paints works in the real world, but let’s assume it follows the obvious mathematical rules.
Suppose you have four ingredient colors $(r1, g1, b1)$, $(r2, g2, b2)$, $(r3, g3, b3)$, and $(r4,g4,b4)$, and you want to produce a target mix color $(r0, g0, b0)$.
Then you need to find four proportions $p1$, $p2$, $p3$, $p4$ such that $p1 + p2 + p3 + p4 = 1$ and $$ p1*(r1, g1, b1) + p2*(r2, g2, b2) + p3*(r3, g3, b3) +p4*(r4,g4,b4) = (r0, g0, b0) $$ This gives you four linear equations that you will (perhaps) be able to solve to get $p1$, $p2$, $p3$, $p4$.
I say “perhaps” because the four equations might not have a solution. You’ll need to read about systems of linear equations to understand the when and why. It boils down to whether or not your ingredient colors are sufficiently rich and varied to “span” the entire $(r,g,b)$ color space.
If you only have three or fewer ingredient colors, there’s only a small chance that you’ll be able to get the target color you want. You might be lucky, but probably not.
Another way to think of this: your four ingredient colors are the vertices of a tetrahedron in a three-dimensional $rgb$ space. What we’re looking for are the so-called “barycentric coordinates” of the target color within this tetrahedron. This will work only if the tetrahedron has non-zero volume (i.e. it’s not squashed to a plane, or worse). The non-zero volume corresponds to the four ingredients being “rich and varied”, as I mentioned above. You probably don’t know what I’m talking about, but you can look up barycentric coordinates, at least.