diff --git a/Source/Scene/Model.js b/Source/Scene/Model.js index 63e57103369f..dd1f6795d450 100644 --- a/Source/Scene/Model.js +++ b/Source/Scene/Model.js @@ -3505,7 +3505,8 @@ define([ function updateColor(model, frameState) { var scene3DOnly = frameState.scene3DOnly; - if (model.color.alpha < 1.0) { + var alpha = model.color.alpha; + if ((alpha > 0.0) && (alpha < 1.0)) { var nodeCommands = model._nodeCommands; var length = nodeCommands.length; // Generate translucent commands when the blend color has an alpha less than 1.0 @@ -3857,8 +3858,9 @@ define([ } } + var alpha = this.color.alpha; var displayConditionPassed = defined(this.distanceDisplayCondition) ? distanceDisplayConditionVisible(this, frameState) : true; - var show = this.show && displayConditionPassed && (this.scale !== 0.0); + var show = this.show && displayConditionPassed && (this.scale !== 0.0) && (alpha > 0.0); if ((show && this._state === ModelState.LOADED) || justLoaded) { var animated = this.activeAnimations.update(frameState) || this._cesiumAnimationsDirty; @@ -3945,11 +3947,12 @@ define([ var idl2D = frameState.mapProjection.ellipsoid.maximumRadius * CesiumMath.PI; var boundingVolume; + if (passes.render) { for (i = 0; i < length; ++i) { nc = nodeCommands[i]; if (nc.show) { - var translucent = (this.color.alpha < 1.0); + var translucent = (alpha < 1.0); var command = translucent ? nc.translucentCommand : nc.command; commandList.push(command); boundingVolume = nc.command.boundingVolume; diff --git a/Specs/Scene/ModelSpec.js b/Specs/Scene/ModelSpec.js index c6e056fb8808..3e4d240a34e1 100644 --- a/Specs/Scene/ModelSpec.js +++ b/Specs/Scene/ModelSpec.js @@ -1915,13 +1915,19 @@ defineSuite([ expect(sourceColor[1]).toEqual(0); expect(sourceColor[2]).toEqual(0); - // Check alpha. + // Check alpha model.colorBlendMode = ColorBlendMode.REPLACE; model.color = Color.fromAlpha(Color.LIME, 0.5); color = scene.renderForSpecs(); expect(color[0]).toEqual(0); expect(color[1]).toBeLessThan(255); expect(color[1]).toBeGreaterThan(0); + + // No commands are issued when the alpha is 0.0 + model.color = Color.fromAlpha(Color.LIME, 0.0); + scene.renderForSpecs(); + var commands = scene.frameState.commandList; + expect(commands.length).toBe(0); }); });