Skip to content

Commit

Permalink
Merge pull request #8727 from CesiumGS/log-depth-frustum-offset
Browse files Browse the repository at this point in the history
Don't use enormous offset for second log depth frustum near plane.
  • Loading branch information
lilleyse authored Apr 6, 2020
2 parents ffa1614 + 3ce51fd commit 0298fa0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Change Log
##### Fixes :wrench:

* Fixed several problems with polylines when the logarithmic depth buffer is enabled, which is the default on most systems. [#8706](https://github.com/CesiumGS/cesium/pull/8706)
* Fixed a bug with very long view ranges requiring multiple frustums even with the logarithmic depth buffer enabled. Previously, such scenes could resolve depth incorrectly. [#8727](https://github.com/CesiumGS/cesium/pull/8727)

### 1.68.0 - 2020-04-01

Expand Down
2 changes: 1 addition & 1 deletion Source/Scene/Scene.js
Original file line number Diff line number Diff line change
Expand Up @@ -1608,7 +1608,7 @@ import View from './View.js';
*/
opaqueFrustumNearOffset : {
get : function() {
return this._frameState.useLogDepth ? 0.9 : 0.9999;
return 0.9999;
}
}
});
Expand Down
4 changes: 2 additions & 2 deletions Source/Shaders/Builtin/Functions/vertexLogDepth.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ vec4 czm_updatePositionDepth(vec4 coords) {
void czm_vertexLogDepth()
{
#ifdef LOG_DEPTH
v_depthFromNearPlusOne = 1.0 - czm_currentFrustum.x + gl_Position.w;
v_depthFromNearPlusOne = (gl_Position.w - czm_currentFrustum.x) + 1.0;
gl_Position = czm_updatePositionDepth(gl_Position);
#endif
}
Expand All @@ -58,7 +58,7 @@ void czm_vertexLogDepth()
void czm_vertexLogDepth(vec4 clipCoords)
{
#ifdef LOG_DEPTH
v_depthFromNearPlusOne = 1.0 - czm_currentFrustum.x + clipCoords.w;
v_depthFromNearPlusOne = (clipCoords.w - czm_currentFrustum.x) + 1.0;
czm_updatePositionDepth(clipCoords);
#endif
}

0 comments on commit 0298fa0

Please sign in to comment.