From 6fe3c28917e4d2009f9afd92a21fa9d30db77613 Mon Sep 17 00:00:00 2001 From: Kevin Ring Date: Mon, 2 Mar 2020 17:04:10 +1100 Subject: [PATCH 1/3] Use LEQUAL instead of LESS for depth testing models. --- Source/Scene/Model.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/Scene/Model.js b/Source/Scene/Model.js index 9ed90e24741c..60588349425b 100644 --- a/Source/Scene/Model.js +++ b/Source/Scene/Model.js @@ -3010,7 +3010,8 @@ import ShadowMode from './ShadowMode.js'; enabled : enableCulling }, depthTest : { - enabled : true + enabled : true, + func: WebGLConstants.LEQUAL }, depthMask : !blendingEnabled, blending : { From 248e3f51c5571f8fa8bb06d167fb3fbb3fd4f89d Mon Sep 17 00:00:00 2001 From: Kevin Ring Date: Mon, 2 Mar 2020 17:09:12 +1100 Subject: [PATCH 2/3] Update CHANGES.md. --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index f6cf17687bd9..ad2c70a63ded 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -5,6 +5,7 @@ Change Log ##### Breaking Changes :mega: * `Cesium3DTileset.skipLevelOfDetail` is now `false` by default. [#8631](https://github.com/CesiumGS/cesium/pull/8631) +* glTF models are now rendered using the `LEQUALS` depth test function insead of `LESS`. This means that when geometry overlaps, the _later_ geometry will be visible above the earlier, where previously the opposite was true. We believe this is a more sensible default, and makes it easier to render e.g. outlined buildings with glTF. ##### Additions :tada: From b32e4f3015a81859a989a0a6e15d535d8a5a7a29 Mon Sep 17 00:00:00 2001 From: Kevin Ring Date: Mon, 2 Mar 2020 17:25:02 +1100 Subject: [PATCH 3/3] Fix test failure. --- Source/Scene/Model.js | 3 ++- Specs/Scene/ModelSpec.js | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Source/Scene/Model.js b/Source/Scene/Model.js index 60588349425b..977a32488770 100644 --- a/Source/Scene/Model.js +++ b/Source/Scene/Model.js @@ -57,6 +57,7 @@ import Axis from './Axis.js'; import BlendingState from './BlendingState.js'; import ClippingPlaneCollection from './ClippingPlaneCollection.js'; import ColorBlendMode from './ColorBlendMode.js'; +import DepthFunction from './DepthFunction.js'; import DracoLoader from './DracoLoader.js'; import getClipAndStyleCode from './getClipAndStyleCode.js'; import getClippingFunction from './getClippingFunction.js'; @@ -3011,7 +3012,7 @@ import ShadowMode from './ShadowMode.js'; }, depthTest : { enabled : true, - func: WebGLConstants.LEQUAL + func: DepthFunction.LESS_OR_EQUAL }, depthMask : !blendingEnabled, blending : { diff --git a/Specs/Scene/ModelSpec.js b/Specs/Scene/ModelSpec.js index 574658226ffa..a4e8c92bd67d 100644 --- a/Specs/Scene/ModelSpec.js +++ b/Specs/Scene/ModelSpec.js @@ -32,6 +32,7 @@ import { DracoLoader } from '../../Source/Cesium.js'; import { HeightReference } from '../../Source/Cesium.js'; import { Model } from '../../Source/Cesium.js'; import { ModelAnimationLoop } from '../../Source/Cesium.js'; +import { DepthFunction } from '../../Source/Cesium.js'; import createScene from '../createScene.js'; import pollToPromise from '../pollToPromise.js'; import { when } from '../../Source/Cesium.js'; @@ -522,7 +523,8 @@ describe('Scene/Model', function() { enabled : true }, depthTest : { - enabled : true + enabled : true, + func : DepthFunction.LESS_OR_EQUAL }, depthMask : true, blending : {