POV-Ray : Newsgroups : povray.advanced-users : D65 spectral locus : Re: D65 spectral locus Server Time
20 Apr 2024 03:10:59 EDT (-0400)
  Re: D65 spectral locus  
From: Mike Horvath
Date: 16 Mar 2017 12:36:00
Message: <58cabef0$1@news.povray.org>
On 3/16/2017 11:49 AM, Mike Horvath wrote:
> I'm trying to use this formula to plot the visible gamut in XYZ space.
>
> http://www.brucelindbloom.com/index.html?Eqn_Spect_to_XYZ.html
>
> Here is my code:
>
>     #local xSum = 0;
>     #local ySum = 0;
>     #local zSum = 0;
>     #local nSum = 0;
>     #for (i, 0, 89)
>         #local nSum = nSum + (xyz_table[i].y * D65_table[i]);
>     #end
>     #for (i, 0, 89)
>         #local xSum = 1/nSum * (xSum + xyz_table[i].x * 1 * D65_table[i]);
>         #for (j, 0, 89)
>             #local ySum = 1/nSum * (ySum + xyz_table[j].y * 1 *
> D65_table[j]);
>             #for (k, 0, 89)
>                 #local zSum = 1/nSum * (zSum + xyz_table[k].z * 1 *
> D65_table[k]);
>                 sphere
>                 {
>                     <xSum, ySum, zSum> * 10, 0.005
>                     pigment {color rgb x}
>                 }
>             #end
>         #end
>     #end
>
> However, the resulting shape is box-shaped instead of cone-shaped. Am I
> approaching things in the right way?
>
>
> Mike


This works a bit better, but is still not right:

	#local nSum = 0;
	#for (i, 0, 89)
		#local nSum = nSum + (xyz_table[i].y * D65_table[i]);
	#end
	#local xSum = 0;
	#for (i, 0, 89)
		#local xSum = xSum + xyz_table[i].x * 1 * D65_table[i];
		#local ySum = 0;
		#for (j, 0, 89)
			#local ySum = ySum + xyz_table[j].y * 1 * D65_table[j];
			#local zSum = 0;
			#for (k, 0, 89)
				#local zSum = zSum + xyz_table[k].z * 1 * D65_table[k];
				#local xyYCoo = 1/nSum * <xSum, ySum, zSum>;
				#local xyYCoo = XYZ2xyY(xyYCoo);
				#local xyYCoo = <xyYCoo.x,xyYCoo.z,xyYCoo.y>;
				sphere
				{
					xyYCoo, 1/80
					pigment {color rgb x}
				}
			#end
		#end
	#end

Mike


Post a reply to this message

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