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.

47 lines
1.1 KiB

  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 hatchOffsetY = 5.0;
  12. float lumThreshold01 = 0.9;
  13. float lumThreshold02 = 0.7;
  14. float lumThreshold03 = 0.5;
  15. float lumThreshold04 = 0.3;
  16. void main()
  17. {
  18. vec3 tc = vec3(1.0, 1.0, 1.0);
  19. float lum = length(texture(texture0, fragTexCoord).rgb);
  20. if (lum < lumThreshold01)
  21. {
  22. if (mod(gl_FragCoord.x + gl_FragCoord.y, 10.0) == 0.0) tc = vec3(0.0, 0.0, 0.0);
  23. }
  24. if (lum < lumThreshold02)
  25. {
  26. if (mod(gl_FragCoord.x - gl_FragCoord.y, 10.0) == 0.0) tc = vec3(0.0, 0.0, 0.0);
  27. }
  28. if (lum < lumThreshold03)
  29. {
  30. if (mod(gl_FragCoord.x + gl_FragCoord.y - hatchOffsetY, 10.0) == 0.0) tc = vec3(0.0, 0.0, 0.0);
  31. }
  32. if (lum < lumThreshold04)
  33. {
  34. if (mod(gl_FragCoord.x - gl_FragCoord.y - hatchOffsetY, 10.0) == 0.0) tc = vec3(0.0, 0.0, 0.0);
  35. }
  36. finalColor = vec4(tc, 1.0);
  37. }