|
|
clipka wrote:
> I'm still not happy with the whole smash.
>
> Notice the brightness "peak" in the violet range? Doesn't appear natural
> to me.
>
> Right until beta.34, POV-Ray has been using a rather obscure and sketchy
> formula to compute spectral colors, based on data from the 'net that I
> didn't manage to track down. This makes it difficult to determine (a)
> what color space the underlying data was designed for, (b) whether the
> original data was gamma-precorrected or not, and (c) what wavelengths
> the code is normalized to.
It seems the code tries to mimic the CIE CMF (color matching function)
within r,g,b values. Note the two peaks of the red component. I do not
know how well this is done but I do see two problems:
CIE reference white is D50 and not D65 as within s(c)RGB and the CMF
tables of course refer to the CIE xyz color space.
> I tried to replace the formula with an interpolation table generated
> from physical data normalized to the sRGB color space, but it looked
> even worse.
???
> (I did replace the formula with a table though - using values generated
> directly from the formula for now - as this was needed to address the
> "color drift" that occurred with low dispersion sample count.)
As an accurate in place calculation is quite computing intensive and as
you have already implemented a LUT it should be fairly easy to fill it
with accurate rgb values depending on the wavelength by using a bit of
POV-Ray SDL from my CIE.inc file and the macro
Wavelength2RGB(wavelength) from there.
like this:
#include "CIE.inc"
#declare WL_MIN = 385; //values below will not contribute much
#declare WL_MAX = 700; //values above are almost invisible
#declare WL_STEP = 5; //or whatever value is useful for your lut.
#declare WL = WL_MIN;
#while (WL <= WL_MAX)
#declare WL_RGB = Wavelength2RGB(WL);
/*
now write the WL_RGB value to a file or to the message pane or whatever
and use them for the POV-Ray source code LUT...
*/
#declare WL = WL + WL_STEP;
#end
Should be used with the default settings (sRGB primaries,
D65 whitepoint, D50 reference white and Bradford chromatic adaption).
It will fulfill the criteria that integrating over all samples will
result in *white*. The values close to UV and IR will become darker (as
they should) so the violet peak you did observe should disappear.
As I have not the faintest idea how the POV-Ray photon code is working
a few additional notes:
The values that are returned from 'Wavelength2RGB' are NOT normalized,
so maybe there should be a constant multiplier for all values (to make
them exactly fit into the 0.0 - 1.0 range).
The values that are chosen for WL_MIN and WL_MAX (or better how the
dispersion samples within POV-Ray are spread out) will have a huge
impact on the visual appearance, so for a low count of dispersion
samples they should be limited to only spread from e.g. 440nm to 640nm
(but only guessing here, has to be tried out).
So even if the values returned by Wavelength2RGB are perfectly accurate
there will be some trial and error involved to find visually good
looking values for the min and max dispersion spread especially when
only few samples are used.
-Ive
Post a reply to this message
|
|