Skip to content
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
3 changes: 2 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@

##### Fixes :wrench:

- Fixed several artifcats on mobile devices caused by using insufficient precision. [#9064](https://github.com/CesiumGS/cesium/pull/9064)
- Fixed several artifacts on mobile devices caused by using insufficient precision. [#9064](https://github.com/CesiumGS/cesium/pull/9064)
- Fixed handling of `data:` scheme for the Cesium ion logo URL. [#9085](https://github.com/CesiumGS/cesium/pull/9085)
- Fixed an issue where the boundary rectangles in `TileAvailability` are not sorted correctly, causing terrain to sometimes fail to achieve its maximum detail. [#9098](https://github.com/CesiumGS/cesium/pull/9098)
- Fixed an issue where a request for an availability tile of the reference layer is delayed because the throttle option is on. [#9099](https://github.com/CesiumGS/cesium/pull/9099)
- Fixed an issue where Node.js tooling could not resolve package.json. [#9105](https://github.com/CesiumGS/cesium/pull/9105)
- Fixed classification artifacts on some mobile devices. [#9108](https://github.com/CesiumGS/cesium/pull/9108)
- Fixed an issue where Resource silently fails to load if being used multiple times. [#9093](https://github.com/CesiumGS/cesium/issues/9093)

### 1.72 - 2020-08-03
Expand Down
28 changes: 24 additions & 4 deletions Source/Shaders/Builtin/Functions/depthClamp.glsl
Original file line number Diff line number Diff line change
@@ -1,16 +1,32 @@
// emulated noperspective
#ifndef LOG_DEPTH
#if defined(GL_EXT_frag_depth) && !defined(LOG_DEPTH)
varying float v_WindowZ;
#endif

/**
* Clamps a vertex to the near and far planes.
* Emulates GL_DEPTH_CLAMP, which is not available in WebGL 1 or 2.
* GL_DEPTH_CLAMP clamps geometry that is outside the near and far planes,
* capping the shadow volume. More information here:
* https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_depth_clamp.txt.
*
* When GL_EXT_frag_depth is available we emulate GL_DEPTH_CLAMP by ensuring
* no geometry gets clipped by setting the clip space z value to 0.0 and then
* sending the unaltered screen space z value (using emulated noperspective
* interpolation) to the frag shader where it is clamped to [0,1] and then
* written with gl_FragDepth (see czm_writeDepthClamp). This technique is based on:
* https://stackoverflow.com/questions/5960757/how-to-emulate-gl-depth-clamp-nv.
*
* When GL_EXT_frag_depth is not available, which is the case on some mobile
* devices, we must attempt to fix this only in the vertex shader.
* The approach is to clamp the z value to the far plane, which closes the
* shadow volume but also distorts the geometry, so there can still be artifacts
* on frustum seams.
*
* @name czm_depthClamp
* @glslFunction
*
* @param {vec4} coords The vertex in clip coordinates.
* @returns {vec4} The vertex clipped to the near and far planes.
* @returns {vec4} The modified vertex.
*
* @example
* gl_Position = czm_depthClamp(czm_modelViewProjection * vec4(position, 1.0));
Expand All @@ -20,8 +36,12 @@ varying float v_WindowZ;
vec4 czm_depthClamp(vec4 coords)
{
#ifndef LOG_DEPTH
#ifdef GL_EXT_frag_depth
v_WindowZ = (0.5 * (coords.z / coords.w) + 0.5) * coords.w;
coords.z = clamp(coords.z, -coords.w, +coords.w);
coords.z = 0.0;
#else
coords.z = min(coords.z, coords.w);
#endif
#endif
return coords;
}
6 changes: 4 additions & 2 deletions Source/Shaders/Builtin/Functions/writeDepthClamp.glsl
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
// emulated noperspective
#ifndef LOG_DEPTH
#if defined(GL_EXT_frag_depth) && !defined(LOG_DEPTH)
varying float v_WindowZ;
#endif

/**
* Clamps a vertex to the far plane by writing the fragments depth.
* Emulates GL_DEPTH_CLAMP. Clamps a fragment to the near and far plane
* by writing the fragment's depth. See czm_depthClamp for more details.
* <p>
* The shader must enable the GL_EXT_frag_depth extension.
* </p>
Expand Down