POV-Ray : Newsgroups : povray.beta-test : Colors.inc-macros incomplete : Re: Colors.inc-macros incomplete Server Time
5 Nov 2024 03:14:55 EST (-0500)
  Re: Colors.inc-macros incomplete  
From: Rune
Date: 11 Sep 2001 04:25:56
Message: <3b9dca94$1@news.povray.org>
I think there's a problem in the basic functionality. If HSL is supposed to
work anything like in regular graphics programs, then this code:

  // Incorporate saturation and lightness
  (((1 - S)*<1, 1, 1> + S*vClampedRGB)*L)

Should be replaced with this:

  // Incorporate saturation and lightness
  #switch (L)
    #range (0.0, 0.5)
      ((vClampedRGB*S+<1,1,1>/2*(1-S))*L*2)
    #break
    #range (0.5, 1.0)
      ((vClampedRGB*S+<1,1,1>/2*(1-S))*(2-L*2)+<1,1,1>*(L*2-1))
    #break
  #end

You can use this code to see the difference:

#declare Xm = 50;
#declare Ym = 50;
#declare X = 0;
#while (X<=Xm)
   #declare Y = 0;
   #while (Y<=Ym)
      #declare Xv = (X/Xm);
      #declare Yv = (Y/Ym);
      sphere {
         <Xv,Yv,0>, 0.05
         pigment {color ConvertHSLtoRGB(<0,Xv,Yv>)}
         finish {ambient 1 diffuse 0}
      }
      #declare Y=Y+1;
   #end
   #declare X=X+1;
#end
camera {translate <0.5,0.5,-1>}
background {color rgb 0.5}

I might be wrong though - I would like to hear your opinions on this!

Rune
--
3D images and anims, include files, tutorials and more:
Rune's World:    http://rsj.mobilixnet.dk (updated June 26)
POV-Ray Users:   http://rsj.mobilixnet.dk/povrayusers/
POV-Ray Webring: http://webring.povray.co.uk


Post a reply to this message

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