Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't use enormous offset for second log depth frustum near plane. #8727

Merged
merged 2 commits into from
Apr 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,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
}