|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Hello,
I'm trying to produce the colors of the rainbow inside a #while loop, but to no
avail so far. I need them to progress from red to violet, and I am using the
CHSV2RGB for the conversion, which I thought would make things easier. Still,
all I get is a constant red color in my blob.
Here is the code. The problem is in the blob with the loop (which produces an
ascending spiral):
#include "colors.inc"
camera{
location < 0, 150, -1000 >
look_at < 0, 20, 0.000 >
angle 5.000
}
light_source{ <800,4000, 700> rgb 1 }
sphere {
<0, 0, 0>, 1
texture {
pigment {
gradient y
color_map {
[0.0 color rgb < 01.0, 01.0, 1.0 >]
[0.0 color rgb < 01.0, 01.0, 1.0 >]
}
}
finish { diffuse 0 ambient 1 }
}
hollow on
no_shadow
scale 30000
}
blob {
threshold .0005
#declare Cr = 0;
#declare Mx = 2330;
#declare Rd = 0.1;
#declare Ap = 1;
#declare As = 1;
#declare Vl = 1;
#while (Cr <= Mx)
sphere { <0,0,0>, 1.3 ,1
translate <Cr*Ap*Rd*Rd,Cr*Vl*Rd*Rd*1.3, Cr*As*Rd*Rd>
rotate y*Cr*Vl
texture {
pigment{rgbft CHSV2RGB(<((Mx-Cr)/Mx), 1.0, 1.0>)}
}
}
#declare Cr = Cr + 1;
#end
}
___________
My intention here is to produce an ascending spiral with seven turns; each turn
being of a color of the rainbow (or something close to that). The spiral ascends
alright, but the colors don't vary at all.
There's very little documentation on CHSV2RGB, and I found no examples of it in
action, so any help will be greatly appreciated.
Ruy (an extremely absent POVer since 1994, version 2.2)
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
> Hello,
>
> I'm trying to produce the colors of the rainbow inside a #while loop, but to no
> avail so far. I need them to progress from red to violet, and I am using the
> CHSV2RGB for the conversion, which I thought would make things easier. Still,
> all I get is a constant red color in my blob.
>
>
> Ruy (an extremely absent POVer since 1994, version 2.2)
>
>
The hue is given in degree. In your sample, it goes from 0 degree to 1
degree, giving an almost imperceptible change in coloration.
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
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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] qwertyorg> 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
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
> 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] qwertyorg> 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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Alain wrote:
> It should be added to the documentation.
>
Done ...
http://wiki.povray.org/content/Documentation:Reference_Section_7#Color_macros
Jim
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
ruy wrote:
>
> Ruy (an extremely absent POVer since 1994, version 2.2)
>
Definitely OOC but welcome back.
You have been assimilated, resistance was futile :-)
John
--
Cogito sum,|| wbu### [at] tznvypbz (rot'ed) || GPG Key Fingerprint:
ergo sum, || These opinions are mine alone, || 0D9BCF4CF1B71CA2F5F7
cogito || others can find their own || BFBBCBC34EDEAEFCE453
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
> > It should be added to the documentation.
> >
>
> Done ...
> http://wiki.povray.org/content/Documentation:Reference_Section_7#Color_macros
>
> Jim
Excellent, thank you very much!
> > Ruy (an extremely absent POVer since 1994, version 2.2)
> >
>
> Definitely OOC but welcome back.
> You have been assimilated, resistance was futile :-)
>
> John
Thanks! It's good to be back, even if just for a short while. :D
Ruy
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|