Page 2 of 3

Posted: 19.03.2017, 21:06
by FarGetaNik
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.

Posted: 19.03.2017, 21:20
by Alexell
Class "Atmosphere" in src\celengine\atmosphere.h

Code: Select all

class Atmosphere
    Atmosphere() :
        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),

    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)

Posted: 19.03.2017, 21:42
by scalbers
OK - I can see these mentions of RayleighScaleHeight in the code:✓&q=rayleighscaleheight

I suppose understanding how these pieces work together would be of interest.

Posted: 20.03.2017, 09:25
by FarGetaNik
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.


Posted: 20.03.2017, 16:42
by scalbers
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.

Posted: 20.03.2017, 18:26
by FarGetaNik
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...

Posted: 21.03.2017, 00:19
by scalbers
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: ... ls/atmosphere/scattertable.cpp

Posted: 21.03.2017, 08:59
by FarGetaNik
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

      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:


Posted: 21.03.2017, 19:02
by scalbers
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.

Posted: 22.03.2017, 07:40
by FarGetaNik
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 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


      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:


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


Posted: 22.03.2017, 17:24
by scalbers
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.

Posted: 22.03.2017, 18:43
by FarGetaNik
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:


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

Posted: 22.03.2017, 18:58
by scalbers
Here are a couple of images for comparison, with some good explanations: (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.

Posted: 23.03.2017, 08:41
by FarGetaNik
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.

Posted: 23.03.2017, 17:19
by scalbers
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.

Posted: 24.03.2017, 10:31
by FarGetaNik
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.


Posted: 24.03.2017, 17:49
by scalbers
Looks like Venus has a glory seen from above:

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.

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

Posted: 27.03.2017, 09:39
by FarGetaNik
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...

Posted: 27.03.2017, 17:28
by scalbers
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.

Posted: 28.03.2017, 09:09
by FarGetaNik
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

      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?