POV-Ray : Newsgroups : povray.advanced-users : With all the talk of color, HCY Server Time
22 Dec 2024 10:39:54 EST (-0500)
  With all the talk of color, HCY (Message 1 to 10 of 10)  
From: INVALID ADDRESS
Subject: With all the talk of color, HCY
Date: 26 Nov 2016 13:23:53
Message: <1009395818.501876922.648497.gdsHYPHENentropyAThotmaolDOTcom@news.povray.org>
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 predator-prey RD system by
Sirohi et. al. 2015 which will go up on Flickr soon which uses this.

Ian


Post a reply to this message

From: Mike Horvath
Subject: Re: With all the talk of color, HCY
Date: 26 Nov 2016 16:30:10
Message: <5839fee2$1@news.povray.org>
On 11/26/2016 1:23 PM, [GDS|Entropy] 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 predator-prey 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

From: clipka
Subject: Re: With all the talk of color, HCY
Date: 26 Nov 2016 17:17:44
Message: <583a0a08$1@news.povray.org>
Am 26.11.2016 um 19:23 schrieb [GDS|Entropy]:

> //    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
saturation-related value), and "Y" for luminance (or, occasionally,
Luma, though "Y'" would be a more appropriate designation).


Post a reply to this message

From: INVALID ADDRESS
Subject: Re: With all the talk of color, HCY
Date: 27 Nov 2016 06:24:47
Message: <2003181370.501936406.039474.gdsHYPHENentropyAThotmaolDOTcom@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> Am 26.11.2016 um 19:23 schrieb [GDS|Entropy]:
> 
>> //    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
> saturation-related 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

From: INVALID ADDRESS
Subject: Re: With all the talk of color, HCY
Date: 29 Nov 2016 00:16:30
Message: <271651330.502088923.895653.gdsHYPHENentropyAThotmaolDOTcom@news.povray.org>
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/gds-entropy/31157486571/

Frame 2000:
https://m.flickr.com/#/photos/gds-entropy/30438914664/

Frame 400:
https://m.flickr.com/#/photos/gds-entropy/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

From: Mike Horvath
Subject: Re: With all the talk of color, HCY
Date: 29 Nov 2016 02:47:14
Message: <583d3282$1@news.povray.org>
On 11/29/2016 12:16 AM, [GDS|Entropy] 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/gds-entropy/31157486571/
>
> Frame 2000:
> https://m.flickr.com/#/photos/gds-entropy/30438914664/
>
> Frame 400:
> https://m.flickr.com/#/photos/gds-entropy/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

From: INVALID ADDRESS
Subject: Re: With all the talk of color, HCY
Date: 1 Dec 2016 12:32:51
Message: <969866470.502305967.357884.gdsHYPHENentropyAThotmaolDOTcom@news.povray.org>
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

From: INVALID ADDRESS
Subject: Re: With all the talk of color, HCY
Date: 1 Dec 2016 13:30:21
Message: <1144880560.502307189.825278.gdsHYPHENentropyAThotmaolDOTcom@news.povray.org>
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/color-space
github.com/scijs/color-space

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/cvs09-17.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/death-color

This person has some degree of documentation for som of the models as well.

github.com/portnov/color-palette

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

From: Thomas de Groot
Subject: Re: With all the talk of color, HCY
Date: 2 Dec 2016 02:52:14
Message: <5841282e@news.povray.org>
On 1-12-2016 19:30, [GDS|Entropy] 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

From: INVALID ADDRESS
Subject: Re: With all the talk of color, HCY
Date: 3 Dec 2016 03:48:16
Message: <1989791654.502446699.859796.gdsHYPHENentropyAThotmaolDOTcom@news.povray.org>
Thomas de Groot <tho### [at] degrootorg> wrote:
> On 1-12-2016 19:30, [GDS|Entropy] 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

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.