POV-Ray : Newsgroups : povray.general : Colors of the rainbow : Re: Colors of the rainbow Server Time
30 Jul 2024 00:20:38 EDT (-0400)
  Re: Colors of the rainbow  
From: Alain
Date: 12 Apr 2010 22:21:10
Message: <4bc3d516$1@news.povray.org>

> 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

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