I’m looking for an algorithm to do additive color mixing for RGB values.
Is it as simple as adding the RGB values together to a max of 256?
(r1, g1, b1) + (r2, g2, b2) = (min(r1+r2, 256), min(g1+g2, 256), min(b1+b2, 256))
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It depends on what you want, and it can help to see what the results are of different methods.
If you want
then adding with a clamp works (e.g.
min(r1 + r2, 255)) This is more like the light model you’ve referred to.If you want
then you’ll need to average the values (e.g.
(r1 + r2) / 2) This works better for lightening/darkening colors and creating gradients.