POV-Ray : Newsgroups : povray.unofficial.patches : THE "DUSTY SHADOW BUG " : Re: one Question Server Time
28 Jul 2024 22:16:32 EDT (-0400)
  Re: one Question  
From: Jerome M  BERGER
Date: 31 Oct 1999 17:17:39
Message: <381CBFF7.1258F194@enst.fr>
merath wrote:
> macro, "create_spectrum" is there any posibility to download this file
> thanks
> merath

Here is the original:
//Dispersion spectrum macro written by Nathan Kopp
#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.5);
			#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

I've found that it had a tendency to make reddish light, if you want
white light, try commenting out the #if(h>0.85) #local ... #end
n_elems is the number of light elements (the more, the better and the longer to
render)
bright is the brightness (3/n_elems gives approximately an intensity 1 light)

		Jerome

-- 
*******************************

* they'll tell you what can't * mailto:ber### [at] inamecom
* be done and why...          * http://www.enst.fr/~jberger
* Then do it.                 *
*******************************


Post a reply to this message

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