GTU-pass1.fs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #version 150
  2. ////////////////////////////////////////////////////////
  3. // GTU version 0.40
  4. // Author: aliaspider - aliaspider@gmail.com
  5. // License: GPLv3
  6. ////////////////////////////////////////////////////////
  7. ////////////////////////////////////////////////////////
  8. // SETTINGS
  9. ////////////////////////////////////////////////////////
  10. //#define CROP_OVERSCAN
  11. #define TV_COLOR_LEVELS
  12. //#define COMPOSITE_CONNECTION
  13. //#define NO_SCANLINES
  14. #define TV_HORIZONTAL_RESOLUTION 400.0
  15. #define TV_VERTICAL_RESOLUTION 300.0
  16. #define SIGNAL_RESOLUTION 280.0
  17. #define SIGNAL_RESOLUTION_I 83.0
  18. #define SIGNAL_RESOLUTION_Q 25.0
  19. #define TV_DISPLAY_GAMMA 2.4
  20. #define OUTPUT_DISPLAY_GAMMA 2.2
  21. ////////////////////////////////////////////////////////
  22. //
  23. ////////////////////////////////////////////////////////
  24. #define RGB_to_YIQ mat3x3( 0.299 , 0.595716 , 0.211456 , 0.587 , -0.274453 , -0.522591 , 0.114 , -0.321263 , 0.311135 )
  25. #define YIQ_to_RGB mat3x3( 1.0 , 1.0 , 1.0 , 0.9563 , -0.2721 , -1.1070 , 0.6210 , -0.6474 , 1.7046 )
  26. #define LEVELS(C) clamp((C -16/ 255.0)*255.0/(235.0-16.0),0.0,1.0)
  27. uniform sampler2D source[];
  28. uniform vec4 sourceSize[];
  29. in Vertex {
  30. vec2 texCoord;
  31. };
  32. out vec4 fragColor;
  33. void main() {
  34. vec3 c=texture2D(source[0], texCoord.xy).xyz;
  35. #ifdef TV_COLOR_LEVELS
  36. c=LEVELS(c);
  37. #endif
  38. #ifdef COMPOSITE_CONNECTION
  39. c=RGB_to_YIQ*c;
  40. #endif
  41. fragColor = vec4(c, 1.0);
  42. }