Skip to content

Commit

Permalink
Modify tonemapping constants, globe, fog, and atmosphere
Browse files Browse the repository at this point in the history
  • Loading branch information
ggetz committed Jul 10, 2018
1 parent 4386f78 commit 8cf28a6
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Source/Scene/Fog.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ define([
* @type {Number}
* @default 0.1
*/
this.minimumBrightness = 0.1;
this.minimumBrightness = 0.01;
}

// These values were found by sampling the density at certain views and finding at what point culled tiles impacted the view at the horizon.
Expand Down
6 changes: 3 additions & 3 deletions Source/Shaders/Builtin/Functions/fog.glsl
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**
* Gets the color with fog at a distance from the camera.
*
*
* @name czm_fog
* @glslFunction
*
*
* @param {float} distanceToCamera The distance to the camera in meters.
* @param {vec3} color The original color.
* @param {vec3} fogColor The color of the fog.
Expand All @@ -14,6 +14,6 @@ vec3 czm_fog(float distanceToCamera, vec3 color, vec3 fogColor)
{
float scalar = distanceToCamera * czm_fogDensity;
float fog = 1.0 - exp(-(scalar * scalar));

return mix(color, fogColor, fog);
}
11 changes: 8 additions & 3 deletions Source/Shaders/GlobeFS.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ void main()
#endif

#ifdef FOG
const float fExposure = 2.0;
const float fExposure = 1.3;
vec3 fogColor = v_mieColor + finalColor.rgb * v_rayleighColor;
fogColor = vec3(1.0) - exp(-fExposure * fogColor);

Expand Down Expand Up @@ -337,9 +337,14 @@ vec4 computeWaterColor(vec3 positionEyeCoordinates, vec2 textureCoordinates, mat
// Add specular highlights in 3D, and in all modes when zoomed in.
float specularIntensity = czm_getSpecular(czm_sunDirectionEC, normalizedpositionToEyeEC, normalEC, 10.0) + 0.25 * czm_getSpecular(czm_moonDirectionEC, normalizedpositionToEyeEC, normalEC, 10.0);
float surfaceReflectance = mix(0.0, mix(u_zoomedOutOceanSpecularIntensity, oceanSpecularIntensity, waveIntensity), maskValue);
float specular = specularIntensity * surfaceReflectance;
float specular = specularIntensity * surfaceReflectance * 1.4;

return vec4(imageryColor.rgb + diffuseHighlight + nonDiffuseHighlight + specular, imageryColor.a);
float e = 0.2;
float d = 3.3;
float c = 1.7;

return vec4(imageryColor.rgb + (c * (vec3(e) + imageryColor.rgb * d) * (diffuseHighlight + nonDiffuseHighlight + specular)), imageryColor.a);
//return vec4(imageryColor.rgb + diffuseHighlight + nonDiffuseHighlight + specular, imageryColor.a);
}

#endif // #ifdef SHOW_REFLECTIVE_OCEAN
12 changes: 6 additions & 6 deletions Source/Shaders/PostProcessStages/ACESTonemapping.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ void main()
// color /= texture2D(autoExposure, vec2(0.5)).r;
//#endif

float a = 2.51;
float b = 0.03;
float c = 2.43;
float d = 0.59;
float e = 0.14;
float a = 2.61;
float b = 0.08;
float c = 2.49;
float d = 0.63;
float e = 0.01;
color = (color * (a * color + b)) / (color * (c * color + d) + e);
color = clamp(color, 0.0, 1.0);
color = pow(color, vec3(1.0 / 2.2));
color = pow(color, vec3(1.0 / 1.22));
gl_FragColor = vec4(color, 1.0);
}
2 changes: 1 addition & 1 deletion Source/Shaders/SkyAtmosphereFS.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void main (void)
vec3 rgb = rayleighPhase * v_rayleighColor + miePhase * v_mieColor;

#ifndef HDR
const float exposure = 2.0;
const float exposure = 1.1;
rgb = vec3(1.0) - exp(-exposure * rgb);
#endif

Expand Down

0 comments on commit 8cf28a6

Please sign in to comment.