CompareAndPackTranslucentDepth.glsl 463 B

123456789101112
  1. uniform sampler2D u_opaqueDepthTexture;
  2. uniform sampler2D u_translucentDepthTexture;
  3. varying vec2 v_textureCoordinates;
  4. void main()
  5. {
  6. float opaqueDepth = texture2D(u_opaqueDepthTexture, v_textureCoordinates).r;
  7. float translucentDepth = texture2D(u_translucentDepthTexture, v_textureCoordinates).r;
  8. translucentDepth = czm_branchFreeTernary(translucentDepth > opaqueDepth, 1.0, translucentDepth);
  9. gl_FragColor = czm_packDepth(translucentDepth);
  10. }