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.

30 lines
718 B

  1. #version 330
  2. // Input vertex attributes (from vertex shader)
  3. in vec2 fragTexCoord;
  4. in vec4 fragColor;
  5. // Input uniform values
  6. uniform sampler2D texture0;
  7. uniform vec4 fragTintColor;
  8. // Output fragment color
  9. out vec4 finalColor;
  10. // NOTE: Add here your custom variables
  11. float gamma = 0.6;
  12. float numColors = 8.0;
  13. void main()
  14. {
  15. // Texel color fetching from texture sampler
  16. vec3 texelColor = texture(texture0, fragTexCoord.xy).rgb;
  17. texelColor = pow(texelColor, vec3(gamma, gamma, gamma));
  18. texelColor = texelColor*numColors;
  19. texelColor = floor(texelColor);
  20. texelColor = texelColor/numColors;
  21. texelColor = pow(texelColor, vec3(1.0/gamma));
  22. finalColor = vec4(texelColor, 1.0);
  23. }