Author Topic: Proper color mixing  (Read 1131 times)

2024-01-02, 09:25:05

Smetz

  • Active Users
  • **
  • Posts: 10
    • View Profile
I am trying to get proper primary color mixing working.   I have been experimenting for the past several hours but cannot get primary colours to mix in render.   Is this a limitation of graphic processing?    I have attached an image and scene file.   I want the red and yellow to create a nice orange, the blue and red circles overlapping to create a nice purple etc.   With some playing with settings I can get a bit of orange between red and yellow but nothing near proper color mixing.   I tried this with Redshift renderer as well and failed. 

Any ideas how a renderer could achieve this?  Am I missing a setting?  Thanks for any thoughts! 

2024-01-02, 10:20:23
Reply #1

romullus

  • Global Moderator
  • Active Users
  • ****
  • Posts: 8854
  • Let's move this topic, shall we?
    • View Profile
    • My Models
It depends on what you're trying to achieve. If you want to mix colours on material level, then that's easy, you just need to mix different colours in additive blend mode. On the other hand if you want to mix colours that are on the different meshes, then i don't think it's possible to do that in renderer, because the only blend option that's available to you is mix, which will not work the way that you want. I might be wrong at the second method, but that's my understanding about this from my experience. Attaching the proof that first method is working perfectly in Corona.
I'm not Corona Team member. Everything i say, is my personal opinion only.
My Models | My Videos | My Pictures

2024-01-02, 10:24:54
Reply #2

James Vella

  • Active Users
  • **
  • Posts: 540
    • View Profile
Also just to add to what romullus said, I assume you know this but better to check anyway, traditional color mixing (red/blue/yellow) is subtractive, when working in screen space its additive (red/green/blue).

2024-01-02, 11:06:36
Reply #3

Beanzvision

  • Corona Team
  • Active Users
  • ****
  • Posts: 3873
  • Bengamin
    • View Profile
    • Cormats
Also echoing what others have said, here's how's it don in C4D ''material-wise'' https://forum.corona-renderer.com/index.php?topic=41178.msg217911#msg217911, but for individual meshes, perhaps some splicing and material selection tags could be a way to go?

Bengamin Jerrems l
Portfolio l Click me!

2024-01-02, 17:34:24
Reply #4

Smetz

  • Active Users
  • **
  • Posts: 10
    • View Profile
Thank you for the thoughtful replies.  Yes, I am trying to achieve color mixing through separate translucent or refractive meshes.   As I look now at real world examples I don't think this achievable even with real coloured glass. 

Thanks again!

2024-01-02, 17:52:41
Reply #5

maru

  • Corona Team
  • Active Users
  • ****
  • Posts: 12768
  • Marcin
    • View Profile
Also echoing what others have already said ;)
Remember about additive mixing (lights) and subtractive mixing (things like colored glass).
Also, effects like this are extremely sensitive to tone mapping and color spaces. So if you are getting some unexpected results, disabling the ACES OT tone mapping operator in the VFB might help, or using basic color management instead of OCIO.

(sorry for the 3ds Max screenshots, but it should work pretty much the same in C4D)
Marcin Miodek | chaos-corona.com
3D Support Team Lead - Corona | contact us

2024-01-03, 10:58:54
Reply #6

Beanzvision

  • Corona Team
  • Active Users
  • ****
  • Posts: 3873
  • Bengamin
    • View Profile
    • Cormats
Faking it with individual meshes might be the way to go ;) Here I've used translucency but the same can be done with colored glass. ;)

Bengamin Jerrems l
Portfolio l Click me!

2024-01-05, 17:29:17
Reply #7

pokoy

  • Active Users
  • **
  • Posts: 1865
    • View Profile
The amount of complete or partial misinformation in this thread hurts my tiny brain. Don't want to come across as a smartass but we just can't let this pass, can we? :D
@OP - this is possible, with some limitations which I'll outline below.

First - what's the difference between the additive and subtractive mode?

Think of it that way: what's your starting condition? If your starting condition is, for example, a black screen, then you'll only be able to display colors by emitting light (adding energy). By using red, green and blue as your primary colors these ADD up in varying intensities to produce a certain color. The primary colors used in this model are R, G, B, hence the RGB model name.

If your starting condition is a white sheet of paper, then your starting condition is (ideally) white - from which you now will need to subtract colors by using either a dye or filters. This however needs different primaries than with the additive model - cyan, magenta and yellow. Each of these dyes/filters will now SUBTRACT (absorb) energy with varying densities, producing a certain color. The primary colors used in this model are C, M, Y, hence the CMY model name.

