imageProcessing.fragment.fx 665 B

123456789101112131415161718192021222324252627282930
  1. // Samplers
  2. varying vec2 vUV;
  3. uniform sampler2D textureSampler;
  4. #include<imageProcessingDeclaration>
  5. #include<helperFunctions>
  6. #include<imageProcessingFunctions>
  7. void main(void)
  8. {
  9. vec4 result = texture2D(textureSampler, vUV);
  10. #ifdef IMAGEPROCESSING
  11. #ifndef FROMLINEARSPACE
  12. // Need to move to linear space for subsequent operations.
  13. result.rgb = toLinearSpace(result.rgb);
  14. #endif
  15. result = applyImageProcessing(result);
  16. #else
  17. // In case where the input is in linear space we at least need to put it back in gamma.
  18. #ifdef FROMLINEARSPACE
  19. result = applyImageProcessing(result);
  20. #endif
  21. #endif
  22. gl_FragColor = result;
  23. }