Discussion:
Color range question
(too old to reply)
Bint
2013-12-17 21:09:35 UTC
Permalink
Raw Message
Hello, this is more of a math question,but maybe someone here can answer it.

I have an openGL circle which is a fan of triangles. The colors at each
point on the circle run around the spectrum in hue, so it is like a big
rainbow wheel.

Now, because of the way openGL interpolates the colors, the color range does
not look the way I want. For example, there's a lot more green than yellow,
and hardly any orange.

I was just wondering if there is a simple kind of equation that would let me
choose a few points on this range and "pump" them up, or maybe choose others
to "pinch" so that they take up less room on the wheel.

Maybe just a bunch of if then statements which re-scale specific value using
a simple x*x curve or something -- but I thought I would ask to see if
someone had a better idea.

Thanks
B
Andy V
2013-12-17 22:48:20 UTC
Permalink
Raw Message
Post by Bint
Hello, this is more of a math question,but maybe someone here can answer it.
I have an openGL circle which is a fan of triangles. The colors at each
point on the circle run around the spectrum in hue, so it is like a big
rainbow wheel.
Now, because of the way openGL interpolates the colors, the color range does
not look the way I want. For example, there's a lot more green than yellow,
and hardly any orange.
Change the interpolation to what you want it to be, using a shader program. There are lots of examples on the web.
--
Andy V
Leclerc
2013-12-19 09:47:00 UTC
Permalink
Raw Message
Hi,
Post by Bint
Now, because of the way openGL interpolates the colors, the color range does
not look the way I want. For example, there's a lot more green than yellow,
and hardly any orange.
(in addition to Andy's answer)

You should be aware that color interpolation in RGB colorspace results
in "nonlinear" color change. In order to achieve "expected" results,
convert end values to HSV, do interpolation in HSV colorspace, and
convert interpolated results back to RGB.

Loading...