hdrEnvMap.frag 777 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * Copyright (C) 2020, Inria
  3. * GRAPHDECO research group, https://team.inria.fr/graphdeco
  4. * All rights reserved.
  5. *
  6. * This software is free for non-commercial, research and evaluation use
  7. * under the terms of the LICENSE.md file.
  8. *
  9. * For inquiries contact sibr@inria.fr and/or George.Drettakis@inria.fr
  10. */
  11. #version 420
  12. uniform sampler2D tex;
  13. out vec4 out_color;
  14. in vec2 vertUV;
  15. float lin2sRGBF(float inF){
  16. if(inF<0.0031308){
  17. return 12.92*inF;
  18. }
  19. else{
  20. return 1.055*pow(inF,1.0/2.4)-0.055;
  21. }
  22. }
  23. vec4 lin2sRGB(vec4 inVec){
  24. return vec4(lin2sRGBF(inVec.x),lin2sRGBF(inVec.y),lin2sRGBF(inVec.z),inVec.w);
  25. }
  26. void main(void) {
  27. vec2 uv = vertUV;
  28. uv.y = 1.0 - uv.y; /// \todo TODO: Why Texture are flipped in y ?
  29. out_color = lin2sRGB(texture(tex, uv));
  30. }