Added night layer with new atm.

This commit is contained in:
Jonathas Costa
2017-10-31 14:30:33 -04:00
parent f945c690fd
commit cbe1e870a5
3 changed files with 14 additions and 12 deletions
+2
View File
@@ -94,6 +94,8 @@ function postInitialization()
openspace.setPropertyValue("Earth.RenderableGlobe.PerformShading", false)
openspace.setPropertyValue("Earth.RenderableGlobe.Layers.NightLayers.Earth at Night 2012.Settings.Multiplier", 1.0);
openspace.globebrowsing.goToGeo(58.5877, 16.1924, 20000000)
openspace.printInfo("Done setting default values")
@@ -198,11 +198,6 @@ void AtmosphereDeferredcaster::preRaycast(const RenderData& renderData, const De
const Renderer * currentRenderer = OsEng.renderEngine().renderer();
const float * mssaPatternArray = currentRenderer->mSSAPattern();
/*for (int i = 0; i < OsEng.renderEngine().renderer()->nAaSamples() * 3; ++i) {
std::cout << mssaPatternArray[i] << " ";
}
std::cout << std::endl;*/
// Atmosphere Frustum Culling
glm::dvec3 tPlanetPosWorld = glm::dvec3(_modelTransform * glm::dvec4(0.0, 0.0, 0.0, 1.0));
@@ -463,7 +463,8 @@ vec3 groundColor(const vec3 x, const float t, const vec3 v, const vec3 s, const
float r0 = length(x0);
// Normal of intersection point.
vec3 n = normalize(normal);
vec4 groundReflectance = groundColor * vec4(.37);
//vec4 groundReflectance = groundColor * vec4(.37);
vec4 groundReflectance = groundColor * vec4(.6);
// L0 is not included in the irradiance texture.
// We first calculate the light attenuation from the top of the atmosphere
@@ -471,16 +472,20 @@ vec3 groundColor(const vec3 x, const float t, const vec3 v, const vec3 s, const
float muSun = max(dot(n, s), 0.0);
// Is direct Sun light arriving at x0? If not, there is no direct light from Sun (shadowed)
vec3 transmittanceL0 = muSun < -sqrt(1.0f - ((Rg * Rg) / (r0 * r0))) ? vec3(0.0f) : transmittanceLUT(r0, muSun);
// E[L*] at x0
vec3 irradianceReflected = irradiance(irradianceTexture, r0, muSun) * irradianceFactor;
// R[L0] + R[L*]
vec3 groundRadiance = groundReflectance.rgb * (muSun * transmittanceL0 + irradianceReflected)
* sunIntensity / M_PI;
// Night illumination from cities
//groundRadiance *= mix(5.0, 1.0, dot(n,s));
vec3 groundRadiance = vec3(0.0f);
if (muSun < 0.9) {
// Night illumination from cities
groundRadiance = mix(groundReflectance.rgb * vec3(1.7),
groundReflectance.rgb * (muSun * transmittanceL0 + irradianceReflected) * sunIntensity / M_PI,
muSun);
} else {
groundRadiance = groundReflectance.rgb * (muSun * transmittanceL0 + irradianceReflected) * sunIntensity / M_PI;
}
//groundRadiance = groundReflectance.rgb * (muSun * transmittanceL0 + irradianceReflected) * sunIntensity / M_PI;
// Specular reflection from sun on oceans and rivers
if ((waterReflectance > 0.1) && (muSun > 0.0)) {