Skip to content

Commit

Permalink
Merge pull request #5066 from AnalyticalGraphicsInc/blending-badness
Browse files Browse the repository at this point in the history
Change blending options in attempt to fix overlapping billboard fringes.
  • Loading branch information
bagnell authored Mar 16, 2017
2 parents ed034db + 514857d commit b58120d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Change Log
* `pitchAdjustHeight` to adjust camera pitch during exaggerated flights, to keep Earth in viewport.
* Added the event `Viewer.trackedEntityChanged`, which is raised when the value of `viewer.trackedEntity` changes. [#5060](https://github.com/AnalyticalGraphicsInc/cesium/pull/5060)
* Added `Camera.DEFAULT_OFFSET` for default view of objects with bounding spheres [#4936](https://github.com/AnalyticalGraphicsInc/cesium/pull/4936)
* Changed billboard blending behavior [#5066](https://github.com/AnalyticalGraphicsInc/cesium/pull/5056)
* Fix crunch compressed textures in IE11. [#5057](https://github.com/AnalyticalGraphicsInc/cesium/pull/5057)
* Fixed a bug in `Quaternion.fromHeadingPitchRoll` that made it erroneously throw an exception when passed individual angles in an unminified / debug build.
* Fix `GroundPrimitive` rendering in 2D and Columbus View [#5078](https://github.com/AnalyticalGraphicsInc/cesium/pull/5078)
Expand Down
12 changes: 9 additions & 3 deletions Source/Scene/BillboardCollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -1453,21 +1453,27 @@ define([
this._rsOpaque = RenderState.fromCache({
depthTest : {
enabled : true,
func : WebGLConstants.LEQUAL // Allows label glyphs and billboards to overlap.
func : WebGLConstants.LESS
},
depthMask : true
});
} else {
this._rsOpaque = undefined;
}

// If OPAQUE_AND_TRANSLUCENT is in use, only the opaque pass gets the benefit of the depth buffer,
// not the translucent pass. Otherwise, if the TRANSLUCENT pass is on its own, it turns on
// a depthMask in lieu of full depth sorting (because it has opaque-ish fragments that look bad in OIT).
// When the TRANSLUCENT depth mask is in use, label backgrounds require the depth func to be LEQUAL.
var useTranslucentDepthMask = this._blendOption === BlendOption.TRANSLUCENT;

if (this._blendOption === BlendOption.TRANSLUCENT || this._blendOption === BlendOption.OPAQUE_AND_TRANSLUCENT) {
this._rsTranslucent = RenderState.fromCache({
depthTest : {
enabled : true,
func : WebGLConstants.LEQUAL // Allows label glyphs and billboards to overlap.
func : (useTranslucentDepthMask ? WebGLConstants.LEQUAL : WebGLConstants.LESS)
},
depthMask : this._blendOption === BlendOption.TRANSLUCENT,
depthMask : useTranslucentDepthMask,
blending : BlendingState.ALPHA_BLEND
});
} else {
Expand Down

0 comments on commit b58120d

Please sign in to comment.