Planetary Atmospheres Light Scattering

Description: General discussion about Celestia that doesn't fit into other forums.

FarGetaNik M
Topic author
Avatar
FarGetaNik M
Topic author
Posts: 242
With us: 4 years 9 months
Location: Germany

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

Alexell M
Site Admin
Avatar
Alexell M
Site Admin
Age: 23
Posts: 183
With us: 6 years 5 months
Location: Moscow, Russia
ICQ Facebook Skype Twitter

#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 celestiaproject.net.
PC: Lenovo IdeaPad Z570. Intel Core i5-2450M CPU @ 2.50GHz, 8 ГБ ОЗУ, NVIDIA GeForce GT 540M, Windows 7 Ultimate x64.
Phone: iPhone 5S 16 Gb. iOS 10.
Image

scalbers
scalbers
Posts: 120
With us: 12 years 1 month

#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

FarGetaNik M
Topic author
Avatar
FarGetaNik M
Topic author
Posts: 242
With us: 4 years 9 months
Location: Germany

#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 3 times

scalbers
scalbers
Posts: 120
With us: 12 years 1 month

#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

FarGetaNik M
Topic author
Avatar
FarGetaNik M
Topic author
Posts: 242
With us: 4 years 9 months
Location: Germany

#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
scalbers
Posts: 120
With us: 12 years 1 month

#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

FarGetaNik M
Topic author
Avatar
FarGetaNik M
Topic author
Posts: 242
With us: 4 years 9 months
Location: Germany

#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
scalbers
Posts: 120
With us: 12 years 1 month

#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

FarGetaNik M
Topic author
Avatar
FarGetaNik M
Topic author
Posts: 242
With us: 4 years 9 months
Location: Germany

#30by FarGetaNik » Yesterday, 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
scalbers
Posts: 120
With us: 12 years 1 month

#31by scalbers » Yesterday, 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

FarGetaNik M
Topic author
Avatar
FarGetaNik M
Topic author
Posts: 242
With us: 4 years 9 months
Location: Germany

#32by FarGetaNik » Yesterday, 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
scalbers
Posts: 120
With us: 12 years 1 month

#33by scalbers » Yesterday, 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

FarGetaNik M
Topic author
Avatar
FarGetaNik M
Topic author
Posts: 242
With us: 4 years 9 months
Location: Germany

#34by FarGetaNik » Today, 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...


Return to “Celestia Users”

Who is online (over the past 5 minutes)

Users browsing this forum: 12 guests