Blending paint again

Further to my question regarding paint type blending, can I use glBlendFunc() to do the blending?

I’m still not convinced about CMY blending. I always thought that the primary paints were Red, Blue and Yellow. What I want is something that works like paints do, as opposed to coloured filters.

I accept that a blue and yellow filter placed together transmit no light, ie black, but blue and yellow paint mixed doesn’t make black (not where I come from anyway )

Hope someone can set me straight here!


I have the same problem.

The RGB method seems all wrong when it comes to blending colors to produce real world results.

Using RGB you will get the most contrast out of the triplet, because human eyes are more perceptible to green. But this has resulted in cartoon like colors instead of a nice real world shade of grey and bluish brown.
( Must be achieved with specific texturing and lighting )

The RGB blending is a good choice for maximising color output, but we really should have an OpenGL method of using RYB if we want to. (Is there a OGL way?)

RGB blending
Blue + Green = Yellow ?? Uekk.
Yellow + Blue = Cyan?
Green - blue = (0,1,-1)??
Green - Yellow = (0,1,0) - (0,1,1) = (0,0,-1)?

RYB blending
Blue + Green = Bluish green (0,1,2) = (0,0.5,1)
Yellow + Blue = Green (0,1,1)
Green - blue = Yellow (0,1,0)
Green - Yellow = blue.(0,0,1)

And so on.
(Correct me if I am wrong)

RGB blending

these should be:

Blue + Green = Cyan
Yellow + Blue = White (Red+Green=Yellow)

Green - blue = (0,1,-1)??
Green - Yellow = (0,1,0) - (0,1,1) =(0,0,-1)?

Not sure what you’re trying to do here.


Yes, thanks on the RGB blending.

Well the operations:

Green - Blue = Yellow
Green - Yellow = Blue

Is the real world subtraction of colors,
the reverse order of blending yellow and blue to get green.

This is important when trying to implement real world blending of colors.

As for now, I think I have to write my own color functions that does this in RGB mode.

Actually, if you treat the negative blue component as a mirror of the positive red component, you can achieve the correct blending.
Green - Blue = (0,1,-1) -> (1,1,0)
Green - Yellow = (-1,0,0) -> (0,0,1)

[This message has been edited by Hull (edited 05-10-2001).]

[This message has been edited by Hull (edited 05-10-2001).]

Sorry for screwing up all those color calculations, I am actually thinking about multiple color schemes all at once.

My own implementation is just trying to produce real world blending by treating blue and red as eachothers inverses:

Blue + Yellow = Green (in real world)

Achieved by interpret blue as the inverse color = negative red.

(-1,0,0) + (1,1,0) = (0,1,0)

[This message has been edited by Hull (edited 05-10-2001).]

This is how I want my colors to blend:

It looks to me like you want to use subtractive color mixing (the mixing of pigments) rather than additive color mixing (the mixing of colors of light.)

Here’s a java applet I found that lets you switch between the two mixing types:

I don’t really know much beyond that, but the above java applet I got from a search, searching on “paint color mixing”. I’m sure that within a 30 minutes or less of searching you’d be able to locate the math/logic/settings to achieve this on your own. I also just found quite a bit with a search using “additive color mixing opengl”.

Hope that helps.

Yeah, well its not the RGB blending that bothers me, its that I want to blend using the real primary colors of Green Yellow and Blue. Not Cyan, Magenta and Yellow.

I dont want my polygons to interpolate between yellow and blue , producing white, but I want yellow and blue to interpolate so that the they produce green.

Using CMY just doesnt cope it. The colors are all wrong.

Is there a way for me to tell GL to blend from Yellow to Blue creating green instead of white, without using the CMY approach.

Or am I completely wrong in saying that Yellow and Blue mix into green in real world?

Sorry about all this fuzz about colors :stuck_out_tongue:

I gave it some thought and research, but I’m still stumped. You can check out and for some interesting discussion of colours, including RYB vs. RGB. It still didn’t help me get to a conclusion of how RYB works. It’s a fascinating subject, but I hope that you’ll forgive me if I don’t continue researching it.

BTW, I think that most of the online examples of RYB aren’t correct. You just can’t get light green from blue and yellow. You get dark green, since blue is much darker than green. Light blue is actually (in RGB) blue with a lot of green - RGB(0,0.5,1) and even RGB(0,0.8,1). It really starts feeling like cyan only when green is almost saturated.

The difficulty for me in concluding anything from such observations is that the colour scales (intensities) aren’t linear, so I can’t really compare 0.5 and 0.8 values for green - the latter is not “60% brighter” but actually more than twice as bright. This non-linearity means that I can’t really think of RYB and CMY as two bases for the same linear space, which would likely have helped draw some conclusions.

I know what you are up against, I have been trying to find solutions to this for many days now, without finding anything but the statement that ‘we use Red Green and Blue as primary colors’.

I will give this up for now aswell, and revert to careful texturing and controlled lighting, because lets face it, you just cant alter the way video graphics have been manufactured.

But one of these days, RGB wont suffice for real time rendering anymore, because of the problems with color blending as described. But thats way in the future, and then we are probably using quaternions instead of RGB pixels. (ColorShperes).

Oh, and that article about Green being White, is pure nonsense, the guy is trying to use the false, RGB method to explain hue in the RYB spectra. He places white between blue and yellow because there is where green will emerge, whereas in the RGB method, white will emerge. RGB vs RYB is simply a matter of which color goes to what axis.
I would, as an artist, prefer RYB. But that seems just to be a dream.

[This message has been edited by Hull (edited 05-11-2001).]

