Add Titan atmosphere, increase scale height for Venus (closes #922)

This commit is contained in:
Alexander Bock
2021-04-29 14:14:52 +02:00
parent fb8e80ea80
commit 261f3d9fe8
6 changed files with 74 additions and 29 deletions
@@ -24,7 +24,7 @@ local Atmosphere = {
Scattering = { 5.8E-3, 13.5E-3, 33.1E-3 },
-- In Rayleigh scattering, the coefficients of absorption and scattering are the same.
},
-- Thichkness of atmosphere if its density were uniform, in Km
-- Thickness of atmosphere if its density were uniform, in Km
H_R = 8.0
},
--[[
@@ -24,7 +24,7 @@ local Atmosphere = {
-- In Rayleigh scattering, the coefficients of
-- absorption and scattering are the same.
},
-- Thichkness of atmosphere if its density were uniform, in Km
-- Thickness of atmosphere if its density were uniform, in Km
H_R = 10.43979
},
-- Default
@@ -6,6 +6,7 @@ asset.require('./mimas/mimas')
asset.require('./rhea/rhea')
asset.require('./tethys/tethys')
asset.require('./titan/titan')
asset.require('./titan/atmosphere')
asset.meta = {
@@ -0,0 +1,58 @@
local transforms = asset.require('./titan')
local assetHelper = asset.require('util/asset_helper')
local Atmosphere = {
Identifier = "TitanAtmosphere",
Parent = transforms.Titan.Identifier,
Renderable = {
Type = "RenderableAtmosphere",
-- Atmosphere radius in Km
AtmosphereHeight = 2666.0 - 2576.0,
PlanetRadius = 2576.0,
PlanetAverageGroundReflectance = 0.1,
GroundRadianceEmission = 0.9,
SunIntensity = 6.9,
Rayleigh = {
Coefficients = {
-- Wavelengths are given in 10^-9m
Wavelengths = { 680, 550, 440 },
-- Reflection coefficients are given in km^-1
Scattering = { 5.349578367831898E-3, 12.65595939366191E-3, 31.331782953393245E-3 },
},
-- Thickness of atmosphere if its density were uniform, in Km
H_R = 20.0
},
Mie = {
Coefficients = {
-- Reflection coefficients are given in km^-1
Scattering = { 5e-3, 12e-3, 80e-3 },
-- Extinction coefficients are a fraction of the Mie coefficients
Extinction = { 4.0e-3/0.37, 4.0e-3/0.37, 4.0e-3/0.37 }
},
-- Height scale (atmosphere thickness for constant density) in Km
H_M = 14.85,
-- Mie Phase Function Value (G e [-1.0, 1.0]. If G = 1.0, Mie phase function = Rayleigh Phase Function)
G = -0.52
},
Debug = {
PreCalculatedTextureScale = 1.0,
SaveCalculatedTextures = false
}
},
GUI = {
Name = "Titan Atmosphere",
Path = "/Solar System/Planets/Saturn/Moons/Titan"
}
}
assetHelper.registerSceneGraphNodesAndExport(asset, { Atmosphere })
asset.meta = {
Name = "Titan Atmosphere",
Version = "1.0",
Description = [[ RenderableAtmosphere for Titan.]],
Author = "OpenSpace Team",
URL = "http://openspaceproject.com",
License = "MIT license",
Identifiers = { "TitanAtmosphere" }
}
@@ -23,8 +23,9 @@ local Atmosphere = {
-- In Rayleigh scattering, the coefficients of
-- absorption and scattering are the same.
},
-- Thichkness of atmosphere if its density were uniform, in Km
H_R = 3.53
-- Thickness of atmosphere if its density were uniform, in Km
H_R = 15.9 -- from https://nssdc.gsfc.nasa.gov/planetary/factsheet/venusfact.html
-- H_R = 3.53
},
-- Default
Mie = {
@@ -253,18 +253,18 @@ RenderableAtmosphere::RenderableAtmosphere(const ghoul::Dictionary& dictionary)
, _atmosphereHeight(AtmosphereHeightInfo, 60.f, 0.1f, 99.0f)
, _groundAverageReflectance(AverageGroundReflectanceInfo, 0.f, 0.f, 1.f)
, _groundRadianceEmission(GroundRadianceEmittioninfo, 0.f, 0.f, 1.f)
, _rayleighHeightScale(RayleighHeightScaleInfo, 0.f, 0.1f, 20.f)
, _rayleighHeightScale(RayleighHeightScaleInfo, 0.f, 0.1f, 50.f)
, _rayleighScatteringCoeff(
RayleighScatteringCoeffInfo,
glm::vec3(0.f), glm::vec3(0.00001f), glm::vec3(0.1f)
)
, _ozoneEnabled(OzoneLayerInfo, false)
, _ozoneHeightScale(OzoneHeightScaleInfo, 0.f, 0.1f, 20.f)
, _ozoneHeightScale(OzoneHeightScaleInfo, 0.f, 0.1f, 50.f)
, _ozoneCoeff(
OzoneLayerCoeffInfo,
glm::vec3(0.f), glm::vec3(0.00001f), glm::vec3(0.001f)
)
, _mieHeightScale(MieHeightScaleInfo, 0.f, 0.1f, 20.f)
, _mieHeightScale(MieHeightScaleInfo, 0.f, 0.1f, 50.f)
, _mieScatteringCoeff(
MieScatteringCoeffInfo,
glm::vec3(0.004f), glm::vec3(0.00001f), glm::vec3(1.f)
@@ -392,33 +392,12 @@ void RenderableAtmosphere::deinitializeGL() {
void RenderableAtmosphere::initializeGL() {
_deferredcaster = std::make_unique<AtmosphereDeferredcaster>();
_deferredcaster->setAtmosphereRadius(_planetRadius + _atmosphereHeight);
_deferredcaster->setPlanetRadius(_planetRadius);
_deferredcaster->setPlanetAverageGroundReflectance(_groundAverageReflectance);
_deferredcaster->setPlanetGroundRadianceEmittion(_groundRadianceEmission);
_deferredcaster->setRayleighHeightScale(_rayleighHeightScale);
_deferredcaster->enableOzone(_ozoneEnabled);
_deferredcaster->setOzoneHeightScale(_ozoneHeightScale);
_deferredcaster->setMieHeightScale(_mieHeightScale);
_deferredcaster->setMiePhaseConstant(_miePhaseConstant);
_deferredcaster->setSunRadianceIntensity(_sunIntensity);
_deferredcaster->setRayleighScatteringCoefficients(_rayleighScatteringCoeff);
_deferredcaster->setOzoneExtinctionCoefficients(_ozoneCoeff);
_deferredcaster->setMieScatteringCoefficients(_mieScatteringCoeff);
_deferredcaster->setMieExtinctionCoefficients(_mieExtinctionCoeff);
// TODO: Fix the ellipsoid nature of the renderable globe (JCC)
//_deferredcaster->setEllipsoidRadii(_ellipsoid.radii());
_deferredcaster->enableSunFollowing(_sunFollowingCameraEnabled);
_deferredcaster->setPrecalculationTextureScale(_preCalculatedTexturesScale);
if (_saveCalculationsToTexture)
_deferredcaster->enablePrecalculationTexturesSaving();
updateAtmosphereParameters();
if (_shadowEnabled) {
_deferredcaster->setShadowConfigArray(_shadowConfArray);
// We no longer need it
_shadowConfArray.clear();
_deferredcaster->setHardShadows(_hardShadowsEnabled);
}
_deferredcaster->initialize();
@@ -481,8 +460,14 @@ void RenderableAtmosphere::updateAtmosphereParameters() {
_deferredcaster->setMieScatteringCoefficients(_mieScatteringCoeff);
_deferredcaster->setMieExtinctionCoefficients(_mieExtinctionCoeff);
_deferredcaster->enableSunFollowing(_sunFollowingCameraEnabled);
// TODO: Fix the ellipsoid nature of the renderable globe (JCC)
//_deferredcaster->setEllipsoidRadii(_ellipsoid.radii());
_deferredcaster->setPrecalculationTextureScale(_preCalculatedTexturesScale);
if (_saveCalculationsToTexture) {
_deferredcaster->enablePrecalculationTexturesSaving();
}
if (_shadowEnabled) {
_deferredcaster->setHardShadows(_hardShadowsEnabled);
}