From 8997f2f0174b0008dd38cb32e5076e7d021d3962 Mon Sep 17 00:00:00 2001 From: Kangning Li Date: Thu, 28 Jun 2018 09:57:16 -0400 Subject: [PATCH] clamp to far plane for polyline on terrain volumes --- Source/Shaders/PolylineShadowVolumeFS.glsl | 6 ++++++ Source/Shaders/PolylineShadowVolumeVS.glsl | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Source/Shaders/PolylineShadowVolumeFS.glsl b/Source/Shaders/PolylineShadowVolumeFS.glsl index 1042fe7f2c2f..9bd21c42fa50 100644 --- a/Source/Shaders/PolylineShadowVolumeFS.glsl +++ b/Source/Shaders/PolylineShadowVolumeFS.glsl @@ -1,3 +1,7 @@ +#ifdef GL_EXT_frag_depth +#extension GL_EXT_frag_depth : enable +#endif + varying vec4 v_startPlaneNormalEcAndHalfWidth; varying vec4 v_endPlaneNormalEcAndBatchId; varying vec4 v_rightPlaneEC; // Technically can compute distance for this here @@ -78,4 +82,6 @@ void main(void) czm_material material = czm_getMaterial(materialInput); gl_FragColor = vec4(material.diffuse + material.emission, material.alpha); #endif // PER_INSTANCE_COLOR + + czm_writeDepthClampedToFarPlane(); } diff --git a/Source/Shaders/PolylineShadowVolumeVS.glsl b/Source/Shaders/PolylineShadowVolumeVS.glsl index c0ae4e2d1bee..9d17be9312d2 100644 --- a/Source/Shaders/PolylineShadowVolumeVS.glsl +++ b/Source/Shaders/PolylineShadowVolumeVS.glsl @@ -157,7 +157,7 @@ void main() #endif positionEC.xyz += width * normalEC; - gl_Position = czm_projection * positionEC; + gl_Position = czm_depthClampFarPlane(czm_projection * positionEC); #ifdef ANGLE_VARYING // Approximate relative screen space direction of the line.