Hull, I don’t think that “RGB vs RYB is simply a matter of which color goes to what axis”. If this was true, then RGB and RYB would be equivalent representations of the same colour space, which they aren’t. RYB can produce more limited colours than RGB. The axis representation is more a convenience than a mathematical description of colour, IMO.

About the “green is white” article, I do think he’s got a point, even though I think he got carried away a little. At least in RGB, green contributes more to brightness than red and blue combined. Light blue in RGB is actually more green than blue (in terms of brightness, not RGB value). So there seems to be some value to this observation.

[This message has been edited by ET3D (edited 05-12-2001).]

One thing to take into consideration which may help is the concept of dilluting(sp). When you have pure blue paint, it absorbs all of the red and yellow. Now, if you add an equal amount of white paint to it, you still have the same amount of blue pigment, but it is spread out half as thin so it absorbs less red and yellow photons than pure blue paint would, giving you light blue. Likewise, adding an equal amount of black paint to blue would provide the same density of red and yellow absorbing pigments, but would add some blue absorbing pigments, giving a dark blue.

Thinking of what LordKronos is saying, I’m starting to really believe in that “white is green” (or is it “green is white” :slight_smile: stuff.

In RGB, you take blue, add green and you get light blue. Similarly, you take red+blue (violet), add green and you get pink.

Maybe there’s something to be learned from this.

You might be right, Lord of the Time.

That’s it.
Im taking out the prisms.

Time for some serious empirical studies.

Now how do I get that blue umbra …

Thanks everyone for your input to this problem. I too am not really happy with the CMY scheme, although it may be more versatile in many ways.

At least I’m not alone in being able to figure out even an imperfect RYB blending alorithm. I’m sure there MUST be one somewhere, otherwise custom paint manufacturers must waste a lot of monet, whoops, money

I suppose I’ll have to go for some other blend mechanism in the meantime.


BTW, there’s something that bothered me in LordKronos’ description, and that’s the talk of yellow, red and blue photons. After all, what light is a combination of all wavelengths from violet to red, not just three wavelengths. Our perception combines wavelengths into colours represented by other wavelengths, for example green and red into yellow. Knowing what wavelengths a painter’s colour really reflects might help in understanding the result of mixing them. Or maybe understanding how our eyes perceive colour (there’s a diagram in Foley et all - not too precise, but may be worth studying) might help.

Magenta sure is an interesting color.

It is a blend of red and blue (RYB method) but in the spectra of light, there is no such color, because beyond blue there is ultraviolet, and beyond red there is infra red. Magenta is therefore something like an ‘open’ color, and could actually be any of the colors we cannot percieve.
(I actually tried a colorcircle using 3 new colors instead of magenta, namely ultra, hypra and infra. The complement of each color then yielded magenta, instead of brown)

Blending of colors should not be represented by a 3 dimensional vector, placing 3 basic hues on each axis.
A color would rather be represented by a point within or on the surface of a ColorSphere.

All the hues, except white and black lie on the equator of the sphere surface, and there will be two poles, one black and one white.
The major hues will be placed simply by specifying a angle range from 0 to 360 for each of them. Assume red, orange, yellow, green, cyan, blue and magenta as basic hues.

To simplify the current [0.0 - 1.0] range in the 3 dimensional color of todays RGB hardware, we put the white pole at (1,1,1) and the black pole at origin (0,0,0), we would still have all the greyscales at the center axial line { (0,0,0) to (1,1,1) ).

The sphere could then be rotated around its center axis and produce color rotation for all current set color values.

We still use a 3 dimensional color value, but the colors are perfectly blended throughout the interior and the surface of the sphere, creating all possible mixes of color.

Now all we have to do is to put the hues in a specific order on the equator, and this could be USER DEFINED. Allowing us to create our own spectras.

If blending paint and blending light should be handled differently, just change the spectra.

I would love the gl_ext_colorsphere_spectra extension that would allow this.


// Place a color on the equator
gl_ext_colorsphere_spectra(GL_SPECIFY, GL_RED, (GLfloat)angle);
// Set the default RGB spectra.
// Set the complement of a color.
// Rotate the colorsphere for the current primitives to draw.
// and so on.

Just some dreams of mine, and maybe an important part of the future.

[This message has been edited by Hull (edited 05-14-2001).]

I think that you meant to say that Magenta is blue plus red in RGB. You can’t get it in RYB, nor can you get cyan (RGB blue+green). In RYB you get purple.

What you suggest about the colour sphere could possibly be done using an env map. The main problem, of course, is how to actually do the blending of these colours. You just moved the RYB blending problem to the drivers

Exactly, and it is the drivers task to provide what we desire (and the market for craving the new cool products, and think about all that money they would make, providing the very first RYB extension. 'Maybe I will mail ATI. ’ ).

Well, RYB in the fashion of RGB is just a way of moving the focus of Green to Yellow in the color spectra, you would still be able to create all the colors you could with RGB in RYB. The problem is that we loose some of the precision between green and blue, where the human eye is the most sensitive about hue.
So we would actually LOOSE some color by using RYB, but the gains in letting us do this would be potentially humongus.
I personally believe that using RYB would create more realistic colorblending in many cases.

Note that I actually don’t know if this is doable in hardware today, due to the raygun set of blue,green and red. Maybe we need blue, yellow and red raygun hardware aswell.

It would be possible to simulate though.

I is possible to simulate, and there’s even a product somewhere that does it (forgot its name). But I just wish I knew how. It’s not that easy. For one, you can’t really create all RGB colours in RYB, so they are not equivalent spaces. Like I mentioned before, magenta and cyan aren’t in the RYB space. And the selection of RGB for the phosphors is because our eyes have receptors for these colours.

Still, it’s obviously possible, since someone managed to produce software that can do it.