From 77bc2d4e6d1ad197792a73b17d2e5fed4d8fe48f Mon Sep 17 00:00:00 2001 From: Jonathas Costa Date: Wed, 24 Jul 2019 15:52:27 -0400 Subject: [PATCH] Improved Mars illumination. --- .../scene/solarsystem/planets/mars/atmosphere.asset | 2 ++ modules/atmosphere/rendering/renderableatmosphere.cpp | 11 ++++++++++- modules/atmosphere/rendering/renderableatmosphere.h | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/data/assets/scene/solarsystem/planets/mars/atmosphere.asset b/data/assets/scene/solarsystem/planets/mars/atmosphere.asset index 2850e528ca..bffdc14094 100644 --- a/data/assets/scene/solarsystem/planets/mars/atmosphere.asset +++ b/data/assets/scene/solarsystem/planets/mars/atmosphere.asset @@ -16,6 +16,8 @@ local Atmosphere = { PlanetRadius = 3386.190, PlanetAverageGroundReflectance = 0.1, GroundRadianceEmittion = 0.37, + SunIntensity = 6.7, + MieScatteringExtinctionPropCoefficient = 0.23862, Rayleigh = { Coefficients = { -- Wavelengths are given in 10^-9m diff --git a/modules/atmosphere/rendering/renderableatmosphere.cpp b/modules/atmosphere/rendering/renderableatmosphere.cpp index d7e556384d..232a70b011 100644 --- a/modules/atmosphere/rendering/renderableatmosphere.cpp +++ b/modules/atmosphere/rendering/renderableatmosphere.cpp @@ -266,6 +266,7 @@ RenderableAtmosphere::RenderableAtmosphere(const ghoul::Dictionary& dictionary) , _mieHeightScale(0.f) , _miePhaseConstant(0.f) , _sunRadianceIntensity(5.f) + , _mieScattExtPropCoefProp(1.f) , _mieExtinctionCoeff(glm::vec3(0.f)) , _rayleighScatteringCoeff(glm::vec3(0.f)) , _ozoneExtinctionCoeff(glm::vec3(0.f)) @@ -409,6 +410,12 @@ RenderableAtmosphere::RenderableAtmosphere(const ghoul::Dictionary& dictionary) SunIntensityInfo.identifier ); } + + if (atmosphereDictionary.hasKey(MieScatteringExtinctionPropCoeffInfo.identifier)) { + _mieScattExtPropCoefProp = atmosphereDictionary.value( + MieScatteringExtinctionPropCoeffInfo.identifier + ); + } if (!atmosphereDictionary.getValue( GroundRadianceEmittioninfo.identifier, @@ -634,8 +641,10 @@ RenderableAtmosphere::RenderableAtmosphere(const ghoul::Dictionary& dictionary) _mieScatteringCoeffZP.onChange(updateAtmosphere); addProperty(_mieScatteringCoeffZP); - _mieScatteringExtinctionPropCoefficientP = + _mieScatteringExtinctionPropCoefficientP = + _mieScattExtPropCoefProp != 1.f ? _mieScattExtPropCoefProp : _mieScatteringCoeff.x / _mieExtinctionCoeff.x; + _mieScatteringExtinctionPropCoefficientP.onChange(updateAtmosphere); addProperty(_mieScatteringExtinctionPropCoefficientP); diff --git a/modules/atmosphere/rendering/renderableatmosphere.h b/modules/atmosphere/rendering/renderableatmosphere.h index d86f068ca7..202933b593 100644 --- a/modules/atmosphere/rendering/renderableatmosphere.h +++ b/modules/atmosphere/rendering/renderableatmosphere.h @@ -122,6 +122,7 @@ private: float _mieHeightScale; float _miePhaseConstant; float _sunRadianceIntensity; + float _mieScattExtPropCoefProp; glm::vec3 _mieExtinctionCoeff; glm::vec3 _rayleighScatteringCoeff;