ContrastBias.glsl 517 B

1234567891011121314151617
  1. uniform sampler2D colorTexture;
  2. uniform float contrast;
  3. uniform float brightness;
  4. varying vec2 v_textureCoordinates;
  5. void main(void)
  6. {
  7. vec3 sceneColor = texture2D(colorTexture, v_textureCoordinates).xyz;
  8. sceneColor = czm_RGBToHSB(sceneColor);
  9. sceneColor.z += brightness;
  10. sceneColor = czm_HSBToRGB(sceneColor);
  11. float factor = (259.0 * (contrast + 255.0)) / (255.0 * (259.0 - contrast));
  12. sceneColor = factor * (sceneColor - vec3(0.5)) + vec3(0.5);
  13. gl_FragColor = vec4(sceneColor, 1.0);
  14. }