We'll now use these color definitions throughout the examples:

Red (R) = RGB 1/0/0
Green (G) = RGB 0/1/0
Blue (B) = RGB 0/0/1

Cyan (C) = RGB 0/1/1
Magenta (M) = RGB 1/0/1
Yellow (Y) = RGB 1/1/0

Here's a render for the additive RGB model, where 3 lights use red, green and blue filters and produce a white color where their light 'cones' overlap on a white plane:



The setup in Max:



Note how the secondary colors produced by red, green and blue filters are cyan, magenta and yellow > the primaries used in the subtractive model. White is the result where they overlap.

Now for the subtractive model, here's a render of that one. White light passes through cyan, magenta, yellow filters (they're offset a bit to avoid coplanar faces) and finally reach a white plane:



The setup in Max:



Note how the secondary colors produced by cyan, magenta and yellow filters produce red, green and blue > the primaries used in the additive model. Now the funny thing is that where they overlap the color should - in theory - be black, but it isn't. It's a brown muddy color instead, and this is also what happens in reality. Corona produces a slightly lighter color here than what happens in reality but it's still pretty accurate. This is a limitation of the CMY model and also the reason why in printing there's an additional black color, named 'K', and the resulting color model is CMYK and is used in printing (offset, inkjet, laser printers all use these dyes/colors). This is the limitation of the CMY model which I've mentioned at the beginning of the post.

Now for your orange color. Let's fire up PS (or any other app supporting CMYK color mixing) and open the color mixer. A typical orange would be CMYK 0/60/100/0, which would be RGB 239/124/0. This means for CMY you only need the magenta and yellow component, in RGB only red and green.

Let's produce and orange color for the additive model:
Set up two materials for the filters to be placed in front of the lights, so that for the red filter you define a RGB 239/0/0 color, for the green filter you define a RGB 0/124/0. Place each of these in front of a white light respectively, the color produced on the white plane should now be orange. (Note - technically, you should be able to just use these colors on two lights with the same intensities, they *should* mix up to orange... for some reason they don't and I'm not sure white. The result is yellow and only turns orange if I really decrease the exposure a lot...)

Result:




For the subtractive model the setup is a bit different:
For the magenta filter, we need it at 60 perc density > use a mix node with a white color as the base and a magenta layer on top - now set the opacity of the magenta color to 60. White is the base because white is the starting condition for the subtractive model, and adding a 100% magenta color with an opacity of 60 results in 60% magenta as needed by the orange color we defined above.
For the yellow filter, use the yellow color defined above, it needs 100% density so we don't need to change it.

Result:



For the filter material, you can use the filter colors in thin absorption mode, however this will not account for object thickness which might not be looking too good if your object's aren't just a thin plane. For anything more realistic, use the filter colors in the volumetric absorption channel (and scattering if needed) of the material and set absorption distance to a meaningful value based on the thickness of the geometry the light is passing through.

If you want to produce other CMY colors, here's a handy online converter to convert from RGB to CMY - http://colormine.org/convert/rgb-to-cmy
The CMY results are in a 0-1 range. If a color has 3 components, you will need all 3 filters - cyan, magenta and yellow. This is different from the orange tone we produced, this one needed only 2.

The theory behind all that is much more complicated. Visible light is not just a sum of R, G and B components, that's just a model that our body/brain happens to use to see and represent colors. Both the RGB and CMY model are just *models* but since they're part of the same spectrum each model can be used to represent the other to some degree - we've used what's technically a strictly additive RGB model (emitting screen with software that works with RGB primaries) to somewhat accurately represent what happens in a CMY model. Since each of the models produces the other model when you mix its primary colors, they are theoretically interchangeable. However, in reality each color represents only a narrow band within the visible spectrum, leaving some inaccuracy on its tails - that's why it's really hard to mix these three colors in reality and get a clean saturated result.

That's why you won't be able to reproduce all colors in CMY. Darker colors will always tend to get a brownish muddy tint and when they overlap, they still won't absorb light completely. There's a ton of technical stuff on the internet for further reading if you're interested in why that is.

EDIT
Not sure why the forum won't display images hosted on my site, giving up now. You can open them with a right click in a new tab/window, I also attached them to the post.
« Last Edit: 2024-01-06, 23:02:31 by pokoy »