Planetary Atmospheres Light Scattering

General discussion about Celestia that doesn't fit into other forums.
Avatar
Topic author
FarGetaNik M
Posts: 484
Joined: 05.06.2012
With us: 11 years 11 months
Location: Germany

Post #21by FarGetaNik » 19.03.2017, 21:06

For an installed version of Celestia, the file for Earth is in data/solarsys.ssc, containing the parameters of its atmosphere I've been using. The code for atmosphereic scattering must be somewhere in the executable, as I can't find any file in shaders or tools describing it.

Avatar
Alexell M
Site Admin
Posts: 304
Joined: 07.10.2010
Age: 30
With us: 13 years 7 months
Location: Moscow, Russia
Contact:

Post #22by Alexell » 19.03.2017, 21:20

Class "Atmosphere" in src\celengine\atmosphere.h

Code: Select all

class Atmosphere
{
 public:
    Atmosphere() :
        height(0.0f),
        lowerColor(0.0f, 0.0f, 0.0f),
        upperColor(0.0f, 0.0f, 0.0f),
        skyColor(0.0f, 0.0f, 0.0f),
        sunsetColor(1.0f, 0.6f, 0.5f),
        cloudHeight(0.0f),
        cloudSpeed(0.0f),
        cloudTexture(),
        cloudNormalMap(),
        mieCoeff(0.0f),
        mieScaleHeight(0.0f),
        miePhaseAsymmetry(0.0f),
        rayleighCoeff(Eigen::Vector3f::Zero()),
        rayleighScaleHeight(0.0f),
        absorptionCoeff(Eigen::Vector3f::Zero()),
        cloudShadowDepth(0.0f)
    {};

 public:
    float height;
    Color lowerColor;
    Color upperColor;
    Color skyColor;
    Color sunsetColor;
       
    float cloudHeight;
    float cloudSpeed;
    MultiResTexture cloudTexture;
    MultiResTexture cloudNormalMap;
   
    float mieCoeff;
    float mieScaleHeight;
    float miePhaseAsymmetry;
    Eigen::Vector3f rayleighCoeff;
    float rayleighScaleHeight;
    Eigen::Vector3f absorptionCoeff;

    float cloudShadowDepth;
};


Added after 55 seconds:
Atmosphere density is modeled with a exp(-y/H) falloff, where H is the scale height of the atmosphere. Thus atmospheres have infinite extent, but we still need to choose some finite sphere to render. The radius of the sphere is the height at which the density of the atmosphere falls to the extinction threshold, i.e. -H * ln(extinctionThreshold)
Admin of celestia.space
PC: Intel Core i7-8700 @ 3.20GHz, SSD, 16 Gb RAM, NVIDIA GeForce GTX 1080, Creative Sound Blaster ZxR. Windows 10 x64.
Phone: iPhone Xs 256 Gb. iOS 14.
Image

scalbers
Posts: 138
Joined: 30.01.2005
With us: 19 years 3 months

Post #23by scalbers » 19.03.2017, 21:42

OK - I can see these mentions of RayleighScaleHeight in the code:

https://github.com/CelestiaProject/Celestia/search?utf8=✓&q=rayleighscaleheight

I suppose understanding how these pieces work together would be of interest.
http://stevealbers.net

Avatar
Topic author
FarGetaNik M
Posts: 484
Joined: 05.06.2012
With us: 11 years 11 months
Location: Germany

Post #24by FarGetaNik » 20.03.2017, 09:25

Another try on Ttian. I reintroduced Absorption, as towards the center of its disc Titan seems more yellow, and towards the limb more orange. Thankfully, absorption seems to reduce the ring of Rayleigh-scattered light around the dark side of Titan. An unexpected solution to this annoyance! I brightened the cloud textures a bit to remain in Titan's albedo range.

titan-absorption.jpg
Attachments
Titan-Atmosphere.zip
(24.62 KiB) Downloaded 203 times

