POV-Ray : Newsgroups : povray.general : TerraPOV tutorial articles in p.b.t : Re: TerraPOV tutorial articles in p.b.t Server Time
30 Jul 2024 08:27:46 EDT (-0400)
  Re: TerraPOV tutorial articles in p.b.t  
From: Ive
Date: 9 May 2009 05:06:39
Message: <4a05479f@news.povray.org>
Bruno Cabasson wrote:
> Thanks for reading me, Ive!  :)
> 
It's my pleasure.


> 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 .
> 

Well, forget my last post, guess I was still sleepy. In fact selecting
three wavelength values will *always* be arbitrary as you can calculate 
the RGB value for a given wavelength or spectrum, but not the other way 
around.
But this is not needed because - we can simply calculate the RGB value
from the spectral data itself. It can be done within the SDL with this
few lines of code:

//******************************************************

#include "CIE.inc"

// Create spectral data for Raleigh scattering following
// the power of 4 rule. Range from 380 to 830 nm.

#declare TP_RALEIGH_SPECTRUM = spline
{
   linear_spline

   #local WL = 380;

   #while (WL < 830)
     WL, pow(380/WL, 4)
     #local WL = WL + 5;
   #end
}

// Calculate the RGB value by using the CIE color match

// color space (sRGB/ITU primaries, whitepont D65 but
// without gamma correction)

#declare TP_RAYLEIGH_SCATTERING_COLOR = 
EmissiveSpectrum(TP_RALEIGH_SPECTRUM);

//*****************************************************


This gives for TP_RAYLEIGH_SCATTERING_COLOR the value of

rgb <0.2978, 04382, 1.0000>


This is a little less greenish than your result. But I must admit that 
your *arbitrary* value did come quite close and where well chosen ;)

Anyway, feel free to use this color science approach or just keep your
arbitrary values because I guess for the final result with a more 
complex atmosphere model the visible difference will be minor.

Still waiting for the next part of your tutorial ;)

-Ive


Post a reply to this message

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