FilmicTonemapping.js 924 B

123456789101112131415161718192021222324252627
  1. //This file is automatically rebuilt by the Cesium build process.
  2. export default "uniform sampler2D colorTexture;\n\
  3. varying vec2 v_textureCoordinates;\n\
  4. #ifdef AUTO_EXPOSURE\n\
  5. uniform sampler2D autoExposure;\n\
  6. #endif\n\
  7. void main()\n\
  8. {\n\
  9. vec4 fragmentColor = texture2D(colorTexture, v_textureCoordinates);\n\
  10. vec3 color = fragmentColor.rgb;\n\
  11. #ifdef AUTO_EXPOSURE\n\
  12. float exposure = texture2D(autoExposure, vec2(0.5)).r;\n\
  13. color /= exposure;\n\
  14. #endif\n\
  15. const float A = 0.22;\n\
  16. const float B = 0.30;\n\
  17. const float C = 0.10;\n\
  18. const float D = 0.20;\n\
  19. const float E = 0.01;\n\
  20. const float F = 0.30;\n\
  21. const float white = 11.2;\n\
  22. vec3 c = ((color * (A * color + C * B) + D * E) / (color * ( A * color + B) + D * F)) - E / F;\n\
  23. float w = ((white * (A * white + C * B) + D * E) / (white * ( A * white + B) + D * F)) - E / F;\n\
  24. c = czm_inverseGamma(c / w);\n\
  25. gl_FragColor = vec4(c, fragmentColor.a);\n\
  26. }\n\
  27. ";