|
|
Am 16.03.2017 um 17:36 schrieb Mike Horvath:
> 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
Sorry, but this is totally bonkers.
The indices into xyz_table are to be interpreted as representing
wavelengths.
So you're varying three wavelength variables independently: For one (i)
you're summing up the x component; for another one (j) you're summing up
the y component; and for yet another one (k) you're summing up the z
component.
What good do you expect this to do?
What you really need is a smart external loop or set of loops that
generates /spectra/, not wavelengths -- and then within that loop insert
a /single/ additional loop that varies a wavelength variable i, summing
up xyz_table[i] * D65_table[i] * spectral_power(i).
Post a reply to this message
|
|