pioneerspacesim / pioneer

A game of lonely space adventure
https://pioneerspacesim.net
1.61k stars 367 forks source link

Saturn has no visible atmosphere #1395

Closed Luomu closed 10 years ago

Luomu commented 12 years ago

Notice altitude, mere 1500 m from the surface

Ae-2222 commented 12 years ago

The lua defs for gas giants are overridden here:

void SystemBody::PickAtmosphere() 
{
...
switch (type) {
        case SystemBody::TYPE_PLANET_GAS_GIANT:
            m_atmosColor = Color(1.0f, 1.0f, 1.0f, 0.0005f);
            m_atmosDensity = 14.0;
            break;

The colour is white and the density is 14 times Earth (1kg/m^3).

I've checked the values sent to the shaders and they are ok..except for the fact that the molar mass of Earth air is used.. which is a lot heavier than hydrogen:)

Saturn does have an atmosphere but it seems to be crushed by the high gravity to an extent with a scale height of ~3340m (low temps affect it badly as well). Density and colour are correct, the white towards the horizon should be the atmosphere.

This will be fixed eventually when atmospheres have their own compositions.

Jupiter should have these problems too.

The solution, temporarily, may be to increase values sent to the shader for gas giants in Geosphere::Render() i.e. multiply the atmosScaleHeight by some factor X*(radius/Earth radius). X should be 3.0+ which should give scale height that's at least similar to Earth's scale height relative to its radius.

johnbartholomew commented 11 years ago

Similar problems on Jupiter.

On Venus, another atmosphere problem: the atmospheric pressure is insanely high:

Venus atmospheric pressure

Check the pressure and altitude read-outs on the ship scanner. It's unclear whether this is caused by the same underlying problem or if it's a separate bug.

Ae-2222 commented 11 years ago

Ae-2222 wrote: Jupiter should have these problems too.

The atmosphere equations for rendering are separate from those used in physics. The gas giant problem is the one I mention above due to incorrect values for atmosphere properties and height being meaningless for gas giants.

The Venus issue is a typed error in an expression which didn't show up in Earth tests due to a bad coincidence with the units used and, is fixed in #1431.

Loki999 commented 11 years ago

Just for further info, tried to gather hydrogen at a small gas giant, only 6 earth masses, thought it wouldn't suffer the same issue.

Planet is Edwa C g - star coordinates -4,0,89

No atmosphere even down to 100m altitude. Zero pressure as well.

Loki999 commented 11 years ago

Strangely enough, MJBN 834-6+5 d (-6,5,82) with a gravity of 23, radii 2.38 (Edwa C g had a gravity of 18, radii 1.8), could be refueled from, although had to be less than 1000m altitude for it to kick in.

Ae-2222 commented 11 years ago

The problem concerning colour is known, and the 'proper' solution involves drawing the planet surface much deeper into the atmosphere solving being able to land on the surface as well.

Zero pressure as well

This is more of an issue..Gas giants are hard-wired to have 14 kg/m^3 density at the surface. It could just be that there's no pressure due to surface temperature being close to zero (due to various issues) which will be dealt with. There should be a surface temperature read out in planet info.

Loki999 commented 11 years ago
Gas giants are hard-wired to have 14 kg/m^3

Which is just bizarre and probably should be fixed at the same time as the rest.

Ae-2222 commented 11 years ago

Gas giants are hard-wired to have 14 kg/m^3 density at the surface


:D gas giants don't have a surface as such, so the value is just there to tweak things. The radius commonly quoted is the radius at which there is 1 atm of pressure. The proper solution in this case is involved and requires branches on atmospheres, softfloat temperature calculations, and separation of rendering radii to be completed and merged, before the problem can be fixed in a branch.


Luomu confirmed there was a 0 temperature issue which has been worked around in #1712.

shadmar commented 11 years ago

For a visual quickfix for this in SystemBody::PickAtmosphere()

//Gas giant atmos : (type)
    switch (type) {
        case SystemBody::TYPE_PLANET_GAS_GIANT:
            m_atmosColor = Color(0.6f, 0.5f, 0.5f, 0.01f);  //visual quickfix hack
            m_atmosDensity = 14.0;
            break;

Then in SystemBody::AtmosphereParameters SystemBody::CalcAtmosphereParams() const

        float atmosScaleHeight = static_cast<float>(GAS_CONSTANT_R*T/(M*g));

    //GAS GIANT visual quickfix hack
    if (type==SystemBody::TYPE_PLANET_GAS_GIANT) atmosScaleHeight *= 10.0f;

On Neptune it would look like this 16 km up;

Alt Text

Ae-2222 commented 11 years ago

f (type==SystemBody::TYPE_PLANET_GAS_GIANT) atmosScaleHeight *= 10.0f;

It's along the lines of what I wrote earlier, but:

The solution, temporarily, may be to increase values sent to the shader for gas giants in Geosphere::Render() i.e. multiply the atmosScaleHeight by some factor X*(radius/Earth radius). X should be 3.0+ which should give scale height that's at least similar to Earth's scale height relative to its radius.

Some gas giants may be so huge and have such high gravity that the scale heights may be small compared to their radii. This will make it hard to see the 'atmosphere'.

The scaleheight issue has been mostly dealt with in the first part of the atmosphere branch, but as the complete atmosphere stuff will not be ready at least until the alpha after the next, it might be worthwhile to submit a workaround. This isn't the proper solution, and won't fix the pressure part of the problem, but I'll look into submitting a temporary fix today or tomorrow unless you get around to it first..

m_atmosColor = Color(0.6f, 0.5f, 0.5f, 0.01f); //visual quickfix hack

This has made the gas density much higher..it might end up obscuring the surface detail (selecting a planet and clicking ctrl+f10 will display it on the object viewer). Since we are actually drawing gas giant clouds with the surface colours, the plain atmosphere gets in the way, heh :)

shadmar commented 11 years ago

but I'll look into submitting a temporary fix today or tomorrow unless you get around to it first..

Sure go ahead, better than nothing until there's a proper solution I'd guess :)

This has made the gas density much higher..it might end up obscuring the surface detail (selecting a planet and clicking ctrl+f10 will display it on the object viewer). Since we are actually drawing gas giant clouds with the surface colours, the plain atmosphere gets in the way, heh :)

Yeah I noticed, I only tested quickly on neptune and jupiter, but I can see how it obscures the surface on some seeds.

johnbartholomew commented 10 years ago

Fixed by #2609.