POV-Ray : Newsgroups : povray.advanced-users : With all the talk of color, HCY : Re: With all the talk of color, HCY Server Time
25 Apr 2024 09:52:36 EDT (-0400)
  Re: With all the talk of color, HCY  
From: INVALID ADDRESS
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

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