From 215ed03fbcaf542470a3985e6d54e99543468581 Mon Sep 17 00:00:00 2001 From: Edvinas Pranka Date: Mon, 18 May 2020 17:48:21 +0300 Subject: [PATCH 1/5] Added nightAlpha and dayAlpha in the ImageryLayer --- Source/Scene/GlobeSurfaceShaderSet.js | 16 +++++++-- Source/Scene/GlobeSurfaceTileProvider.js | 23 +++++++++++++ Source/Scene/ImageryLayer.js | 36 +++++++++++++++++++++ Source/Scene/ImageryProvider.js | 18 +++++++++++ Source/Shaders/GlobeFS.glsl | 34 ++++++++++++++----- Specs/Scene/GlobeSurfaceTileProviderSpec.js | 4 +++ 6 files changed, 120 insertions(+), 11 deletions(-) diff --git a/Source/Scene/GlobeSurfaceShaderSet.js b/Source/Scene/GlobeSurfaceShaderSet.js index c96f89c2a6ac..fccee8fa5764 100644 --- a/Source/Scene/GlobeSurfaceShaderSet.js +++ b/Source/Scene/GlobeSurfaceShaderSet.js @@ -80,6 +80,7 @@ GlobeSurfaceShaderSet.prototype.getShaderProgram = function (options) { var applySaturation = options.applySaturation; var applyGamma = options.applyGamma; var applyAlpha = options.applyAlpha; + var applyDayNightAlpha = options.applyDayNightAlpha; var applySplit = options.applySplit; var showReflectiveOcean = options.showReflectiveOcean; var showOceanWaves = options.showOceanWaves; @@ -151,7 +152,8 @@ GlobeSurfaceShaderSet.prototype.getShaderProgram = function (options) { (imageryCutoutFlag << 22) | (colorCorrect << 23) | (highlightFillTile << 24) | - (colorToAlpha << 25); + (colorToAlpha << 25) | + (applyDayNightAlpha << 26); var currentClippingShaderState = 0; if (defined(clippingPlanes) && clippingPlanes.length > 0) { @@ -217,6 +219,9 @@ GlobeSurfaceShaderSet.prototype.getShaderProgram = function (options) { if (applyAlpha) { fs.defines.push("APPLY_ALPHA"); } + if (applyDayNightAlpha) { + fs.defines.push("APPLY_DAY_NIGHT_ALPHA"); + } if (showReflectiveOcean) { fs.defines.push("SHOW_REFLECTIVE_OCEAN"); vs.defines.push("SHOW_REFLECTIVE_OCEAN"); @@ -279,7 +284,7 @@ GlobeSurfaceShaderSet.prototype.getShaderProgram = function (options) { var computeDayColor = "\ - vec4 computeDayColor(vec4 initialColor, vec3 textureCoordinates)\n\ + vec4 computeDayColor(vec4 initialColor, vec3 textureCoordinates, float nightIntensity)\n\ {\n\ vec4 color = initialColor;\n"; @@ -322,6 +327,10 @@ GlobeSurfaceShaderSet.prototype.getShaderProgram = function (options) { (applyAlpha ? "u_dayTextureAlpha[" + i + "]" : "1.0") + ",\n\ " + + (applyDayNightAlpha ? "u_dayTextureNightAlpha[" + i + "]" : "1.0") + + ",\n" + + (applyDayNightAlpha ? "u_dayTextureDayAlpha[" + i + "]" : "1.0") + + ",\n" + (applyBrightness ? "u_dayTextureBrightness[" + i + "]" : "0.0") + ",\n\ " + @@ -341,7 +350,8 @@ GlobeSurfaceShaderSet.prototype.getShaderProgram = function (options) { ",\n\ " + (colorToAlpha ? "u_colorsToAlpha[" + i + "]" : "vec4(0.0)") + - "\n\ + ",\n\ + nightIntensity\ );\n"; if (hasImageryLayerCutout) { computeDayColor += diff --git a/Source/Scene/GlobeSurfaceTileProvider.js b/Source/Scene/GlobeSurfaceTileProvider.js index 2f43ecd92c3a..e85fd70e5bd0 100644 --- a/Source/Scene/GlobeSurfaceTileProvider.js +++ b/Source/Scene/GlobeSurfaceTileProvider.js @@ -1507,6 +1507,12 @@ function createTileUniformMap(frameState, globeSurfaceTileProvider) { u_dayTextureAlpha: function () { return this.properties.dayTextureAlpha; }, + u_dayTextureNightAlpha: function () { + return this.properties.dayTextureNightAlpha; + }, + u_dayTextureDayAlpha: function () { + return this.properties.dayTextureDayAlpha; + }, u_dayTextureBrightness: function () { return this.properties.dayTextureBrightness; }, @@ -1606,6 +1612,8 @@ function createTileUniformMap(frameState, globeSurfaceTileProvider) { dayTextureTexCoordsRectangle: [], dayTextureUseWebMercatorT: [], dayTextureAlpha: [], + dayTextureNightAlpha: [], + dayTextureDayAlpha: [], dayTextureBrightness: [], dayTextureContrast: [], dayTextureHue: [], @@ -1802,6 +1810,7 @@ var surfaceShaderSetOptionsScratch = { applySaturation: undefined, applyGamma: undefined, applyAlpha: undefined, + applyDayNightAlpha: undefined, applySplit: undefined, showReflectiveOcean: undefined, showOceanWaves: undefined, @@ -2155,6 +2164,7 @@ function addDrawCommandsForTile(tileProvider, tile, frameState) { var applySaturation = false; var applyGamma = false; var applyAlpha = false; + var applyDayNightAlpha = false; var applySplit = false; var applyCutout = false; var applyColorToAlpha = false; @@ -2211,6 +2221,18 @@ function addDrawCommandsForTile(tileProvider, tile, frameState) { applyAlpha || uniformMapProperties.dayTextureAlpha[numberOfDayTextures] !== 1.0; + uniformMapProperties.dayTextureNightAlpha[numberOfDayTextures] = + imageryLayer.nightAlpha; + applyDayNightAlpha = + applyDayNightAlpha || + uniformMapProperties.dayTextureNightAlpha[numberOfDayTextures] !== 1.0; + + uniformMapProperties.dayTextureDayAlpha[numberOfDayTextures] = + imageryLayer.dayAlpha; + applyDayNightAlpha = + applyDayNightAlpha || + uniformMapProperties.dayTextureDayAlpha[numberOfDayTextures] !== 1.0; + uniformMapProperties.dayTextureBrightness[numberOfDayTextures] = imageryLayer.brightness; applyBrightness = @@ -2362,6 +2384,7 @@ function addDrawCommandsForTile(tileProvider, tile, frameState) { surfaceShaderSetOptions.applySaturation = applySaturation; surfaceShaderSetOptions.applyGamma = applyGamma; surfaceShaderSetOptions.applyAlpha = applyAlpha; + surfaceShaderSetOptions.applyDayNightAlpha = applyDayNightAlpha; surfaceShaderSetOptions.applySplit = applySplit; surfaceShaderSetOptions.enableFog = applyFog; surfaceShaderSetOptions.enableClippingPlanes = clippingPlanesEnabled; diff --git a/Source/Scene/ImageryLayer.js b/Source/Scene/ImageryLayer.js index b8938689eff2..697bef1de6a8 100644 --- a/Source/Scene/ImageryLayer.js +++ b/Source/Scene/ImageryLayer.js @@ -54,6 +54,18 @@ import TileImagery from "./TileImagery.js"; * current frame state, this layer, and the x, y, and level coordinates of the * imagery tile for which the alpha is required, and it is expected to return * the alpha value to use for the tile. + * @param {Number|Function} [options.nightAlpha=1.0] The alpha blending value of this layer on the night side of the globe, from 0.0 to 1.0. + * This can either be a simple number or a function with the signature + * function(frameState, layer, x, y, level). The function is passed the + * current frame state, this layer, and the x, y, and level coordinates of the + * imagery tile for which the alpha is required, and it is expected to return + * the alpha value to use for the tile. This only takes effect when enableLighting is true. + * @param {Number|Function} [options.dayAlpha=1.0] The alpha blending value of this layer on the day side of the globe, from 0.0 to 1.0. + * This can either be a simple number or a function with the signature + * function(frameState, layer, x, y, level). The function is passed the + * current frame state, this layer, and the x, y, and level coordinates of the + * imagery tile for which the alpha is required, and it is expected to return + * the alpha value to use for the tile. This only takes effect when enableLighting is true. * @param {Number|Function} [options.brightness=1.0] The brightness of this layer. 1.0 uses the unmodified imagery * color. Less than 1.0 makes the imagery darker while greater than 1.0 makes it brighter. * This can either be a simple number or a function with the signature @@ -131,6 +143,30 @@ function ImageryLayer(imageryProvider, options) { defaultValue(imageryProvider.defaultAlpha, 1.0) ); + /** + * The alpha blending value of this layer a the night side of the globe, with 0.0 representing fully transparent and + * 1.0 representing fully opaque. This only takes effect when enableLighting is true. + * + * @type {Number} + * @default 1.0 + */ + this.nightAlpha = defaultValue( + options.nightAlpha, + defaultValue(imageryProvider.defaultNightAlpha, 1.0) + ); + + /** + * The alpha blending value of this layer a the day side of the globe, with 0.0 representing fully transparent and + * 1.0 representing fully opaque. This only takes effect when enableLighting is true. + * + * @type {Number} + * @default 1.0 + */ + this.dayAlpha = defaultValue( + options.dayAlpha, + defaultValue(imageryProvider.defaultDayAlpha, 1.0) + ); + /** * The brightness of this layer. 1.0 uses the unmodified imagery color. Less than 1.0 * makes the imagery darker while greater than 1.0 makes it brighter. diff --git a/Source/Scene/ImageryProvider.js b/Source/Scene/ImageryProvider.js index 884a28d71ce2..92c7dd6777d9 100644 --- a/Source/Scene/ImageryProvider.js +++ b/Source/Scene/ImageryProvider.js @@ -40,6 +40,24 @@ function ImageryProvider() { */ this.defaultAlpha = undefined; + /** + * The default alpha blending value on the night side of the globe of this provider, with 0.0 representing fully transparent and + * 1.0 representing fully opaque. + * + * @type {Number} + * @default undefined + */ + this.defaultNightAlpha = undefined; + + /** + * The default alpha blending value on the day side of the globe of this provider, with 0.0 representing fully transparent and + * 1.0 representing fully opaque. + * + * @type {Number} + * @default undefined + */ + this.defaultDayAlpha = undefined; + /** * The default brightness of this provider. 1.0 uses the unmodified imagery color. Less than 1.0 * makes the imagery darker while greater than 1.0 makes it brighter. diff --git a/Source/Shaders/GlobeFS.glsl b/Source/Shaders/GlobeFS.glsl index 2485ade22955..e3d5f722bf2b 100644 --- a/Source/Shaders/GlobeFS.glsl +++ b/Source/Shaders/GlobeFS.glsl @@ -9,6 +9,11 @@ uniform bool u_dayTextureUseWebMercatorT[TEXTURE_UNITS]; uniform float u_dayTextureAlpha[TEXTURE_UNITS]; #endif +#ifdef APPLY_DAY_NIGHT_ALPHA +uniform float u_dayTextureNightAlpha[TEXTURE_UNITS]; +uniform float u_dayTextureDayAlpha[TEXTURE_UNITS]; +#endif + #ifdef APPLY_SPLIT uniform float u_dayTextureSplit[TEXTURE_UNITS]; #endif @@ -114,13 +119,16 @@ vec4 sampleAndBlend( vec4 textureCoordinateRectangle, vec4 textureCoordinateTranslationAndScale, float textureAlpha, + float textureNightAlpha, + float textureDayAlpha, float textureBrightness, float textureContrast, float textureHue, float textureSaturation, float textureOneOverGamma, float split, - vec4 colorToAlpha) + vec4 colorToAlpha, + float nightIntensity) { // This crazy step stuff sets the alpha to 0.0 if this following condition is true: // tileTextureCoordinates.s < textureCoordinateRectangle.s || @@ -135,6 +143,10 @@ vec4 sampleAndBlend( alphaMultiplier = step(vec2(0.0), textureCoordinateRectangle.pq - tileTextureCoordinates); textureAlpha = textureAlpha * alphaMultiplier.x * alphaMultiplier.y; +#if defined(APPLY_DAY_NIGHT_ALPHA) && defined(ENABLE_DAYNIGHT_SHADING) + textureAlpha *= mix(textureDayAlpha, textureNightAlpha, nightIntensity); +#endif + vec2 translation = textureCoordinateTranslationAndScale.xy; vec2 scale = textureCoordinateTranslationAndScale.zw; vec2 textureCoordinates = tileTextureCoordinates * scale + translation; @@ -225,7 +237,7 @@ vec3 colorCorrect(vec3 rgb) { return rgb; } -vec4 computeDayColor(vec4 initialColor, vec3 textureCoordinates); +vec4 computeDayColor(vec4 initialColor, vec3 textureCoordinates, float nightIntensity); vec4 computeWaterColor(vec3 positionEyeCoordinates, vec2 textureCoordinates, mat3 enuToEye, vec4 imageryColor, float specularMapValue, float fade); void main() @@ -242,11 +254,22 @@ void main() float clipDistance = clip(gl_FragCoord, u_clippingPlanes, u_clippingPlanesMatrix); #endif +#if defined(SHOW_REFLECTIVE_OCEAN) || defined(ENABLE_DAYNIGHT_SHADING) || defined(HDR) + vec3 normalMC = czm_geodeticSurfaceNormal(v_positionMC, vec3(0.0), vec3(1.0)); // normalized surface normal in model coordinates + vec3 normalEC = czm_normal3D * normalMC; // normalized surface normal in eye coordiantes +#endif + +#if defined(APPLY_DAY_NIGHT_ALPHA) && defined(ENABLE_DAYNIGHT_SHADING) + float nightIntensity = 1.0 - clamp(czm_getLambertDiffuse(czm_lightDirectionEC, normalEC) * 5.0, 0.0, 1.0); +#else + float nightIntensity = 0.0; +#endif + // The clamp below works around an apparent bug in Chrome Canary v23.0.1241.0 // where the fragment shader sees textures coordinates < 0.0 and > 1.0 for the // fragments on the edges of tiles even though the vertex shader is outputting // coordinates strictly in the 0-1 range. - vec4 color = computeDayColor(u_initialColor, clamp(v_textureCoordinates, 0.0, 1.0)); + vec4 color = computeDayColor(u_initialColor, clamp(v_textureCoordinates, 0.0, 1.0), nightIntensity); #ifdef SHOW_TILE_BOUNDARIES if (v_textureCoordinates.x < (1.0/256.0) || v_textureCoordinates.x > (255.0/256.0) || @@ -256,11 +279,6 @@ void main() } #endif -#if defined(SHOW_REFLECTIVE_OCEAN) || defined(ENABLE_DAYNIGHT_SHADING) || defined(HDR) - vec3 normalMC = czm_geodeticSurfaceNormal(v_positionMC, vec3(0.0), vec3(1.0)); // normalized surface normal in model coordinates - vec3 normalEC = czm_normal3D * normalMC; // normalized surface normal in eye coordiantes -#endif - #if defined(ENABLE_DAYNIGHT_SHADING) || defined(GROUND_ATMOSPHERE) float cameraDist; if (czm_sceneMode == czm_sceneMode2D) diff --git a/Specs/Scene/GlobeSurfaceTileProviderSpec.js b/Specs/Scene/GlobeSurfaceTileProviderSpec.js index d615b23fc2b7..d81a3f01b372 100644 --- a/Specs/Scene/GlobeSurfaceTileProviderSpec.js +++ b/Specs/Scene/GlobeSurfaceTileProviderSpec.js @@ -622,6 +622,8 @@ describe( ); layer.alpha = 0.123; + layer.nightAlpha = 0.658; + layer.dayAlpha = 0.356; layer.brightness = 0.456; layer.contrast = 0.654; layer.gamma = 0.321; @@ -651,6 +653,8 @@ describe( ++tileCommandCount; expect(uniforms.u_dayTextureAlpha()).toEqual([0.123]); + expect(uniforms.u_dayTextureNightAlpha()).toEqual([0.658]); + expect(uniforms.u_dayTextureDayAlpha()).toEqual([0.356]); expect(uniforms.u_dayTextureBrightness()).toEqual([0.456]); expect(uniforms.u_dayTextureContrast()).toEqual([0.654]); expect(uniforms.u_dayTextureOneOverGamma()).toEqual([1.0 / 0.321]); From 702044c2b57a6bd059fc998cf2e2e4c5e158e93b Mon Sep 17 00:00:00 2001 From: Edvinas Pranka Date: Mon, 18 May 2020 17:49:53 +0300 Subject: [PATCH 2/5] Updated CONTRIBUTORS.md --- CONTRIBUTORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 56a2e370dffe..107e0a347277 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -256,3 +256,4 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu - [SungHo Lim](https://github.com/SambaLim) - [Michael Fink](https://github.com/vividos) - [Jakub Vrana](https://github.com/vrana) +- [Edvinas Pranka](https://github.com/epranka) From 7e1407b3fab24fcd1ed079b17e902fdacd0f816a Mon Sep 17 00:00:00 2001 From: Edvinas Pranka Date: Mon, 18 May 2020 17:52:31 +0300 Subject: [PATCH 3/5] CHANGES.md updated --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index 5e7b0392c1d3..ff225ec51ee9 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -23,6 +23,7 @@ ##### Additions :tada: +- Added `nightAlpha` and `dayAlpha` to the `ImageryLayer`. It lets to control alpha separately on the day and night sides of the globe. - Added `RequestScheduler` to the public API; this allows users to have more control over the requests made by CesiumJS. [#8384](https://github.com/CesiumGS/cesium/issues/8384) - Added support for high-quality edges on solid geometry in glTF models. [#8776](https://github.com/CesiumGS/cesium/pull/8776) - Added `Scene.cameraUnderground` for checking whether the camera is underneath the globe. [#8765](https://github.com/CesiumGS/cesium/pull/8765) From a0c20811ae55c0687cafcbf4776707ed775b0db7 Mon Sep 17 00:00:00 2001 From: Edvinas Pranka Date: Mon, 18 May 2020 17:53:00 +0300 Subject: [PATCH 4/5] Added night textures showcase to the Sandcastle --- .../Night textures on the shade side.html | 67 ++++++++++++++++++ .../Night textures on the shade side.jpg | Bin 0 -> 8543 bytes 2 files changed, 67 insertions(+) create mode 100644 Apps/Sandcastle/gallery/Night textures on the shade side.html create mode 100644 Apps/Sandcastle/gallery/Night textures on the shade side.jpg diff --git a/Apps/Sandcastle/gallery/Night textures on the shade side.html b/Apps/Sandcastle/gallery/Night textures on the shade side.html new file mode 100644 index 000000000000..b304b9571379 --- /dev/null +++ b/Apps/Sandcastle/gallery/Night textures on the shade side.html @@ -0,0 +1,67 @@ + + + + + + + + + Cesium Demo + + + + + + +
+

Loading...

+
+ + + diff --git a/Apps/Sandcastle/gallery/Night textures on the shade side.jpg b/Apps/Sandcastle/gallery/Night textures on the shade side.jpg new file mode 100644 index 0000000000000000000000000000000000000000..0c1d6d75a10679006f417acfc5536c982a51d8ed GIT binary patch literal 8543 zcmb7pRahKbvvv#eHih35?bLr(g=GynpD0N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ot39Aaow2Ch^Ikk*NE^wK#F_e09fYn>zazW5yN}MQ52wo-|+c z9m`Bj>qJ*~1yWr!j0cHw3Imlkc%LyM`ZxYH-wp>KA4~jAw!z+!cT1$3DvBabD9MyV zO1z>iNL$nFvBYN9=7?PBK|#Y;P9Sw5`*uHz&azmIiJ6`oQfP_Vy1-bm^$eJ@2y~F` zktp&oX4$o++Gk&`UWqsJhxYED??io$l}G8rE{YY288s{z+$CsFEqEW-?6c?_Ta0W@ z#P_J0u&+(NBl41n>@V|U5F8kU2nT`xPaeKZ$^dvw1dNwV6vL)?$v{z6Fb=M`%FA#_ z&E(%v&`YaQ1o+$XC{~X%U;PYN-<*o1exi89dtJt>84)YJ5T2s?NH^A!qmPv={m^e% zaaR*iyGL(Zs>mvAQW9Cji`n#!Y}|oSL(cMNx>?r-sRiSo#c{}eoI~UQiV^r)G$hBN zE&1?R_-$QGI8N%!y!GTP5-WeEg=DG95tX_qU!b&Mu|SM`E(K-iP}6`Zge2)1r!lXa#LWB7T*ppCQOP% zE@}!boEqi_L~30$dH5P>v7pOk7Vl*fjG`TSk?0A+r%06P+HhcICEh;dgqU_ z@{|79FjWURG=sV$MUx9NfYdC(p;)VvkR+NTtgv)Zt8{6a;gbDKY-$-36wJeRs`qC{ zj$B=?gEYV5HRjSDl9J@uAZO%}{|C}#OXW1ZKwP$|XCUAYYWYuNj%4=wm@hu)oA2c8 zPwjfWz5PZ2Y0gY*eNUO}15)=4bxna(uQ)HXZt)LHI}`NN52vdwb(KaC)Ha49)ozVPWL>?RBjNAO0`=_HJy!evkA Vwq;E2K|=AhET# Date: Tue, 26 May 2020 15:26:22 -0400 Subject: [PATCH 5/5] some tweaks to day/night blending --- Apps/Sandcastle/gallery/Earth at Night.html | 34 +++++++++ .../Night textures on the shade side.html | 67 ------------------ .../Night textures on the shade side.jpg | Bin 8543 -> 0 bytes CHANGES.md | 2 +- Source/Scene/GlobeSurfaceShaderSet.js | 4 +- Source/Scene/ImageryLayer.js | 8 +-- Source/Shaders/GlobeFS.glsl | 12 ++-- 7 files changed, 47 insertions(+), 80 deletions(-) delete mode 100644 Apps/Sandcastle/gallery/Night textures on the shade side.html delete mode 100644 Apps/Sandcastle/gallery/Night textures on the shade side.jpg diff --git a/Apps/Sandcastle/gallery/Earth at Night.html b/Apps/Sandcastle/gallery/Earth at Night.html index 50e92f081f8d..c882a10d24fd 100644 --- a/Apps/Sandcastle/gallery/Earth at Night.html +++ b/Apps/Sandcastle/gallery/Earth at Night.html @@ -39,6 +39,40 @@ var viewer = new Cesium.Viewer("cesiumContainer", { imageryProvider: new Cesium.IonImageryProvider({ assetId: 3812 }), }); + + // The rest of the code is for dynamic lighting + var dynamicLighting = false; + + viewer.clock.multiplier = 4000; + + var imageryLayers = viewer.imageryLayers; + var nightLayer = imageryLayers.get(0); + var dayLayer = imageryLayers.addImageryProvider( + new Cesium.IonImageryProvider({ + assetId: 3845, + }) + ); + imageryLayers.lowerToBottom(dayLayer); + + function updateLighting(dynamicLighting) { + dayLayer.show = dynamicLighting; + viewer.scene.globe.enableLighting = dynamicLighting; + viewer.clock.shouldAnimate = dynamicLighting; + + // If dynamic lighting is enabled, make the night imagery invisible + // on the lit side of the globe. + nightLayer.dayAlpha = dynamicLighting ? 0.0 : 1.0; + } + + updateLighting(dynamicLighting); + + Sandcastle.addToggleButton( + "Dynamic lighting", + dynamicLighting, + function (checked) { + updateLighting(checked); + } + ); //Sandcastle_End Sandcastle.finishedLoading(); } diff --git a/Apps/Sandcastle/gallery/Night textures on the shade side.html b/Apps/Sandcastle/gallery/Night textures on the shade side.html deleted file mode 100644 index b304b9571379..000000000000 --- a/Apps/Sandcastle/gallery/Night textures on the shade side.html +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - - Cesium Demo - - - - - - -
-

Loading...

-
- - - diff --git a/Apps/Sandcastle/gallery/Night textures on the shade side.jpg b/Apps/Sandcastle/gallery/Night textures on the shade side.jpg deleted file mode 100644 index 0c1d6d75a10679006f417acfc5536c982a51d8ed..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&VdO=M}(g9fE>^(xve>( zGXnA^Ac>l9C`zJP8s-Z|AIlJC89HNy_RCHdQOQKlL=<`$YF-fNYnot39Aaow2Ch^Ikk*NE^wK#F_e09fYn>zazW5yN}MQ52wo-|+c z9m`Bj>qJ*~1yWr!j0cHw3Imlkc%LyM`ZxYH-wp>KA4~jAw!z+!cT1$3DvBabD9MyV zO1z>iNL$nFvBYN9=7?PBK|#Y;P9Sw5`*uHz&azmIiJ6`oQfP_Vy1-bm^$eJ@2y~F` zktp&oX4$o++Gk&`UWqsJhxYED??io$l}G8rE{YY288s{z+$CsFEqEW-?6c?_Ta0W@ z#P_J0u&+(NBl41n>@V|U5F8kU2nT`xPaeKZ$^dvw1dNwV6vL)?$v{z6Fb=M`%FA#_ z&E(%v&`YaQ1o+$XC{~X%U;PYN-<*o1exi89dtJt>84)YJ5T2s?NH^A!qmPv={m^e% zaaR*iyGL(Zs>mvAQW9Cji`n#!Y}|oSL(cMNx>?r-sRiSo#c{}eoI~UQiV^r)G$hBN zE&1?R_-$QGI8N%!y!GTP5-WeEg=DG95tX_qU!b&Mu|SM`E(K-iP}6`Zge2)1r!lXa#LWB7T*ppCQOP% zE@}!boEqi_L~30$dH5P>v7pOk7Vl*fjG`TSk?0A+r%06P+HhcICEh;dgqU_ z@{|79FjWURG=sV$MUx9NfYdC(p;)VvkR+NTtgv)Zt8{6a;gbDKY-$-36wJeRs`qC{ zj$B=?gEYV5HRjSDl9J@uAZO%}{|C}#OXW1ZKwP$|XCUAYYWYuNj%4=wm@hu)oA2c8 zPwjfWz5PZ2Y0gY*eNUO}15)=4bxna(uQ)HXZt)LHI}`NN52vdwb(KaC)Ha49)ozVPWL>?RBjNAO0`=_HJy!evkA Vwq;E2K|=AhET#enableLighting is true. + * The alpha blending value of this layer on the night side of the globe, with 0.0 representing fully transparent and + * 1.0 representing fully opaque. This only takes effect when {@link Globe#enableLighting} is true. * * @type {Number} * @default 1.0 @@ -156,8 +156,8 @@ function ImageryLayer(imageryProvider, options) { ); /** - * The alpha blending value of this layer a the day side of the globe, with 0.0 representing fully transparent and - * 1.0 representing fully opaque. This only takes effect when enableLighting is true. + * The alpha blending value of this layer on the day side of the globe, with 0.0 representing fully transparent and + * 1.0 representing fully opaque. This only takes effect when {@link Globe#enableLighting} is true. * * @type {Number} * @default 1.0 diff --git a/Source/Shaders/GlobeFS.glsl b/Source/Shaders/GlobeFS.glsl index 110c42939dd3..10a5c29fc3f4 100644 --- a/Source/Shaders/GlobeFS.glsl +++ b/Source/Shaders/GlobeFS.glsl @@ -172,7 +172,7 @@ vec4 sampleAndBlend( float textureOneOverGamma, float split, vec4 colorToAlpha, - float nightIntensity) + float nightBlend) { // This crazy step stuff sets the alpha to 0.0 if this following condition is true: // tileTextureCoordinates.s < textureCoordinateRectangle.s || @@ -188,7 +188,7 @@ vec4 sampleAndBlend( textureAlpha = textureAlpha * alphaMultiplier.x * alphaMultiplier.y; #if defined(APPLY_DAY_NIGHT_ALPHA) && defined(ENABLE_DAYNIGHT_SHADING) - textureAlpha *= mix(textureDayAlpha, textureNightAlpha, nightIntensity); + textureAlpha *= mix(textureDayAlpha, textureNightAlpha, nightBlend); #endif vec2 translation = textureCoordinateTranslationAndScale.xy; @@ -281,7 +281,7 @@ vec3 colorCorrect(vec3 rgb) { return rgb; } -vec4 computeDayColor(vec4 initialColor, vec3 textureCoordinates, float nightIntensity); +vec4 computeDayColor(vec4 initialColor, vec3 textureCoordinates, float nightBlend); vec4 computeWaterColor(vec3 positionEyeCoordinates, vec2 textureCoordinates, mat3 enuToEye, vec4 imageryColor, float specularMapValue, float fade); #ifdef GROUND_ATMOSPHERE @@ -310,16 +310,16 @@ void main() #endif #if defined(APPLY_DAY_NIGHT_ALPHA) && defined(ENABLE_DAYNIGHT_SHADING) - float nightIntensity = 1.0 - clamp(czm_getLambertDiffuse(czm_lightDirectionEC, normalEC) * 5.0, 0.0, 1.0); + float nightBlend = 1.0 - clamp(czm_getLambertDiffuse(czm_lightDirectionEC, normalEC) * 5.0, 0.0, 1.0); #else - float nightIntensity = 0.0; + float nightBlend = 0.0; #endif // The clamp below works around an apparent bug in Chrome Canary v23.0.1241.0 // where the fragment shader sees textures coordinates < 0.0 and > 1.0 for the // fragments on the edges of tiles even though the vertex shader is outputting // coordinates strictly in the 0-1 range. - vec4 color = computeDayColor(u_initialColor, clamp(v_textureCoordinates, 0.0, 1.0), nightIntensity); + vec4 color = computeDayColor(u_initialColor, clamp(v_textureCoordinates, 0.0, 1.0), nightBlend); #ifdef SHOW_TILE_BOUNDARIES if (v_textureCoordinates.x < (1.0/256.0) || v_textureCoordinates.x > (255.0/256.0) ||