|
|
> Bruno Cabasson wrote:
>> I started the TerraPOV series with a preliminary article in
>> povray.binary.tutorials. Hope it is the right place for that.
>> Following: TerraPOV's sky system/Atmosphere.
>>
>
> This is really very much appreciated, thanks a lot. I'm already waiting
> for the next episode ;)
>
> Just one point: The rgb color calculation for the Rayleigh scattering is
> a bit, hmm, let's say problematic. Color conversion from wavelength
> values to any rgb color space should always done by using color
> transformation through the CIE xyz space.
>
> I've quickly implemented it by using a Gaussian distribution around
> the wavelength peak values and for the spectrum conversion my old CIE
> include file (part of Jaime's lightsys).
>
>
> //-----------------------------------------------------
>
> // Atmosphere: scattering color
> #declare TP_LAMBDA_RED = 650; // nanometres
> #declare TP_LAMBDA_GREEN = 555; // nanometres
> #declare TP_LAMBDA_BLUE = 460; // nanometres
>
>
> #include "CIE.inc"
>
> #local TP_FACT_RED = pow(TP_LAMBDA_BLUE/TP_LAMBDA_RED, 4);
> #local TP_FACT_GREEN = pow(TP_LAMBDA_BLUE/TP_LAMBDA_GREEN, 4);
> #local TP_FACT_BLUE = 1;
> #local TP_STEP = 5; // integral step width for spline creation
> #local TP_GAUSS_BELL = 45; // get 95% distribution +/- 45nm around the
> peak value
>
>
> #macro Gauss(Peak, Value, Fact)
> #local E = 2.7182818284;
> #local D = abs(Peak - Value) / TP_STEP;
> pow(E, -(D*D) / TP_GAUSS_BELL) * Fact
> #end
>
>
> #local TP_RALEIGH_SPECTRUM = spline
> { linear_spline
>
> #local WL = 380;
> #while (WL <= 760)
> WL, Gauss(TP_LAMBDA_RED, WL, TP_FACT_RED) +
> Gauss(TP_LAMBDA_GREEN, WL, TP_FACT_GREEN) +
> Gauss(TP_LAMBDA_BLUE, WL, TP_FACT_BLUE)
>
> #local WL = WL + TP_STEP;
> #end
> }
>
>
> #declare TP_RAYLEIGH_SCATTERING_COLOR =
> EmissiveSpectrum(TP_RALEIGH_SPECTRUM);
>
>
> //-----------------------------------------------------
>
>
> Your calculation
>
> #declare TP_RAYLEIGH_SCATTERING_COLOR = rgb
> <pow(TP_LAMBDA_BLUE/TP_LAMBDA_RED, 4),
> pow(TP_LAMBDA_BLUE/TP_LAMBDA_GREEN, 4),
> 1>;
>
> gives
>
> rgb <0.2508, 0.4719, 1.0000>
>
> and my version
>
> rgb <0.2625, 0.4436, 1.0000>
>
>
> so the difference is subtle - but especially when the sun altitude is
> very low - noticeable. It looks slightly less 'greenish'.
>
>
> Anyway, as said, I can hardly wait for the next part of your tutorial
>
> -Ive
Thanks for reading me, Ive! :)
You are right. Thanks for the tip!
The rgb-wavelength correspondance has been the subject of endless
discussions and studies. The values I gave in the tutorial were quite
'arbitrary', and can be modified at will. I said in the tutorial that the
colors were not 100% satisfactory yet. They are indeed too reddish and
greenish (saturation too low). This can be tuned by setting different
values for the three wavelengths.
Plus, the atmosphere is more complex than
only-air-molecules-with-only-rayleigh-scattering, and contains many types
of molecules. These molecules produce an additional scattering and an
additional absorption. This will correct colors, allows tuning and express
different situations (pollution, sea, mountain, desert, etc ...). TerraPOV
lets the user set the values of these scattering and absorption.
I needed a start point for the scattering color of TerraPOV's atmosphere.
If you have a clear idea for rgb-wavelength correspondance, and if you can
provide 3 values for TerraPOV's default, I will be very happy and
thankful :p .
Searching the web, I found these links:
http://www.handprint.com/LS/CVS/color.html
http://mintaka.sdsu.edu/GF/explain/optics/rendering.html
http://www.babelcolor.com/download/A%20review%20of%20RGB%20color%20spaces.pdf
I overflew the first two. I'll take a closer look at the pdf.
Bruno
--
http://www.opera.com/mail/
Post a reply to this message
|
|