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.

25 regels
648 B

8 jaren geleden
8 jaren geleden
  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 colDiffuse;
  8. // Output fragment color
  9. out vec4 finalColor;
  10. // NOTE: Add here your custom variables
  11. void main()
  12. {
  13. // Texel color fetching from texture sampler
  14. vec4 texelColor = texture(texture0, fragTexCoord)*colDiffuse*fragColor;
  15. // Convert texel color to grayscale using NTSC conversion weights
  16. float gray = dot(texelColor.rgb, vec3(0.299, 0.587, 0.114));
  17. // Calculate final fragment color
  18. finalColor = vec4(gray, gray, gray, texelColor.a);
  19. }