POV-Ray : Newsgroups : povray.object-collection : SharkD's HSV,HSL, etc. Server Time
29 Mar 2024 01:47:32 EDT (-0400)
  SharkD's HSV,HSL, etc. (Message 1 to 6 of 6)  
From: Karl Anders
Subject: SharkD's HSV,HSL, etc.
Date: 4 Jul 2008 06:00:00
Message: <web.486df3d5de1ba68e368c40a20@news.povray.org>
Hello all,

I would really have loved to do this by private mail, but since SharkD doesn't
give one ( nomail _at_ nomail ), I'll have do it publicly.

First off, something positive:
These definitions really helped me to understand the concept and usage of
pigment_maps much better. Many thanks for the effort to you, SharkD.

But there is e.g. no real yellow in your HSV/HSL-thingies.
There are multiple color_maps like

color_map
{
   [0 rgb <1, 0, 0>]
   [1/3 rgb <0, 1, 0>]
   [2/3 rgb <0, 0, 1>]
   [1 rgb <1, 0, 0>]
}

so the best approximation to yellow is rgb<0.5,0.5,0> at 1/6.

I feel that should be changed to
color_map{
   [ 0   rgb < 1, 0, 0 > ]
   [ 1/6 rgb < 1, 1, 0 > ]
   [ 2/6 rgb < 0, 1, 0 > ]
   [ 3/6 rgb < 0, 1, 1 > ]
   [ 4/6 rgb < 0, 0, 1 > ]
   [ 5/6 rgb < 1, 0, 1 > ]
   [ 1   rgb < 1, 0, 0 > ]
}

Have a nice weekend
Karl


Post a reply to this message

From: Warp
Subject: Re: SharkD's HSV,HSL, etc.
Date: 4 Jul 2008 06:47:39
Message: <486dffcb@news.povray.org>
Karl Anders <kar### [at] webde> wrote:
> color_map
> {
>    [0 rgb <1, 0, 0>]
>    [1/3 rgb <0, 1, 0>]
>    [2/3 rgb <0, 0, 1>]
>    [1 rgb <1, 0, 0>]
> }

> so the best approximation to yellow is rgb<0.5,0.5,0> at 1/6.

> I feel that should be changed to
> color_map{
>    [ 0   rgb < 1, 0, 0 > ]
>    [ 1/6 rgb < 1, 1, 0 > ]
>    [ 2/6 rgb < 0, 1, 0 > ]
>    [ 3/6 rgb < 0, 1, 1 > ]
>    [ 4/6 rgb < 0, 0, 1 > ]
>    [ 5/6 rgb < 1, 0, 1 > ]
>    [ 1   rgb < 1, 0, 0 > ]
> }

  I'd say you are right. Linearly interpolating between the three RGB
components is definitely not the same thing as interpolating the hue
ring. While your proposed solution might still not be *exactly* the
same thing as a hue ring (more likely it's a hue hexagon, which is
just slightly different), it definitely is much closer.

-- 
                                                          - Warp


Post a reply to this message

From: Karl Anders
Subject: Re: SharkD's HSV,HSL, etc.
Date: 4 Jul 2008 10:40:02
Message: <web.486e35d57f47acd613925be00@news.povray.org>
Warp <war### [at] tagpovrayorg> wrote:
>   I'd say you are right. Linearly interpolating between the three RGB
> components is definitely not the same thing as interpolating the hue
> ring. While your proposed solution might still not be *exactly* the
> same thing as a hue ring (more likely it's a hue hexagon, which is
> just slightly different), it definitely is much closer.
>
> --
>                                                           - Warp

Hi Warp,

at least it's consistent with CH2RGB from colors.inc ;-)

Have a nice weekend
Karl


Post a reply to this message

