









 
 




 
 


Here is the code I use for working with HCY in Processing, I know this
isn't SDL but I do not at present have time to convert it and I thought
someone might find it useful.
For me it is wonderful because using only one array I can get the range and
intensity of colors I want far more easily than I can with other models, I
just pipe it into H and set C and Y to the value below...though it really
gets interesting when you plug other arrays into Y in particular. That
works out very well for 2 chemical RD systems obviously, which is what I
use it for.
// H Varies
// C = 100 [gives full brightness]
// Y = 75 or varies. [gives full saturation]
public color HCYtoRGB(float h, float c, float y)
{
final PVector REC709y = new PVector(0.2126, 0.7152, 0.0722);
PVector hcy = new PVector(h, c, y);
float r = constrain(abs(6 * h  3)  1, 0, 1);
float g = constrain(2  abs(6 * h  2), 0, 1);
float b = constrain(2  abs(6 * h  4), 0, 1);
PVector rgb = new PVector(r, g, b);
float z = rgb.dot(REC709y);
if (z >= hcy.z)
{
hcy.y *= hcy.z / z;
}
else if (z < 1)
{
hcy.y *= (1  hcy.z) / (1  z);
}
rgb.sub(z, z, z);
rgb.mult(hcy.y);
rgb.add(hcy.z, hcy.z, hcy.z);
rgb.mult(255);
return color(rgb.x, rgb.y, rgb.z);
}
I hope this is useful to someone. Have fun. :)
I have a render (Processing not Pov) of the predatorprey RD system by
Sirohi et. al. 2015 which will go up on Flickr soon which uses this.
Ian
Post a reply to this message


 
 




 
 


On 11/26/2016 1:23 PM, [GDSEntropy] wrote:
> Here is the code I use for working with HCY in Processing, I know this
> isn't SDL but I do not at present have time to convert it and I thought
> someone might find it useful.
>
> For me it is wonderful because using only one array I can get the range and
> intensity of colors I want far more easily than I can with other models, I
> just pipe it into H and set C and Y to the value below...though it really
> gets interesting when you plug other arrays into Y in particular. That
> works out very well for 2 chemical RD systems obviously, which is what I
> use it for.
>
> // H Varies
> // C = 100 [gives full brightness]
> // Y = 75 or varies. [gives full saturation]
> public color HCYtoRGB(float h, float c, float y)
> {
> final PVector REC709y = new PVector(0.2126, 0.7152, 0.0722);
> PVector hcy = new PVector(h, c, y);
>
> float r = constrain(abs(6 * h  3)  1, 0, 1);
> float g = constrain(2  abs(6 * h  2), 0, 1);
> float b = constrain(2  abs(6 * h  4), 0, 1);
>
> PVector rgb = new PVector(r, g, b);
>
> float z = rgb.dot(REC709y);
>
> if (z >= hcy.z)
> {
> hcy.y *= hcy.z / z;
> }
> else if (z < 1)
> {
> hcy.y *= (1  hcy.z) / (1  z);
> }
>
> rgb.sub(z, z, z);
> rgb.mult(hcy.y);
> rgb.add(hcy.z, hcy.z, hcy.z);
>
> rgb.mult(255);
>
> return color(rgb.x, rgb.y, rgb.z);
> }
>
> I hope this is useful to someone. Have fun. :)
>
> I have a render (Processing not Pov) of the predatorprey RD system by
> Sirohi et. al. 2015 which will go up on Flickr soon which uses this.
>
> Ian
>
I have never heard of HCY. Is there any documentation about it?
Mike
Post a reply to this message


 
 




 
 


Am 26.11.2016 um 19:23 schrieb [GDSEntropy]:
> // H Varies
> // C = 100 [gives full brightness]
> // Y = 75 or varies. [gives full saturation]
That doesn't seem plausible. "C" is typically used for "Chroma" (a
saturationrelated value), and "Y" for luminance (or, occasionally,
Luma, though "Y'" would be a more appropriate designation).
Post a reply to this message


 
 




 
 


