If I have one color (colorOne) for which I know the RGB values, and another color (colorTwo) for which I know the RGBA values, how do I calculate the color I would get if I “painted” colorOne with colorTwo, as though colorTwo was a “layer” on top of colorOne, with A being the transparency of the layer? I tried Mathf.Lerp(colorOne.r, colorTwo.r, colorTwo.a), etc. but it’s not giving me the results I expect–some colors are right and others are not.
alpha-blend
//out = alpha * new + (1 - alpha) * old
result = c2.a * c2.rgb + (1 - c2.a) * c1.rgb;
Depends on what you mean by painted. I’m guessing you mean blend two colors additively.
public Color c1, c2, result;
void Update() {
result = c1 + c2;
}