scalbers
Posts: 138
Joined: 30.01.2005
With us: 19 years 3 months

Post #25by scalbers » 20.03.2017, 16:42

This makes sense as physically the aerosols are somewhat absorbing, having specific single scattering albedos. Thus with the newer version of software being used for Titan we can hopefully see the introduction of absorption helping to do the right thing. The absorption is more for the blue light. Ideally we can specify the single scattering albedo and optical thickness for each color.
http://stevealbers.net

Avatar
Topic author
FarGetaNik M
Posts: 484
Joined: 05.06.2012
With us: 11 years 11 months
Location: Germany

Post #26by FarGetaNik » 20.03.2017, 18:26

More so, the aerosols blocking the view from the surface transmit some light - probably the reason why Titan displays a thick haze layer at high phase angles. The way Celestia handles cloud layers doesn't reproduce it. I don't know how Celestia handles absorption, we have a ratio of absorbed red green and blue light, probably without optical thickness specified for each color. Another parameter to be added for the next version...

scalbers
Posts: 138
Joined: 30.01.2005
With us: 19 years 3 months

Post #27by scalbers » 21.03.2017, 00:19

In the solarsys.ssc file I see three values can be entered for Absorption. This might be an absorption extinction coefficient that could implicitly include the optical thickness. The single scattering albedo would relate to the ratio between scattering and absorption that I don't see right here yet. Also a separate parameter called Color.

Code: Select all