clipka <ano### [at] anonymousorg> wrote:
> Am 26.11.2016 um 19:23 schrieb [GDSEntropy]:
>
>> // H Varies
>> // C = 100 [gives full brightness]
>> // Y = 75 or varies. [gives full saturation]
>
> That doesn't seem plausible. "C" is typically used for "Chroma" (a
> saturationrelated value), and "Y" for luminance (or, occasionally,
> Luma, though "Y'" would be a more appropriate designation).
>
>
My observation which resulted in the comment on the method was based on the
way it behaved in a very specific context based on the funky stuff I was
doing to the arrays where I was using it, and was more of a note to help me
figure out what was happening in that specific case (and that was the file
I snagged it from).
I probably should have removed that bit honestly to avoid confusion, so my
bad there, I don't have my head on straight right now, as I haven't been
able to sleep for the last three days, and it has more than caught up with
me. I am so tired. :(
The source for the snippet above is from below (if you aren't familiar with
the Processing site the source view icon looks like this: </> and pops up
if you hover your mouse at the top of the screen):
www.openprocessing.com/sketch/306463
In their source there are a number of links, I included some here lower
down.
This page is included in their references and contains some info:
www.wolthera.info/?p=726
The Processing snippet is itself a variation of code found below:
www.chilliant.com/rgb2hsv.html
(From the link above)
Converting HCY to RGB
// The weights of RGB contributions to luminance.
// Should sum to unity.
float3 HCYwts = float3(0.299, 0.587, 0.114);
float3 HCYtoRGB(in float3 HCY)
{
float3 RGB = HUEtoRGB(HCY.x);
float Z = dot(RGB, HCYwts);
if (HCY.z < Z)
{
HCY.y *= HCY.z / Z;
}
else if (Z < 1)
{
HCY.y *= (1  HCY.z) / (1  Z);
}
return (RGB  Z) * HCY.y + HCY.z;
}
Hopefully this helps.
Ian
Post a reply to this message


 
 




 
 


Mike Horvath <mik### [at] gmailcom> wrote:
> I have never heard of HCY. Is there any documentation about it?
>
> Mike
>
I don't know if you saw my other post, but I included the links referenced
by the source of that method.
This page goes over many different models, and there is some chart they
made with markers as well that is of unknown veracity.
www.wolthera.info/?p=726
Do let me know what conclusion you come to, because I am not well versed in
color models, and find HCY to be very intuitive, easy to use and that it
gets the exact results I am looking for.
These next few links show the output of a Sirohi RD system using HCY, which
is very different than he precise same inputs to HSB;
Movie, Flickr did some unfortunate compression on (the stills are of better
quality):
https://m.flickr.com/#/photos/gdsentropy/31157486571/
Frame 2000:
https://m.flickr.com/#/photos/gdsentropy/30438914664/
Frame 400:
https://m.flickr.com/#/photos/gdsentropy/30438884034/
How far from HCL is this? It behaves quite differently from other models
from what I can tell.
Ian
Post a reply to this message


 
 




 
 


On 11/29/2016 12:16 AM, [GDSEntropy] wrote:
> Mike Horvath <mik### [at] gmailcom> wrote:
>> I have never heard of HCY. Is there any documentation about it?
>>
>> Mike
>>
>
> I don't know if you saw my other post, but I included the links referenced
> by the source of that method.
>
> This page goes over many different models, and there is some chart they
> made with markers as well that is of unknown veracity.
> www.wolthera.info/?p=726
>
> Do let me know what conclusion you come to, because I am not well versed in
> color models, and find HCY to be very intuitive, easy to use and that it
> gets the exact results I am looking for.
>
> These next few links show the output of a Sirohi RD system using HCY, which
> is very different than he precise same inputs to HSB;
>
> Movie, Flickr did some unfortunate compression on (the stills are of better
> quality):
> https://m.flickr.com/#/photos/gdsentropy/31157486571/
>
> Frame 2000:
> https://m.flickr.com/#/photos/gdsentropy/30438914664/
>
> Frame 400:
> https://m.flickr.com/#/photos/gdsentropy/30438884034/
>
> How far from HCL is this? It behaves quite differently from other models
> from what I can tell.
>
> Ian
>
A couple of comments:
1. If she doesn't provide conversion formulas, I can't do much with it.
2. If it's an entirely new thing without being published in a scientific
or technical journal, then Wikipedians will probably notice and delete it.
Mike
Post a reply to this message


 
 




 
 


Mike Horvath <mik### [at] gmailcom> wrote:
> A couple of comments:
>
> 1. If she doesn't provide conversion formulas, I can't do much with it.
> 2. If it's an entirely new thing without being published in a scientific
> or technical journal, then Wikipedians will probably notice and delete it.
>
> Mike
>
The page www.chiliant.com/rgb2hsv.html provides code that you could get
formulas out of, and I am looking for any papers on the subject.
It also has code for HCL, which are quite different.
I know that is a far cry from peer reviewed work but I an looking for that,
and will let you know if I find it.
In the mean time it might be useful to check out that link, it is possible
that if it is utter bunk someone familiar with the subject may be able to
spot it quickly.
Ian
Post a reply to this message


 
 




 
 


In my attempt to locate documentation about HCY, I found out there are
about 15 more color models than I had any idea existed, found huge volumes
of code for conversion between them all, and downloaded it all. :p
Apparently Hcy was invented by a guy named Kazuma Shapran, and he is
impossible to find an email address for.
The following has everything plus many I have never heard of, just no HCY
http://scijs.net/colorspace
github.com/scijs/colorspace
I found once called HSI, which does seem to have some backing in academia,
though to what degree I do not know:
cs.umb.edu/~marc/cs675/cvs0917.pdf
There are other such documents.
Here is another one with a huge list of models, some not found in scijs
(this does have HCY):
github.com/acterhd/deathcolor
This person has some degree of documentation for som of the models as well.
github.com/portnov/colorpalette
russellcottrell.com/photo/colorTransformer2.html
This is all I could find of even marginal use.
At least I now have many new models to use in my RD art, regardless of
their mathematical veracity. It doesn't matter so much for that though. ;)
Who knows, maybe someone will find this useful.
Ian
Post a reply to this message


 
 




 
 


On 1122016 19:30, [GDSEntropy] wrote:
> At least I now have many new models to use in my RD art, regardless of
> their mathematical veracity. It doesn't matter so much for that though. ;)
LOL
I find all these discussions about colour space highly interesting and
curious, but totally useless for what I am doing. ;)

Thomas
Post a reply to this message


 
 




 
 


Thomas de Groot <tho### [at] degrootorg> wrote:
> On 1122016 19:30, [GDSEntropy] wrote:
>> At least I now have many new models to use in my RD art, regardless of
>> their mathematical veracity. It doesn't matter so much for that though. ;)
>
> LOL
>
> I find all these discussions about colour space highly interesting and
> curious, but totally useless for what I am doing. ;)
>
They are all very useful to me, just not for PovRay.
The RD algorithms I make and/or use are sometimes very difficult to color
in a pleasing way, and having many color conversion methods available makes
this much easier.
Ian
Post a reply to this message


 
 




 

