From 971753cbad93c656f85f808a243a32a8368b49e4 Mon Sep 17 00:00:00 2001 From: Sean Lilley Date: Sat, 26 Sep 2020 12:39:43 -0400 Subject: [PATCH] Fix shadow crash by preventing shadowNear from equaling shadowFar --- CHANGES.md | 1 + Source/Scene/ShadowMap.js | 6 ++---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index fcfa67f43159..fb451197a1c0 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -12,6 +12,7 @@ - Fixed an issue where Plane doesn't rotate correctly around the main local axis. [#8268](https://github.com/CesiumGS/cesium/issues/8268) - Fixed clipping planes with non-uniform scale. [#9135](https://github.com/CesiumGS/cesium/pull/9135) - Fixed an issue where ground primitives would get clipped at certain camera angles. [#9114](https://github.com/CesiumGS/cesium/issues/9114) +- Fixed a crash when loading Cesium OSM buildings with shadows enabled. [#9172](https://github.com/CesiumGS/cesium/pull/9172) ### 1.73 - 2020-09-01 diff --git a/Source/Scene/ShadowMap.js b/Source/Scene/ShadowMap.js index 458f61835938..7a6138faf62a 100644 --- a/Source/Scene/ShadowMap.js +++ b/Source/Scene/ShadowMap.js @@ -1518,10 +1518,8 @@ function updateCameras(shadowMap, frameState) { frameState.shadowState.nearPlane, shadowMap.maximumDistance ); - far = Math.min( - frameState.shadowState.farPlane, - shadowMap.maximumDistance + 1.0 - ); + far = Math.min(frameState.shadowState.farPlane, shadowMap.maximumDistance); + far = Math.max(far, near + 1.0); } else { near = camera.frustum.near; far = shadowMap.maximumDistance;