POV-Ray : Newsgroups : povray.unofficial.patches : create_spectrum Server Time
2 Nov 2024 05:18:53 EDT (-0400)
  create_spectrum (Message 1 to 2 of 2)  
From: Nathan Kopp
Subject: create_spectrum
Date: 9 Jan 2000 23:12:53
Message: <38795c45@news.povray.org>
Didn't somebody modify my create_spectrum (for photons+dispersion) macro to
make it better (it currently produces reddish light)?  I'd like a copy of
the changed version if anybody has it.

-Nathan


Post a reply to this message

From: Paul Blaszczyk
Subject: Re: create_spectrum
Date: 11 Jan 2000 18:34:38
Message: <387BBE67.7FC03736@alpharay.de>
Nathan Kopp wrotes:

> >Didn't somebody modify my create_spectrum (for photons+dispersion) macro to
> >make it better (it currently produces reddish light)?  I'd like a copy of
> >the changed version if anybody has it.
> >
> >-Nathan

I've send ya a modified macro.

Only change this:
   #local Huered = 0.9 - (h/0.5);
 to
    #local Huered = 0.9 - (h/0.45);
Now the light and shadows are white and not purplish/reddish.


Here is the complete macro:

//---Macro for light-spectrum---//
#macro create_spectrum(nelems,bright)

#local elem=1;

color_map{

#while(elem<=nelems)

  /* h goes from 0 at red end to 1.0 at blue end */
  #local h = (elem-1)/(nelems-1);

  /* co-h goes from 1.0 at red end to 0.0 at blue end */
  #local coh = 1.0 - h;

  #local Huered = 0.9 - (h/0.45);
  #local Hueblue = 1.0 - (coh/0.6);

  #if (Huered < 0.0) #local Huered = 0.0; #end
  #if (Hueblue < 0.0)  #local Hueblue = 0.0; #end

  #local Huered=1.0 - (1.0-Huered)*(1.0-Huered);
  #local Hueblue=1.0 - (1.0-Hueblue)*(1.0-Hueblue);

  #local Huegreen = 1.0 - Huered - Hueblue;

  #if (h>0.85)
    #local Huered = 4*(h-0.85);  // was 4 - changed to 8
  #end

  #local ybulge =  -4.0*(h-0.1)*(h-0.6);
  #if (ybulge<0) #local ybulge=0; #end

  #local Huered = Huered+ybulge;// * 0.5; // added * 0.5
  #local Huegreen = Huegreen+ybulge;

  [bright, color rgb<Huered,Huegreen,Hueblue>]
  //#debug
concat("<",str(Huered,0,3),",",str(Huegreen,0,3),",",str(Hueblue,0,3),">\n")


  #local elem=elem+1;
#end // while
}
#end // macro


Post a reply to this message

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