mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-27 23:39:01 -06:00
Ozone Layer (still needs work).
This commit is contained in:
@@ -196,7 +196,7 @@ void AtmosphereDeferredcaster::preRaycast(const RenderData & renderData, const D
|
||||
program.setUniform("betaMieExtinction", _mieExtinctionCoeff);
|
||||
program.setUniform("mieG", _miePhaseConstant);
|
||||
program.setUniform("sunRadiance", _sunRadianceIntensity);
|
||||
program.setUniform("ozoneLayerEnabled", _ozoneEnabled);
|
||||
program.setUniform("ozoneLayerEnabled", (bool)_ozoneEnabled);
|
||||
program.setUniform("HO", _ozoneHeightScale);
|
||||
program.setUniform("betaOzoneExtinction", _ozoneExtinctionCoeff);
|
||||
|
||||
|
||||
@@ -72,8 +72,14 @@ float opticalDepth(const float H, const float r, const float mu, const float d)
|
||||
}
|
||||
|
||||
vec3 analyticTransmittance(const float r, const float mu, const float d) {
|
||||
return exp(- betaRayleigh * opticalDepth(HR, r, mu, d) -
|
||||
if (ozoneLayerEnabled) {
|
||||
return exp(-betaRayleigh * opticalDepth(HR, r, mu, d) -
|
||||
betaOzoneExtinction * (6.0e-7) * opticalDepth(HO, r, mu, d) -
|
||||
betaMieExtinction * opticalDepth(HM, r, mu, d));
|
||||
} else {
|
||||
return exp(-betaRayleigh * opticalDepth(HR, r, mu, d) -
|
||||
betaMieExtinction * opticalDepth(HM, r, mu, d));
|
||||
}
|
||||
}
|
||||
|
||||
vec3 irradiance(sampler2D sampler, const float r, const float muSun) {
|
||||
|
||||
@@ -183,14 +183,8 @@ void inscatter(float r, float mu, float muSun, float nu, inout vec3 radianceJ) {
|
||||
|
||||
// Finally, we add the atmospheric scale height (See: Radiation Transfer on the Atmosphere and Ocean from
|
||||
// Thomas and Stamnes, pg 9-10.
|
||||
if (ozoneLayerEnabled) {
|
||||
radianceJ += radianceJ1 * (betaOzoneExtinction * exp(-(r - Rg) / HO) * ((6e-7)*phaseRayleighWV) +
|
||||
betaRayleigh * exp(-(r - Rg) / HR) * phaseRayleighWV +
|
||||
betaMieScattering * exp(-(r - Rg) / HM) * phaseMieWV) * dw;
|
||||
} else {
|
||||
radianceJ += radianceJ1 * (betaRayleigh * exp(-(r - Rg) / HR) * phaseRayleighWV +
|
||||
betaMieScattering * exp(-(r - Rg) / HM) * phaseMieWV) * dw;
|
||||
}
|
||||
radianceJ += radianceJ1 * (betaRayleigh * exp(-(r - Rg) / HR) * phaseRayleighWV +
|
||||
betaMieScattering * exp(-(r - Rg) / HM) * phaseMieWV) * dw;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ void main(void) {
|
||||
vec3 opDepth = vec3(0.0);
|
||||
|
||||
if (ozoneLayerEnabled) {
|
||||
opDepth = betaOzoneExtinction * opticalDepth(r, muSun, HO) +
|
||||
opDepth = betaOzoneExtinction * (6.0e-7) * opticalDepth(r, muSun, HO) +
|
||||
betaMieExtinction * opticalDepth(r, muSun, HM) +
|
||||
betaRayleigh * opticalDepth(r, muSun, HR);
|
||||
} else {
|
||||
|
||||
@@ -626,23 +626,24 @@ void RenderableGlobe::updateAtmosphereParameters() {
|
||||
_exposureConstant != _atmosphereProperties.hdrExpositionP.value() ||
|
||||
_gammaConstant != _atmosphereProperties.gammaConstantP.value())
|
||||
executeComputation = false;
|
||||
_atmosphereRadius = _atmospherePlanetRadius + _atmosphereProperties.atmosphereHeightP.value();
|
||||
_atmosphereRadius = _atmospherePlanetRadius + _atmosphereProperties.atmosphereHeightP.value();
|
||||
_planetAverageGroundReflectance = _atmosphereProperties.groundAverageReflectanceP.value();
|
||||
_rayleighHeightScale = _atmosphereProperties.rayleighHeightScaleP.value();
|
||||
_rayleighScatteringCoeff = glm::vec3(_atmosphereProperties.rayleighScatteringCoeffXP.value() * 0.001f,
|
||||
_rayleighHeightScale = _atmosphereProperties.rayleighHeightScaleP.value();
|
||||
_rayleighScatteringCoeff = glm::vec3(_atmosphereProperties.rayleighScatteringCoeffXP.value() * 0.001f,
|
||||
_atmosphereProperties.rayleighScatteringCoeffYP.value() * 0.001f,
|
||||
_atmosphereProperties.rayleighScatteringCoeffZP.value() * 0.001f);
|
||||
_ozoneLayerHeightScale = _atmosphereProperties.ozoneHeightScaleP.value();
|
||||
_ozoneLayerEnabled = _atmosphereProperties.ozoneLayerEnabledP.value();
|
||||
_ozoneLayerHeightScale = _atmosphereProperties.ozoneHeightScaleP.value();
|
||||
_ozoneLayerExtinctionCoeff = glm::vec3(_atmosphereProperties.ozoneLayerExtinctionCoeffXP.value() * 0.00001f,
|
||||
_atmosphereProperties.ozoneLayerExtinctionCoeffYP.value() * 0.00001f,
|
||||
_atmosphereProperties.ozoneLayerExtinctionCoeffZP.value() * 0.00001f);
|
||||
_mieHeightScale = _atmosphereProperties.mieHeightScaleP.value();
|
||||
_mieScatteringCoeff = glm::vec3(_atmosphereProperties.mieScatteringCoefficientP.value() * 0.001f);
|
||||
_mieExtinctionCoeff = _mieScatteringCoeff * (1.0f / static_cast<float>(_atmosphereProperties.mieScatteringExtinctionPropCoefficientP.value()));
|
||||
_miePhaseConstant = _atmosphereProperties.mieAsymmetricFactorGP.value();
|
||||
_mieHeightScale = _atmosphereProperties.mieHeightScaleP.value();
|
||||
_mieScatteringCoeff = glm::vec3(_atmosphereProperties.mieScatteringCoefficientP.value() * 0.001f);
|
||||
_mieExtinctionCoeff = _mieScatteringCoeff * (1.0f / static_cast<float>(_atmosphereProperties.mieScatteringExtinctionPropCoefficientP.value()));
|
||||
_miePhaseConstant = _atmosphereProperties.mieAsymmetricFactorGP.value();
|
||||
_sunRadianceIntensity = _atmosphereProperties.sunIntensityP.value();
|
||||
_exposureConstant = _atmosphereProperties.hdrExpositionP.value();
|
||||
_gammaConstant = _atmosphereProperties.gammaConstantP.value();
|
||||
_exposureConstant = _atmosphereProperties.hdrExpositionP.value();
|
||||
_gammaConstant = _atmosphereProperties.gammaConstantP.value();
|
||||
|
||||
if (_deferredcaster) {
|
||||
_deferredcaster->setAtmosphereRadius(_atmosphereRadius);
|
||||
|
||||
Reference in New Issue
Block a user