You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
764 B

  1. /*******************************************************************************************
  2. *
  3. * rPBR [shader] - Background skybox fragment shader
  4. *
  5. * Copyright (c) 2017 Victor Fisac
  6. *
  7. **********************************************************************************************/
  8. #version 330
  9. // Input vertex attributes (from vertex shader)
  10. in vec3 fragPos;
  11. // Input uniform values
  12. uniform samplerCube environmentMap;
  13. // Output fragment color
  14. out vec4 finalColor;
  15. void main()
  16. {
  17. // Fetch color from texture map
  18. vec3 color = texture(environmentMap, fragPos).rgb;
  19. // Apply gamma correction
  20. color = color/(color + vec3(1.0));
  21. color = pow(color, vec3(1.0/2.2));
  22. // Calculate final fragment color
  23. finalColor = vec4(color, 1.0);
  24. }