diff --git a/CHANGES.md b/CHANGES.md index c2d7354f028f..fd0e595f714a 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -41,6 +41,7 @@ Change Log * Fix warning when using Webpack. [#4467](https://github.com/AnalyticalGraphicsInc/cesium/pull/4467) * Fix primitive bounding sphere bug that would cause a crash when loading data sources. [#4431](https://github.com/AnalyticalGraphicsInc/cesium/issues/4431) * Fix a crash when clustering is enabled, an entity has a label graphics defined, but the label isn't visible. [#4414](https://github.com/AnalyticalGraphicsInc/cesium/issues/4414) +* Fixed a shadow aliasing issue where polygon offset was not being applied. [#4559](https://github.com/AnalyticalGraphicsInc/cesium/pull/4559) ### 1.26 - 2016-10-03 diff --git a/Source/Scene/ShadowMap.js b/Source/Scene/ShadowMap.js index 0ef5677758ee..bf51dcd9d6af 100644 --- a/Source/Scene/ShadowMap.js +++ b/Source/Scene/ShadowMap.js @@ -185,8 +185,9 @@ define([ this._needsUpdate = true; // In IE11 polygon offset is not functional. + // TODO : Also disabled for Chrome (ANGLE) temporarily. Re-enable once https://github.com/AnalyticalGraphicsInc/cesium/issues/4560 is resolved. var polygonOffsetSupported = true; - if (FeatureDetection.isInternetExplorer) { + if (FeatureDetection.isInternetExplorer() || (FeatureDetection.isChrome() && FeatureDetection.isWindows())) { polygonOffsetSupported = false; } this._polygonOffsetSupported = polygonOffsetSupported; diff --git a/Source/Scene/ShadowMapShader.js b/Source/Scene/ShadowMapShader.js index 61d4c851313e..dcb70bd245b3 100644 --- a/Source/Scene/ShadowMapShader.js +++ b/Source/Scene/ShadowMapShader.js @@ -134,6 +134,7 @@ define([ var hasPositionVarying = defined(positionVaryingName); var usesDepthTexture = shadowMap._usesDepthTexture; + var polygonOffsetSupported = shadowMap._polygonOffsetSupported; var isPointLight = shadowMap._isPointLight; var isSpotLight = shadowMap._isSpotLight; var hasCascades = shadowMap._numberOfCascades > 1; @@ -230,7 +231,9 @@ define([ if (isTerrain) { // Scale depth bias based on view distance to reduce z-fighting in distant terrain fsSource += ' shadowParameters.depthBias *= max(depth * 0.01, 1.0); \n'; - } else { + } else if (!polygonOffsetSupported) { + // If polygon offset isn't supported push the depth back based on view, however this + // causes light leaking at further away views fsSource += ' shadowParameters.depthBias *= mix(1.0, 100.0, depth * 0.0015); \n'; }