POV-Ray : Newsgroups : povray.general : How to autmatically change the color of balls? : Re: How to autmatically change the color of balls? Server Time
31 Jul 2024 22:16:09 EDT (-0400)
  Re: How to autmatically change the color of balls?  
From: iz2517
Date: 28 Aug 2006 20:15:01
Message: <web.44f3863994ddb2ab70cedff30@news.povray.org>
"Roman Reiner" <lim### [at] gmxde> wrote:
> If you're able to control the format of that file it would be easier to have
> the syntax:
>
> <x,y,z>,E
>
> and read MyVect directly:
>
> #while (defined(MyFile))
>   #read (MyFile, MyVect)
>   sphere {MyVect, 1 texture {pigment {color rgb <a,b,c>}}}
> #end
> #fclose MyFile
>
> To answer your question, it is possible.
> The easiest approach i'm aware of is declaring the color in HSL color space
> (hue, saturation, lighness) and convert it to RGB color (red, green, blue)
> with the function CHSL2RGB(Color) in "colors.inc"
> (see documentation for details
> http://www.povray.org/documentation/view/3.6.1/434/)
>
> then something like
>
> pigment { color rgb CHSL2RGB<E,240,120> }
>
> where E is in the range 160 (blue) to 0 (red) should do.
>
> It's possible that i'm confusing the range of the HSL values. i think its
> <0,0,0> to <240,240,240> but i'm not sure. you might need some testing or
> an advice of another person...
>
> Hope that helps
> Regards Roman
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Hi!

How do read a file in this format: <x,y,z>,E?

the following lines do not work:

  #read (MyFile, MyVect; E)
  #read (MyFile, MyVect, E)

Thanks.


Post a reply to this message

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