From: Chambers
Subject: Re: SharkD's HSV,HSL, etc.
Date: 4 Jul 2008 16:04:22
Message: <486e8246$1@news.povray.org>
Karl Anders wrote:
> I feel that should be changed to
> color_map{
>    [ 0   rgb < 1, 0, 0 > ]
>    [ 1/6 rgb < 1, 1, 0 > ]
>    [ 2/6 rgb < 0, 1, 0 > ]
>    [ 3/6 rgb < 0, 1, 1 > ]
>    [ 4/6 rgb < 0, 0, 1 > ]
>    [ 5/6 rgb < 1, 0, 1 > ]
>    [ 1   rgb < 1, 0, 0 > ]
> }

Or, you could change it to this:
-----
#macro _lerp(a,b,_t)
   (a+(b-a)*_t)
#end

#macro _lerpColor(a, b, _t)
   #local _color = _lerp(a,b,_t);
   #local _magnitude = _color.x + _color.y + _color.z;
   #local _scale = 3 / _magnitude;
   _color * _scale
#end

#macro _stepColor(ta,ca,tb,cb,nSteps)
   #local _count = 0;
   #while (_count < nSteps)
     [_lerp(ta,tb,_count/nSteps) color rgb _lerpColor(ca,cb,_count/nSteps)]
   #local _count = _count + 1;
   #end
#end

#declare ring3 = pigment {
   radial
   color_map {
     _stepColor( 0/6, rgb x,   1/6, rgb x+y, 42 )
     _stepColor( 1/6, rgb x+y, 2/6, rgb y,   42 )
     _stepColor( 2/6, rgb y,   3/6, rgb y+z, 42 )
     _stepColor( 3/6, rgb y+z, 4/6, rgb z,   42 )
     _stepColor( 4/6, rgb z,   5/6, rgb z+x, 42 )
     _stepColor( 5/6, rgb z+x, 6/6, rgb x,   42 )
   }
}
-----
This interpolates between the various colors, making sure that each 
steps has a constant saturation level (I used 3 here, as that would be 
the value of rgb 1 (1+1+1), but any can be used for the same effect).

...Chambers


Post a reply to this message

From: SharkD
Subject: Re: SharkD's HSV,HSL, etc.
Date: 4 Jul 2008 21:40:01
Message: <web.486ed0887f47acd6290dc7d60@news.povray.org>
"Karl Anders" <kar### [at] webde> wrote:
> Hello all,
>
> I would really have loved to do this by private mail, but since SharkD doesn't
> give one ( nomail _at_ nomail ), I'll have do it publicly.
>
> First off, something positive:
> These definitions really helped me to understand the concept and usage of
> pigment_maps much better. Many thanks for the effort to you, SharkD.
>
> But there is e.g. no real yellow in your HSV/HSL-thingies.
> There are multiple color_maps like
>
> color_map
> {
>    [0 rgb <1, 0, 0>]
>    [1/3 rgb <0, 1, 0>]
>    [2/3 rgb <0, 0, 1>]
>    [1 rgb <1, 0, 0>]
> }
>
> so the best approximation to yellow is rgb<0.5,0.5,0> at 1/6.
>
> I feel that should be changed to
> color_map{
>    [ 0   rgb < 1, 0, 0 > ]
>    [ 1/6 rgb < 1, 1, 0 > ]
>    [ 2/6 rgb < 0, 1, 0 > ]
>    [ 3/6 rgb < 0, 1, 1 > ]
>    [ 4/6 rgb < 0, 0, 1 > ]
>    [ 5/6 rgb < 1, 0, 1 > ]
>    [ 1   rgb < 1, 0, 0 > ]
> }
>
> Have a nice weekend
> Karl

You are correct. I'm not sure how I missed this, as it is blaringly obvious in
the cube models. I'll fix it in the next release.

-SharkD


Post a reply to this message

From: SharkD
Subject: Re: SharkD's HSV,HSL, etc.
Date: 7 Jul 2008 01:50:00
Message: <web.4871adc77f47acd6eb867ce10@news.povray.org>
I've uploaded the updated version with the fixes. There are a few new pigments,
as well.

-Mike


Post a reply to this message

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