|
![](/i/fill.gif) |
> Ah, so Hue varies from 0 to 360 degrees while Saturation and Value vary from 0
> to 1. That's a very interesting piece of information. Exactly what I needed to
> hear, Alain, merci!
>
> It worked perfectly.
>
> Ruy
>
> Alain<aze### [at] qwerty org> wrote:
>>
>> Change your code to:
>> #local Hue = (Mx-Cr)/Mx*360;
>> // Scale to a full circle on the colour wheel
>> // Adjust if you want to use a smaller or larger range
>> texture {
>> pigment{rgb CHSV2RGB(<Hue, 1.0, 1.0>)}
>> }
>>
>> OR change your pigment to:
>> pigment{rgb CHSV2RGB(<((Mx-Cr)/Mx)*360, 1.0, 1.0>)}
>>
>>
>>
>> Alain
>
>
>
>
To find that, you need to look inside colors.inc.
CHSV2RGB internaly calls CH2RGB.
CH2RGB is defined as:
#macro CH2RGB (H)
#local H = mod(H, 360);
#local H = (H < 0 ? H+360 : H);
#switch (H)
#range (0, 120)
#local R = (120- H) / 60;
#local G = ( H- 0) / 60;
#local B = 0;
#break
#range (120, 240)
#local R = 0;
#local G = (240- H) / 60;
#local B = ( H-120) / 60;
#break
#range (240, 360)
#local R = ( H-240) / 60;
#local G = 0;
#local B = (360- H) / 60;
#break
#end
<min(R,1), min(G,1), min(B,1)>
#end
When you look at that code, it becomes obvious that you are using
degrees. CHSL2RGB() also use degrees.
It should be added to the documentation.
Alain
Post a reply to this message
|
![](/i/fill.gif) |