PpsHdr.glsl 660 B

1234567891011121314151617181920212223242526
  1. /**
  2. * Pass 0 horizontal blur, pass 1 vertical, pass 2 median
  3. * The offset of the blurring depends on the luminance of the current fragment
  4. */
  5. #pragma anki vertShaderBegins
  6. #pragma anki include "shaders/SimpleVert.glsl"
  7. #pragma anki fragShaderBegins
  8. uniform sampler2D fai; ///< Its the IS FAI
  9. uniform float exposure;
  10. varying vec2 vTexCoords;
  11. void main()
  12. {
  13. vec3 _color_ = texture2D(fai, vTexCoords).rgb;
  14. float _luminance_ = dot(vec3(0.30, 0.59, 0.11), _color_); // AKA luminance
  15. const float _brightMax_ = 4.0;
  16. float _yd_ = exposure * (exposure/_brightMax_ + 1.0) / (exposure + 1.0) * _luminance_;
  17. _color_ *= _yd_;
  18. gl_FragData[0].rgb = _color_;
  19. }