# How to correctly calculate the colour of the sky?

It is well-known that the sky is blue due to Rayleigh-scattering.

What bothers me though is the question how to actually calculate the spectrum of the scattered sunlight. Yes, use one of the formulas involving

$$I\propto \frac{1-\cos^2\theta}{\lambda^4},$$

that is clear, and the solar black-body spectrum has to be convoluted with the three human eye sensitivity curves to obtain an RGB image. But since our visual perception system (a.k.a. eyes) evolved such that the VIS-range is not strongly absorbed, I assume multiple scattering needs to be considered. So the formula above has to be applied to all paths involving no, single, double, triple etc. scattering, in other words there'll be a path integral involved.

Is there a closed form solution for this multiple scattering? Or at least an established routine to do the calculation?

• Yes, you got it. The light scattering in the atmosphere has to be calculated by taking multiple scattering into account. This can be done with different numerical techniques. Scientists will often use Monte Carlo techniques while the CGI community might use a ray tracing approach. In the limit the two are identical, if done properly. You can find papers, if you look for "atmospheric scattering Monte Carlo". For the visual impression you also have to fold the solar spectrum and the human eye response in, of course. – CuriousOne Jul 13 '16 at 7:29
• Also, note that closer to the ground the larger water droplets makes the scattering more independent of wavelength so it's no longer Rayleigh scattering, but the more general solution of Mie scattering. – pela Jul 13 '16 at 7:58
• Just googled this. file.scirp.org/pdf/ACS20120400011_46715429.pdf – Ivan Madan Jul 13 '16 at 8:20
• @MadanIvan Thanks, interesting quote from there: "The analytical representation of the spectra and the way they transform one into the other excludes any significant participation of multiple scattering in the color of the sky. This is not surprising given that Rayleigh scattering is, in contradistinction with forward scattering by aerosols, nearly isotropic. The lost of photons over all directions after each scattering renders multiple Rayleigh scattering a particularly inefficient process. " – Tobias Kienzler Jul 13 '16 at 9:03
• It's basically a path integral, but with a classical kernel. More like the path integral for Brownian motion, unless you want to model very short distance multiple scattering, where the phase actually plays a role... like second or higher order diffraction effects on rainbows. – CuriousOne Jul 13 '16 at 9:05

How to correctly calculate the colour of the sky?

Comments:

"But still, I suspect that the most important part will be convolution to the human eyes response. I know we can differentiate among wl at the middle of the spectrum and less at the sides. Moreover there should be as well a bell type response in term of stimulus. And I even think that all this depends on overall brightness. Do you mean to solve for scattering than plug that in a kind of CIE space? This is basically a curiosity, not a critic or a suggestion." – Alchimista Feb 3 '18 at 13:57

"@Alchimista Yes, basically I want to end up in CIE space. I used to have a Matlab function for that around, but seem to have mislaid it. But that's the easy part to me, the multi-scattering is what I'm mostly concerned with." – Tobias Kienzler Feb 8 '18 at 20:11

...

I assume multiple scattering needs to be considered. So the formula above has to be applied to all paths involving no, single, double, triple etc. scattering, in other words there'll be a path integral involved.

Is there a closed form solution for this multiple scattering? Or at least an established routine to do the calculation?

The related question "Rayleigh equation as explanation for sky being blue" mentioned in the comments to this question ends with: "... I wonder if Rayleigh scattering truly is the explanation for why the sky is blue.", the answer being "no".

Your question is: "How to correctly calculate the colour of the sky?"

The Wikipedia section "color" on the webpage Diffuse Sky Radiation explains that the color of the sky, directly overhead and not facing the Sun, is:

"... similar to that obtained by a monochromatic blue of a wavelength of 474–476 nm mixed with white light, i.e., an unsaturated blue light.$$^{[4]}$$ The explanation of the blue color by Rayleigh in 1871 is one of the most famous examples of the application of dimensional analysis in solving a problem in physics.$$^{[5]}$$

Near sunrise and sunset, most of the sunlight arrives nearly tangentially to the Earth's surface; thus, the light's path through the atmosphere is so long that much of the blue and even green light is scattered out along the way, leaving the sun rays and the clouds it illuminates red. Therefore, when looking at the sunset and sunrise, we see the color red more than the other colors.".

[4] "Human color vision and the unsaturated blue color of the daytime sky", by Glenn S. Smith

[5] "Atmospheric Optics" (.PDF), by Craig F. Bohren

That webpage offers a spectrum measured using a spectrometer under non-ideal conditions. What it does show, that is relevant, is that the spectrum is complicated by the concentration of various elements and molecules in the path of the light.

The same image is reused on the Wikipedia webpage "Fraunhofer lines" where the lettering is explained as follows:

"The visible color spectrum, from 380 nm to 710 nm. Calculated directly using the tristimulus values of the CIE 1931 color space. CIEXYZ to RGB conversion is done assuming sRGB 1.10 device characteristics. Desaturation of out-of-gamut colors causes the spectrum to look somewhat garish here. This image can serve as a basis for other representations of color spectra.

Simply cropping that section of the spectrum (475nm) and lightening it does indeed provide a blue sky color, but that's hardly a satisfactory description of the sky's color.

Similarly any simple formula is going to have many shortcomings and any complex formula will involve many measurements, and a lot of input variables. You'll not only need to know the date and time (to calculate the angle of the Sun) but will need to analyze a sample of the air column between your position and the extent of the atmosphere, that still leaves calculations for human perception of color. Calculating the year to year variances of sunlight is another exercise.

Utilizing spectroscopy alone is sufficiently complicated and the nature of the interaction of light upon materials far more complicated than a simple Rayleigh scattering model.

Wikipedia's webpage "Sunlight" explains some of the measurements, and also offers a link to published tables of the US Forest Service at "Direct solar radiation on various slopes from 0 to 60 degrees north latitude; those tables are themselves estimates, and another source of inaccuracy.

The article referenced above, by Glenn S. Smith, explains on page 594, with respect to available (Rayleigh scattered) light and the properties of human vision:

"The average observer sees daytime skylight as blue because the response of the eye to the spectrum of skylight is the same that to a mixture of monochromatic blue light (spectral blue light) and white light, that is, it is the same as the response to unsaturated blue light.".

"Fig. 7. Spectral irradiance for a mixture of white light and monochromatic blue light that is a metameric match to skylight. (a) Rayleigh sky ($$\lambda^b$$ = 474 nm), and (b) measured skylight ($$\lambda^b$$ = 476 nm).".

While Raman scattering plays a small role, the Rayleigh scattering (from the Hyperphysics webpage) is:

You are certainly better off reading the more complete set of calculations offered by Smith.