Page 1 of 1
Alien sky colours: a numerical approach
Posted: 05.06.2007, 11:50
by ajtribick
So, not only have I gone and followed Fridger's advice to get OpenSUSE, it seems I'm becoming a Perl hacker as well...
A question that's come up a few times in this forum is the colour of the sky on planets orbiting stars different to our Sun. While this has been discussed qualitatively, I decided it might be interesting to do something a bit more quantitative.
The model I'm using is blackbody radiation and Rayleigh scattering. The blackbody spectrum is multiplied by 1/(wavelength^4) to simulate Rayleigh scattering. Absorption lines, multiple scattering, particulates, etc. are not modelled here, because that kind of thing makes the maths difficult.
Plugged the resultant spectrum and the CIE colour matching functions into a quick bit of Perl code to do integration and colour conversion (written with the aid of the code at
this site).
The results I got are:
Temperature=3500 K (red dwarf, e.g. Gliese 581)
### Star colour (RGB) = (255,135,63)
### Sky colour (RGB) = (217,237,255)
Temperature=5800 K (yellow dwarf, e.g. Sun)
### Star colour (RGB) = (255,223,211)
### Sky colour (RGB) = (58,120,255)
Temperature=9300 K (A-type star, e.g. Vega)
### Star colour (RGB) = (152,183,255)
### Sky colour (RGB) = (25,79,255)
I personally can't tell much difference between the sky colour for the Sun and Vega, but the sky colour for a planet orbiting a red dwarf is rather grey and washed-out, though still noticeably bluish.
Posted: 05.06.2007, 12:30
by ajtribick
Further results: sky goes white around 3300 K star temperature. Below this, the sky apparently starts turning pinkish yellow.
For example, for T=3000 K, the RGB sky colour is (255,221,179), which looks like this.
On the other hand, increasing the star temperature further beyond Vega just results in the colour going more blue, rather than ending up with violet skies.
Posted: 05.06.2007, 13:39
by t00fri
You did not write whether your OpenSuse installation went fine?
I can really recommend everyone to learn a bit of PERL. It's so tremendously useful and easy to try (an interpreted language!) ...
Did you install the Math::Libm and/or the Math::Trig PERL modules?
Then you can do any kind of sophisticated math calculations very easily as well.
Bye Fridger
Posted: 05.06.2007, 14:52
by ajtribick
Yes the OpenSUSE installation went fine, though persuading it to deal with my wireless card was rather more tricky (ended up resorting to ndiswrapper). Haven't installed Celestia on it yet though - probably I will wait until the next version comes out.
Looks like I don't have those modules, thanks for the pointers!
Posted: 06.06.2007, 04:23
by techno_mage
how does all this work with in a High Dynamic Range render?
The color values all appear to be clamped to the 32 bit (0-255) range but HDR implementations use an interval over a 64 bit floating point range.
Posted: 08.06.2007, 16:48
by mmarable
chaos syndrome,
Just some praise to you. I took a look at the page you referenced and I could not make heads or tails of any of it. Very complicated stuff you've worked out here. Real nice work.
Posted: 12.06.2007, 05:02
by Brendan
That page reminds me of the color science class I did last fall when I was in university majoring in imaging science and minoring in astronomy.
Posted: 12.06.2007, 14:59
by eburacum45
The poster 'Stainless' is working on some software-derived depictions of alien skies; here is the thread concerned.
http://www.bautforum.com/showthread.php?t=60031
He claims to be taking into account Rayleigh scattering, Mie scattering, extinction and something he calls 'sunrise/sunset red shift' which appears to be the way the Sun turns red at low angles and red light is scattered about.
I am very interested to see if you have any comments on Stainless' models; also have you made any visual representations yourself?
Posted: 12.06.2007, 16:59
by ajtribick
That thread's quite interesting, thanks for the pointer. Stainless is using a more advanced model than myself: I'm just modelling Rayleigh scattering, and not taking into account Mie theory. I haven't tried doing images using my code for two reasons: one, I haven't figured out how to do it (and I'd have to implement more than just Rayleigh scattering), and secondly my computer has intermittent hardware faults which makes everything run
really slowly
Posted: 18.06.2007, 03:09
by bdm
I did the same thing as Chaos Syndrome a couple of years ago to simulate sky colour. I wrote a Delphi program and I got similar results.
I added another factor into the calculations that Chaos Syndrome has not, and that is the frequency response of the human eye to light. I did this so as to get a more accurate representation of the colour as seen by the human eye. I calculated the frequency response of the human eye in steps of 5 nm and added the results to get the final colour.
There is one thing both of us did that I feel is incorrect. Setting the brightest RGB value to 255 appears to be somewhat adhoc and does not allow for the possibility that the sky colour may be relatively dark. I have no good way to resolve this potential inaccuracy.
Posted: 19.06.2007, 16:09
by ajtribick
Could you please elaborate on what you mean by your point about the frequency response? My code basically worked out the colours in terms of XYZ coordinates, which as far as I am aware DO take into account the frequency response, then converted these to RGB.
Posted: 20.06.2007, 03:32
by bdm
I based my frequency response of the human eye on the absorption characteristics of the three colour pigments in the human eye.
In each 5-nm slice of the black body spectrum, I multiplied the intensity at that frequency against the frequency responses from a lookup table for each of the three pigments. I added the results of these calculations to produce the RGB values.
I don't know if this is the best method or if there's a much simpler method that produces better results. It does provide a useful way to convert the blackbody spectrum into a colour that we would probably see.
I am not satisfied with the results because it normalises the highest RGB value to 255. Perhaps a better way is to normalise it against the peak of the blackbody curve?
Posted: 22.06.2007, 19:28
by ajtribick
My thoughts regarding the normalisation to 255 are that the intensity depends on various factors including thickness and composition of the atmosphere, distance of the planet from the star, etc. Also it depends how you set up your camera (or how far the eye adjusts to light levels!). Normalising to 255 allows comparison of the colours, and means I don't have to worry about all these other unknowns.
Posted: 24.06.2007, 09:09
by bdm
Temperature=3500 K (red dwarf, e.g. Gliese 581)
### Star colour (RGB) = (255,135,63)
### Sky colour (RGB) = (217,237,255)
Temperature=5800 K (yellow dwarf, e.g. Sun)
### Star colour (RGB) = (255,223,211)
### Sky colour (RGB) = (58,120,255)
Temperature=9300 K (A-type star, e.g. Vega)
### Star colour (RGB) = (152,183,255)
### Sky colour (RGB) = (25,79,255)
I get different results:
Temperature=3500 K
### Star colour (RGB) = (255,244,109)
### Sky colour (RGB) = (217,255,249)
Temperature=5800 K (yellow dwarf, e.g. Sun)
### Star colour (RGB) = (231,255,214)
### Sky colour (RGB) = (119,145,255)
Temperature=9300 K (A-type star, e.g. Vega)
### Star colour (RGB) = (187,217,255)
### Sky colour (RGB) = (91,108,255)
Posted: 26.06.2007, 14:15
by ajtribick
Given that there is no "correct answer" for the choice of whitepoint and the position of R,G,B in XYZ space, it is not surprising that you have got different values! However your results are not far off mine.
I'll post the xyz colours here (normalisation x+y+z=1), which is probably a more useful comparison.
Star colours are:
3500 K: (xyz)=(0.408, 0.390, 0.202)
5800 K: (xyz)=(0.326, 0.335, 0.339)
9300 K: (xyz)=(0.281, 0.292, 0.427)
Sky colours are:
3500 K: (xyz)=(0.302, 0.321, 0.377)
5800 K: (xyz)=(0.234, 0.241, 0.525)
9300 K: (xyz)=(0.206, 0.196, 0.598)
Nevertheless, Mie scattering apparently introduces some interesting effects on the sky colour: according to the thread linked by eburacum45 earlier in the thread, Mie scattering turns the sky of an M-star planet green, though I haven't verified this myself.