GTU-pass3.fs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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 pi 3.14159265358
  25. #define a(x) abs(x)
  26. #define d(x,b) (pi*b*min(a(x)+0.5,1.0/b))
  27. #define e(x,b) (pi*b*min(max(a(x)-0.5,-1.0/b),1.0/b))
  28. #define STU(x,b) ((d(x,b)+sin(d(x,b))-e(x,b)-sin(e(x,b)))/(2.0*pi))
  29. #define X(i) (offset-(i))
  30. #define GETC (texture(source[0], vec2(texCoord.x - X*sourceSize[0].z,texCoord.y)).xyz)
  31. #define VAL (c*STU(X,(TV_HORIZONTAL_RESOLUTION*sourceSize[0].z)))
  32. #define PROCESS(i) X=X(i);c=GETC;tempColor+=VAL;
  33. uniform sampler2D source[];
  34. uniform vec4 sourceSize[];
  35. in Vertex {
  36. vec2 texCoord;
  37. };
  38. out vec4 fragColor;
  39. void main() {
  40. float offset = fract((texCoord.x * sourceSize[0].x) - 0.5);
  41. vec3 tempColor = vec3(0.0);
  42. float X;
  43. vec3 c;
  44. PROCESS(-6)PROCESS(-5)PROCESS(-4)PROCESS(-3)PROCESS(-2)PROCESS(-1)PROCESS( 0)
  45. PROCESS( 7)PROCESS( 6)PROCESS( 5)PROCESS( 4)PROCESS( 3)PROCESS( 2)PROCESS( 1)
  46. // tempColor=pow(tempColor,vec3(1.0/2.2));
  47. fragColor = vec4(tempColor,1.0);
  48. }