"Titan:Saturn VI" "Sol/Saturn"
{
   Texture  "titan.*"
        Color      [0.96 0.805 0.461 ]
        # HazeColor [ 0.781 0.629 0.975 ]
   HazeDensity          0.6
   Radius            2575

    Atmosphere {
        Height         500.0
         Lower      [ 0.477 0.367 0.211 ]
        Upper      [ 0.96 0.805 0.461 ]
        Sky        [ 0.3 0 0 ]
     
         Mie              0.0001
         MieAsymmetry    -0.55
         Rayleigh   [ 0.0 0.0 0.00017 ]
         Absorption [ 0.000075 0.00030 0.00025 ]
         MieScaleHeight 220.0
         CloudHeight    220.0
         CloudSpeed      65.0
         CloudMap "titan-clouds.*"
    }


The Absorption appears to be used here:

https://github.com/CelestiaProject/Celestia/blob/ ... ls/atmosphere/scattertable.cpp
Last edited by scalbers on 21.03.2017, 22:25, edited 1 time in total.
http://stevealbers.net

Avatar
Topic author
FarGetaNik M
Posts: 484
Joined: 05.06.2012
With us: 11 years 11 months
Location: Germany

Post #28by FarGetaNik » 21.03.2017, 08:59

Ok in the file you linked it is called "absorption coefficient". Then maybe the physics is already correct. By any chance, do you know how to convert an absorbed fraction of light into the absorption coefficient?
Regarding Titan's ssc code you posted:
"Color [ ]" is unrelated to the atmoshpere, it just colors in the point of light that replaces Tian at high distances. Only focus on the parameters inside the brakets of the Atmosphere { } parameter. Specifically, here the relevant parameters are:

Code: Select all

Mie 0.0001
MieAsymmetry -0.55
Rayleigh [ 0.0 0.0 0.00017 ]
Absorption [ 0.000075 0.00030 0.00025 ]
MieScaleHeight 220.0

The cloud parameters create a texured sphere around Titan (not the best way to display clouds...) and the parameters

Code: Select all

# HazeColor [ 0.781 0.629 0.975 ]
HazeDensity 0.6

Lower [ 0.477 0.367 0.211 ]
Upper [ 0.96 0.805 0.461 ]
Sky [ 0.3 0 0 ]

should be overridden by the Mie and Rayleigh parameters. Just legacy code found everywhere in ssc files...

Added after 16 minutes 30 seconds:
Meanwhile, I followed your advice and rendered Mars' atmosphere only using Mie and Absorption parameters:

Code: Select all

   Atmosphere
   {
      Height      80
      Mie      0.003
      MieScaleHeight   11.1
      Absorption   [ 0.0020 0.0020 0.0030 ]
   }

Absorption is somewhat arbitrary, just fitting some Mangalayan images. Because of that, sunset now looks yellowish:

mars-mie.jpg

scalbers
Posts: 138
Joined: 30.01.2005
With us: 19 years 3 months

Post #29by scalbers » 21.03.2017, 19:02

Thanks for your investigations. I'm presently working on ways to approximately get the absorbed fraction of light relative to the single scattering albedos and optical thickness. This depends on the viewing angles involved. Using Titan and Earth as examples I can just for now offer the following empirical data points.

Seen from the ground with a high sun, a green light optical thickness of 8 (like Titan) with a single scattering albedo (SSA) of about 85% transmits 10% of the light. Seen from space the reflected light of an optically thick haze cloud of optical thickness 8 may be about the SSA raised to the 8th power (probably a coincidence), or about .25 (about the actual albedo). I'll be testing these out in my software to help refine things. The SSA values for Titan in red/green/blue light are around 0.95, 0.90, 0.85, and vary with altitude.

The absorption extinction coefficient divided by the scattering extinction coefficient is equal to the single scattering albedo. Extinction coefficient has units of inverse distance, and single scattering albedo is dimensionless. We can look for any comments in the code to try and figure out the physical units. I recall seeing a web address of a reference that can help too, I think with the Earth/Titan code.
Last edited by scalbers on 22.03.2017, 17:13, edited 1 time in total.
http://stevealbers.net

Avatar
Topic author
FarGetaNik M
Posts: 484
Joined: 05.06.2012
With us: 11 years 11 months
Location: Germany

Post #30by FarGetaNik » 22.03.2017, 07:40

It's quite interesting getting Celestia to render realistic atmospheres, even with its current limitations. It would be neat to have more reference data or at least images, to know how the atmoshpheres behave at all phase angles. The physics involves seems not as simple as I hoped for. All parameters are connected somehow, that's probably why I get somewhat unpredictable results when changing some parameters. I have to do more research on this subject.

Ok the transmitted fraction of light depends on the scattered fraction, makes sense. I was asking for the sole effect of absorbtion though, like the effects of ozon on Earth color. It is relatively simple to measure the color due to absorption and convert it to a fraction, but not an extinction coefficient. But maybe it isn't possible to regard it seperately.

Added after 3 hours 53 minutes:
I've worked on Venus. I based the appearance on this picture, found on unmannedspaceflight.com. I can't use the scale height of 15 km together with a cloud height of 50 km. It produces a bug, hence it's somewhat higher. This time the atmophere is rendered with Mie and Absoprtion:

Code: Select all

   Atmosphere
   {

      Height      200
      MieScaleHeight   27
      Mie      0.02
      MieAsymmetry   -0.1
      Absorption   [ 0.0044 0.0040 0.0004 ]   # 0.106 0.098 0.043
 
      CloudMap   "venus-clouds.*"
      CloudHeight   48.5
      CloudSpeed   90
   }

It looks like a white marble now:

venus-white-marble.jpg


Here the cloud texture I'm using, based on Celestia's default Venus cloud texture:

venus-clouds.jpg

scalbers
Posts: 138
Joined: 30.01.2005
With us: 19 years 3 months

Post #31by scalbers » 22.03.2017, 17:24

Indeed Venus is a good object for reference and your views look fairly close. With thick clouds like Venus the "effective" asymmetry is smaller and one runs into questions about how asymmetry (that relates more to thin clouds) transitions into reflectance as thick clouds behave somewhat more like a solid white surface (hence my snow analogy). A little bit more forward scattering might be worth a try to brighten up the crescent. This depends on how much of the displayed brightness changes can be shown. There should be only weak absorption. Is it redundant to have this in the texture and in the Mie Absorption parameters? This all sounds a bit complex though I hope to develop a clearer handling of this in my software so hopefully I can then explain it better in the context of Celestia use.

Recall that I've been looking a bright white clouds on Earth and comparing with things like DSCOVR imagery. We can dig around for various reference data, though Venus has a well known overall phase function for its astronomical magnitude so this can help check things. The associated BRDF can be constructed to give results consistent with this, and as a quick convenient test I'm considering what I've been setting up for snow.
http://stevealbers.net

Avatar
Topic author
FarGetaNik M
Posts: 484
Joined: 05.06.2012
With us: 11 years 11 months
Location: Germany

Post #32by FarGetaNik » 22.03.2017, 18:43

I'm looking more for reference images. Except for Telescopic views, the only spacecraft image in true color was the Messenger view I linked. I don't quite understand Mie scattering in Celestia myself, so I use some parameters that reproduce what I see in images. Phase funktions won't help much in his case, only if we understand how Celestia does it's renders. More forward scattering can easily be done, it's just that the artifacts of this render method increase. The absorption has little effect on the clouds (because the scale height is much smaller than cloud altitude), it just gives a subtle blue hue near the edge of the planet. At first I thought Rayleigh might be responsible for this phenomenon, but I can't recreate it with Rayleigh scattering in Celestia.

The white cloud texture certainly is not redundant in this case, here a view of Venus using the very same parameter, but cloud rendering disabled:

venus-surface.jpg


I feel Mie scattering can recreate the clouds of Venus, it's just not the case with Celestia.

scalbers
Posts: 138
Joined: 30.01.2005
With us: 19 years 3 months

Post #33by scalbers » 22.03.2017, 18:58

Here are a couple of images for comparison, with some good explanations:

http://mentallandscape.com/Venus_Visible.htm

http://www.donaldedavis.com/2002_addons/SSYCOLRS.html (scroll to see Venus)

Otherwise, the redundancy I was thinking of would be a white texture with the absorption turned on vs a hint of yellow/brown texture with absorption turned off. In both cases the cloud rendering would be on.
http://stevealbers.net

Avatar
Topic author
FarGetaNik M
Posts: 484
Joined: 05.06.2012
With us: 11 years 11 months
Location: Germany

Post #34by FarGetaNik » 23.03.2017, 08:41

Oh I see, sorry I didn't get you meant the absorption. Well while processing the texture I wanted to remain relative colors, so the polar regons turned out a bit blueish (sky blue or cyan), while the equator remained yellowish. I think this color is real and not an effect of absorption. In spacecraft images, there is a bright, blueish belt visible at high lattitudes, but the polar regions are yellow again. I agree that the texture doesn't reflect that well. I'm still searching for a good Venus cloud texture...

Added after 8 hours 36 minutes:
And thanks for the links, this will help for realistic renders of many planets.

scalbers
Posts: 138
Joined: 30.01.2005
With us: 19 years 3 months

Post #35by scalbers » 23.03.2017, 17:19

Sounds good. There is a bit of a distinction I can suggest in that the color of the clouds (in the real Venus) is actually caused by differential absorption. Maybe there's a distinction between the absorption occurring during the scattering process and absorption as light transverses larger cloud droplets, as there is on Earth. I think though the main item would be the scattering process. It might be interesting to check on research about the Venusian cloud optical properties.

The texture looks reasonable if you are treating the clouds like kind of a solid surface. At some point it would be interesting to see how Celestia handles a landing on Venus.
http://stevealbers.net

Avatar
Topic author
FarGetaNik M
Posts: 484
Joined: 05.06.2012
With us: 11 years 11 months
Location: Germany

Post #36by FarGetaNik » 24.03.2017, 10:31

Hm my absorption parameters cause a blue hue, so the surface would appear similarly blue. Maybe absorption due to scattering could make a more orange hue, comparable to Venera images (but the actual color on the surface of Venus is hard to calibrate).

Also I've redone the cloud texture. Equator and polar regions are orange, the belt between more blue.

venus-clouds.jpg

scalbers
Posts: 138
Joined: 30.01.2005
With us: 19 years 3 months

Post #37by scalbers » 24.03.2017, 17:49

Looks like Venus has a glory seen from above: https://arxiv.org/pdf/1406.0277.pdf

Elsewhere I can note an optical thickness of around 25 for Venus clouds. Possibly the CO2 in the atmosphere add another 15 with Rayleigh scattering, coloring Venus more blue? Only 2.5% of solar radiation is absorbed in the clouds.

http://onlinelibrary.wiley.com/doi/10.1029/JA085iA13p08167/full

At the surface, the Rayleigh scattering component would make the color more orange, since the blue is scattered back to space.
http://stevealbers.net

Avatar
Topic author
FarGetaNik M
Posts: 484
Joined: 05.06.2012
With us: 11 years 11 months
Location: Germany

Post #38by FarGetaNik » 27.03.2017, 09:39

The glory is a neat effect, but nothing I would consider for Celestia yet. The opposition surge on solid surfaces is a more important effect we would need imo.

Wow an optical thickness of 25 means the surface should be really dark! The sunlight should be dimmed by 27 magnitudes, right? Rayleigh scattering is to be considered for sure, but with such high optical thickness the effect as seen from space should be minimal. With Celestia's current atmosphere models, at best I could produce a blue rim around Venus, but no color gradient for the clouds (hence my absorption insted of Rayleigh). The surface would be affected considerably, but dimming it again by a factor of e^15 would make it pitch-black...

scalbers
Posts: 138
Joined: 30.01.2005
With us: 19 years 3 months

Post #39by scalbers » 27.03.2017, 17:28

I agree that land BRDFs (or phase functions) would be helpful with adding an opposition surge.

A blue rim sounds reasonable. It turns out that the 27 magnitudes only applies to direct sunlight. Since much of the scattering is in the forward direction, about 30% of the sunlight will filter down to the ground. I'm guessing the optical thickness of the CO2 doing some Rayleigh scattering would be around 15 or so, though I need to further research the scattering properties of CO2. Thus a blue sky may kind of compete with the clouds, looking from space. The orange light seen on the surface may result more from Rayleigh scattering than from cloud absorbers.

I'm making gradual process in figuring out Titan as well with its optical properties to try and get a surface view. About 10% of the sunlight makes it through the haze to the surface with an overhead sun, though this might apply more to red wavelengths and green would be less. It's a bit tricky to get the distribution of this light in the sky as it wouldn't be uniform. Some recent Cassini images show orange clouds in visible light partially underneath the haze.
http://stevealbers.net

Avatar
Topic author
FarGetaNik M
Posts: 484
Joined: 05.06.2012
With us: 11 years 11 months
Location: Germany

Post #40by FarGetaNik » 28.03.2017, 09:09

Thanks for the imput. When experimenting with Venus' atmophere parameters I ended up with a unnatural blue circle around Venus, so I dismissed Rayleigh it and used Absorption instead. With my latest Mie parameters I now was able to get the same appearance with Rayleigh scattering instead of Absorption.

Code: Select all

   Atmosphere
   {
      Height      200
      MieScaleHeight   27
      Mie      0.02
      MieAsymmetry   -0.2
      Rayleigh   [ 0.0031 0.0058 0.0120 ]

      CloudMap   "venus-clouds.*"
      CloudHeight   48.5
      CloudSpeed   90
   }

So from the surface of Venus the sun itself is dimmed by 27 mags, but all the scattered light from the atmosphere makes up for that? Ok that makes a lot more sense now. I always thought other small aerosols would increase Rayleigh scattering also, you corrected me on that already, but could other molecules in Venus' atmosphere have a significant impact in Rayleigh scattering compared to CO2?

Titan is a tricky one. Did Huygens record any color or spectral data? Are there phase functions for Titan's atmophere?


Return to “Celestia Users”