BlackAndWhite.glsl 494 B

12345678910111213141516171819
  1. uniform sampler2D colorTexture;
  2. uniform float gradations;
  3. varying vec2 v_textureCoordinates;
  4. void main(void)
  5. {
  6. vec3 rgb = texture2D(colorTexture, v_textureCoordinates).rgb;
  7. #ifdef CZM_SELECTED_FEATURE
  8. if (czm_selected()) {
  9. gl_FragColor = vec4(rgb, 1.0);
  10. return;
  11. }
  12. #endif
  13. float luminance = czm_luminance(rgb);
  14. float darkness = luminance * gradations;
  15. darkness = (darkness - fract(darkness)) / gradations;
  16. gl_FragColor = vec4(vec3(darkness), 1.0);
  17. }