SHARE
TWEET

Untitled

a guest Sep 25th, 2015 14 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #define USE_VHS                                         1                       //[0 or 1] Enables the base effect (Just NTSC colors)
  2.  
  3. #define bUseTapeNoise                           0                       //[0 or 1] Tape noise that scrolls trough the screen.
  4. #define bUseVCRDistort                          0                       //[0 or 1] VCR Distortion
  5. #define bUseDirtyCRT                            0                       //[0 or 1] Dirty CRT Shader, adds color distortion
  6. #define bUseVHSDistort                          1                       //[0 or 1] Analogical signal distortion
  7.  
  8. #if (USE_VHS == 1)
  9.  
  10. uniform float TimerVHS < string source = "timer"; >;
  11.  
  12. texture2D RFX_backbufferTex : COLOR;
  13. texture2D RFX_originalTex : COLOR;
  14.  
  15. #define RFX_pixelSize RFX_PixelSize
  16. #define RFX_PixelSize float2(BUFFER_RCP_WIDTH, BUFFER_RCP_HEIGHT)
  17. #define RFX_ScreenSize float2(BUFFER_WIDTH, BUFFER_HEIGHT)
  18. #define RFX_ScreenSizeFull float4(BUFFER_WIDTH, BUFFER_RCP_WIDTH, float(BUFFER_WIDTH) / float(BUFFER_HEIGHT), float(BUFFER_HEIGHT) / float(BUFFER_WIDTH)) // x = Width, y = 1 / Width, z = ScreenScaleY, w = 1 / ScreenScaleY
  19.  
  20. texture   texnoise2  < string source = "VHS/KFnoise.png";  > {Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; Format = RGBA8;};
  21.  
  22. sampler2D RFX_backbufferColor { Texture = RFX_backbufferTex; };
  23. sampler2D RFX_originalColor { Texture = RFX_originalTex; };
  24.  
  25. sampler2D SamNoise
  26. {
  27.         Texture = texnoise2;
  28.         MinFilter = LINEAR;
  29.         MagFilter = LINEAR;
  30.         MipFilter = NONE;
  31.         AddressU = Clamp;
  32.         AddressV = Clamp;
  33. };
  34.  
  35. void RFX_VS_PostProcess(in uint id : SV_VertexID, out float4 pos : SV_Position, out float2 texcoord : TEXCOORD)
  36. {
  37.         texcoord.x = (id == 2) ? 2.0 : 0.0;
  38.         texcoord.y = (id == 1) ? 2.0 : 0.0;
  39.         pos = float4(texcoord * float2(2.0, -2.0) + float2(-1.0, 1.0), 0.0, 1.0);
  40. }
  41.  
  42. // Useful Constants
  43. static const float4 Zero = 0.0;
  44. static const float4 Half = 0.5;
  45. static const float4 One = 1.0;
  46. static const float4 Two = 2.0;
  47. static const float Pi = 3.1415926535;
  48. static const float Pi2 = 6.283185307;
  49.  
  50. // NTSC Constants
  51. static const float4 A = 0.5;
  52. static const float4 B = 0.5;
  53. static const float P = 1.0;
  54. static const float CCFrequency = 3.59754545;
  55. static const float YFrequency = 6.0;
  56. static const float IFrequency = 1.2;
  57. static const float QFrequency = 0.6;
  58. static const float NotchHalfWidth = 2.0;
  59. static const float ScanTime = 52.6;
  60. static const float MaxC = 2.1183;
  61. static const float4 MinC = -1.1183;
  62. static const float4 CRange = 3.2366;
  63.  
  64. float4 CompositeSample(float2 texcoord)
  65.  {
  66.         float2 InverseRes = 1.0 / RFX_ScreenSize.xy;
  67.         float2 InverseP = float2(P, 0.0) * InverseRes;
  68.        
  69.         // UVs for four linearly-interpolated samples spaced 0.25 texels apart
  70.         float2 C0 = texcoord;
  71.         float2 C1 = texcoord + InverseP * 0.25;
  72.         float2 C2 = texcoord + InverseP * 0.50;
  73.         float2 C3 = texcoord + InverseP * 0.75;
  74.         float4 Cx = float4(C0.x, C1.x, C2.x, C3.x);
  75.         float4 Cy = float4(C0.y, C1.y, C2.y, C3.y);
  76.  
  77.         float3 Texel0 = tex2D(RFX_backbufferColor, C0).rgb;
  78.         float3 Texel1 = tex2D(RFX_backbufferColor, C1).rgb;
  79.         float3 Texel2 = tex2D(RFX_backbufferColor, C2).rgb;
  80.         float3 Texel3 = tex2D(RFX_backbufferColor, C3).rgb;
  81.        
  82.         // Calculated the expected time of the sample.
  83.         float4 T = A * Cy * RFX_ScreenSize.x * Two + B + Cx;
  84.  
  85.         const float3 YTransform = float3(0.299, 0.587, 0.114);
  86.         const float3 ITransform = float3(0.595716, -0.274453, -0.321263);
  87.         const float3 QTransform = float3(0.211456, -0.522591, 0.311135);
  88.  
  89.         float Y0 = dot(Texel0, YTransform);
  90.         float Y1 = dot(Texel1, YTransform);
  91.         float Y2 = dot(Texel2, YTransform);
  92.         float Y3 = dot(Texel3, YTransform);
  93.         float4 Y = float4(Y0, Y1, Y2, Y3);
  94.  
  95.         float I0 = dot(Texel0, ITransform);
  96.         float I1 = dot(Texel1, ITransform);
  97.         float I2 = dot(Texel2, ITransform);
  98.         float I3 = dot(Texel3, ITransform);
  99.         float4 I = float4(I0, I1, I2, I3);
  100.  
  101.         float Q0 = dot(Texel0, QTransform);
  102.         float Q1 = dot(Texel1, QTransform);
  103.         float Q2 = dot(Texel2, QTransform);
  104.         float Q3 = dot(Texel3, QTransform);
  105.         float4 Q = float4(Q0, Q1, Q2, Q3);
  106.  
  107.         float4 W = Pi2 * CCFrequency * ScanTime;
  108.         float4 Encoded = Y + I * cos(T * W) + Q * sin(T * W);
  109.         return (Encoded - MinC) / CRange;
  110. }
  111.  
  112. float4 NTSCCodec(float2 texcoord)
  113. {
  114.         float2 InverseRes = 1.0 / RFX_ScreenSize.xy;
  115.         float4 YAccum = Zero;
  116.         float4 IAccum = Zero;
  117.         float4 QAccum = Zero;
  118.         float QuadXSize = RFX_ScreenSize.x * 4.0;
  119.         float TimePerSample = ScanTime / QuadXSize;
  120.        
  121.         // Frequency cutoffs for the individual portions of the signal that we extract.
  122.         // Y1 and Y2 are the positive and negative frequency limits of the notch filter on Y.
  123.         //
  124.         float Fc_y1 = (CCFrequency - NotchHalfWidth) * TimePerSample;
  125.         float Fc_y2 = (CCFrequency + NotchHalfWidth) * TimePerSample;
  126.         float Fc_y3 = YFrequency * TimePerSample;
  127.         float Fc_i = IFrequency * TimePerSample;
  128.         float Fc_q = QFrequency * TimePerSample;
  129.         float Pi2Length = Pi2 / 82.0;
  130.         float4 NotchOffset = float4(0.0, 1.0, 2.0, 3.0);
  131.         float4 W = Pi2 * CCFrequency * ScanTime;
  132.         for(float n = -41.0; n < 42.0; n += 4.0)
  133.         {
  134.                 float4 n4 = n + NotchOffset;
  135.                 float4 CoordX = texcoord.x + InverseRes.x * n4 * 0.25;
  136.                 float4 CoordY = texcoord.y;
  137.                 float2 TexCoord = float2(CoordX.r, CoordY.r);
  138.                 float4 C = CompositeSample(TexCoord) * CRange + MinC;
  139.                 float4 WT = W * (CoordX  + A * CoordY * Two * RFX_ScreenSize.x + B);
  140.  
  141.                 float4 SincYIn1 = Pi2 * Fc_y1 * n4;
  142.                 float4 SincYIn2 = Pi2 * Fc_y2 * n4;
  143.                 float4 SincYIn3 = Pi2 * Fc_y3 * n4;
  144.                 bool4 notEqual;
  145.         notEqual = SincYIn1, Zero;
  146.                 float4 SincY1 = sin(SincYIn1) / SincYIn1;
  147.                 float4 SincY2 = sin(SincYIn2) / SincYIn2;
  148.                 float4 SincY3 = sin(SincYIn3) / SincYIn3;
  149.                 if(SincYIn1.x == 0.0) SincY1.x = 1.0;
  150.                 if(SincYIn1.y == 0.0) SincY1.y = 1.0;
  151.                 if(SincYIn1.z == 0.0) SincY1.z = 1.0;
  152.                 if(SincYIn1.w == 0.0) SincY1.w = 1.0;
  153.                 if(SincYIn2.x == 0.0) SincY2.x = 1.0;
  154.                 if(SincYIn2.y == 0.0) SincY2.y = 1.0;
  155.                 if(SincYIn2.z == 0.0) SincY2.z = 1.0;
  156.                 if(SincYIn2.w == 0.0) SincY2.w = 1.0;
  157.                 if(SincYIn3.x == 0.0) SincY3.x = 1.0;
  158.                 if(SincYIn3.y == 0.0) SincY3.y = 1.0;
  159.                 if(SincYIn3.z == 0.0) SincY3.z = 1.0;
  160.                 if(SincYIn3.w == 0.0) SincY3.w = 1.0;
  161.                 //float4 IdealY = (2.0 * Fc_y1 * SincY1 - 2.0 * Fc_y2 * SincY2) + 2.0 * Fc_y3 * SincY3;
  162.                 float4 IdealY = (2.0 * Fc_y1 * SincY1 - 2.0 * Fc_y2 * SincY2) + 2.0 * Fc_y3 * SincY3;
  163.                 float4 FilterY = (0.54 + 0.46 * cos(Pi2Length * n4)) * IdealY;         
  164.                
  165.                 float4 SincIIn = Pi2 * Fc_i * n4;
  166.                 float4 SincI = sin(SincIIn) / SincIIn;
  167.                 if (SincIIn.x == 0.0) SincI.x = 1.0;
  168.                 if (SincIIn.y == 0.0) SincI.y = 1.0;
  169.                 if (SincIIn.z == 0.0) SincI.z = 1.0;
  170.                 if (SincIIn.w == 0.0) SincI.w = 1.0;
  171.                 float4 IdealI = 2.0 * Fc_i * SincI;
  172.                 float4 FilterI = (0.54 + 0.46 * cos(Pi2Length * n4)) * IdealI;
  173.                
  174.                 float4 SincQIn = Pi2 * Fc_q * n4;
  175.                 float4 SincQ = sin(SincQIn) / SincQIn;
  176.                 if (SincQIn.x == 0.0) SincQ.x = 1.0;
  177.                 if (SincQIn.y == 0.0) SincQ.y = 1.0;
  178.                 if (SincQIn.z == 0.0) SincQ.z = 1.0;
  179.                 if (SincQIn.w == 0.0) SincQ.w = 1.0;
  180.                 float4 IdealQ = 2.0 * Fc_q * SincQ;
  181.                 float4 FilterQ = (0.54 + 0.46 * cos(Pi2Length * n4)) * IdealQ;
  182.                
  183.                 YAccum = YAccum + C * FilterY;
  184.                 IAccum = IAccum + C * cos(WT) * FilterI;
  185.                 QAccum = QAccum + C * sin(WT) * FilterQ;
  186.         }
  187.        
  188.         float Y = YAccum.r + YAccum.g + YAccum.b + YAccum.a;
  189.         float I = (IAccum.r + IAccum.g + IAccum.b + IAccum.a) * 2.0;
  190.         float Q = (QAccum.r + QAccum.g + QAccum.b + QAccum.a) * 2.0;
  191.        
  192.         float3 YIQ = float3(Y, I, Q);
  193.  
  194.         float3 OutRGB = float3(dot(YIQ, float3(1.0, 0.956, 0.621)), dot(YIQ, float3(1.0, -0.272, -0.647)), dot(YIQ, float3(1.0, -1.106, 1.703)));              
  195.        
  196.         return float4(OutRGB, 1.0);
  197. }
  198.  
  199. void PS_Custom(float4 vpos : SV_Position, float2 texcoord : TEXCOORD, out float4 GetOut : SV_Target0)
  200. {      
  201.         float4 origcolor;
  202.        
  203.         origcolor=tex2D(RFX_backbufferColor, texcoord);
  204.        
  205.         origcolor = NTSCCodec(texcoord);
  206.  
  207.         origcolor = pow(origcolor,0.5);
  208.        
  209.         GetOut = origcolor;
  210. }
  211.  
  212. #define t TimerVHS.x
  213.  
  214. //random hash
  215. float4 hash42(float2 p){
  216.    
  217.         float4 p4 = frac(float4(p.xyxy) * float4(443.8975,397.2973, 491.1871, 470.7827));
  218.     p4 += dot(p4.wzxy, p4+19.19);
  219.     return frac(float4(p4.x * p4.y, p4.x*p4.z, p4.y*p4.w, p4.x*p4.w));
  220. }
  221.  
  222.  
  223. float hash( float n ){
  224.     return frac(sin(n)*43758.5453123);
  225. }
  226.  
  227. // 3d noise function (iq's)
  228. float n( in float3 x ){
  229.     float3 p = floor(x);
  230.     float3 f = frac(x);
  231.     f = f*f*(3.0-2.0*f);
  232.     float n = p.x + p.y*57.0 + 113.0*p.z;
  233.     float res = lerp(lerp(lerp( hash(n+  0.0), hash(n+  1.0),f.x),
  234.                         lerp( hash(n+ 57.0), hash(n+ 58.0),f.x),f.y),
  235.                     lerp(lerp( hash(n+113.0), hash(n+114.0),f.x),
  236.                         lerp( hash(n+170.0), hash(n+171.0),f.x),f.y),f.z);
  237.     return res;
  238. }
  239.  
  240. //tape noise
  241. float nn(float2 p){
  242.  
  243.  
  244.     float y = p.y;
  245.     float s = t*2.;
  246.    
  247.     float v = (n( float3(y*.01 +s,                      1., 1.0) ) + .0)
  248.                  *(n( float3(y*.011+1000.0+s,   1., 1.0) ) + .0)
  249.                  *(n( float3(y*.51+421.0+s,     1., 1.0) ) + .0)  
  250.         ;
  251.     //v*= n( float3( (fragCoord.xy + float2(s,0.))*100.,1.0) );
  252.         v*= hash42(   float2(p.x +t*0.01, p.y) ).x +.3 ;
  253.  
  254.    
  255.     v = pow(v+.3, 1.);
  256.         if(v<0.7) v = 0.;  //threshold
  257.     return v;
  258. }
  259.  
  260. void PS_Custom3(float4 vpos : SV_Position, float2 texcoord : TEXCOORD, out float4 OutGet : SV_Target0)
  261. {
  262.     float4 uv = 0.0;
  263.         uv.xy = texcoord.xy;
  264.         uv.w = 0.0;
  265.         float4 origcolor2= tex2Dlod(RFX_backbufferColor, uv);
  266.  
  267.     float linesN = 240; //fields per seconds
  268.     float one_y = RFX_ScreenSize.y / linesN; //field line
  269.     uv = floor(uv.xy*RFX_ScreenSize.xy/one_y)*one_y;
  270.  
  271.         float col =  nn(uv);
  272.  
  273.         origcolor2 += dot(col,0.233);
  274.  
  275.         OutGet = origcolor2;
  276. }
  277.  
  278. float noise(float2 p)
  279. {
  280.         float sampless = tex2D(SamNoise,float2(1.,2.*cos(TimerVHS))*TimerVHS*8. + p*1.).x;
  281.         sampless *= sampless;
  282.         return sampless;
  283. }
  284.  
  285. float onOff(float a, float b, float c)
  286. {
  287.         return step(c, sin(TimerVHS + a*cos(TimerVHS*b)));
  288. }
  289.  
  290. float ramp(float y, float start, float end)
  291. {
  292.         float inside = step(start,y) - step(end,y);
  293.         float fact = (y-start)/(end-start)*inside;
  294.         return (1.-fact) * inside;
  295.        
  296. }
  297.  
  298. float2 fmod(float2 a, float2 b)
  299. {
  300.   float2 c = frac(abs(a/b))*abs(b);
  301.   return (a < 0) ? -c : c;   /* if ( a < 0 ) c = 0-c */
  302. }
  303.  
  304. float mod(float a, float b)
  305. {
  306.   float c = frac(abs(a/b))*abs(b);
  307.   return (a < 0) ? -c : c;   /* if ( a < 0 ) c = 0-c */
  308. }
  309.  
  310. float stripes(float2 uv)
  311. {
  312.        
  313.         float noi = noise(uv*float2(0.5,1.) + float2(1.,3.));
  314.         return ramp(fmod(uv.y*4. + TimerVHS/2.+sin(TimerVHS + sin(TimerVHS*0.63)),1.),0.5,0.6)*noi;
  315. }
  316.  
  317. float3 getVideo(float2 uv)
  318. {
  319.         float2 look = uv;
  320.         float window = 1./(1.+20.*(look.y-mod(TimerVHS/4.,1.))*(look.y-mod(TimerVHS/4.,1.))); //this was broken
  321.         look.x = look.x + sin(look.y*10. + TimerVHS)/500.*onOff(4.,4.,.3)*(1.+cos(TimerVHS*80.))*window;
  322.         float vShift = 5.4*onOff(2.,3.,.9)*(sin(TimerVHS)*sin(TimerVHS*20.) + (0.5 + 0.1*sin(TimerVHS*200.)*cos(TimerVHS)));
  323.         look.y = mod(look.y + vShift, 1.); //this too
  324.         float3 video = tex2D(RFX_backbufferColor,look).rgb;
  325.         return video;
  326. }
  327.  
  328. float2 screenDistort(float2 uv)
  329. {
  330.         uv -= float2(.5,.5);
  331.         uv = uv*1.2*(1./1.2+2.*uv.x*uv.x*uv.y*uv.y);
  332.         uv += float2(.5,.5);
  333.         return uv;
  334. }
  335.  
  336. void PS_Custom4(float4 vpos : SV_Position, float2 texcoord : TEXCOORD, out float4 OutGet2 : SV_Target0)
  337. {
  338.     float4 origcolor3=tex2Dlod(RFX_backbufferColor, texcoord);
  339.         texcoord = screenDistort(texcoord);
  340.         float3 video = getVideo(texcoord);
  341.         float vigAmt = 3.+.3*sin(TimerVHS + 5.*cos(TimerVHS*5.));
  342.         float vignette = (1.-vigAmt*(texcoord.y-.5)*(texcoord.y-.5))*(1.-vigAmt*(texcoord.x-.5)*(texcoord.x-.5));
  343.        
  344.         //video += stripes(texcoord);
  345.         video += noise(texcoord*2.)/2.;
  346.         video *= vignette;
  347.         video *= (12.+fmod(texcoord.y*30.+TimerVHS,1.))/13.;
  348.        
  349.         origcolor3.xyz = video;
  350.        
  351.         OutGet2 = origcolor3;
  352. }
  353.  
  354. float rand(float2 co)
  355. {
  356.     float a = 12.9898;
  357.     float b = 78.233;
  358.     float c = 43758.5453;
  359.     float dst= dot(co.xy ,float2(a,b));
  360.     float snm= mod(dst,3.14); //this was broken aswell
  361.     return frac(sin(snm) * c);
  362. }
  363.  
  364. void PS_Custom5(float4 vpos : SV_Position, float2 texcoord : TEXCOORD, out float4 OutGet3 : SV_Target0)
  365. {
  366.     float4 origcolor4=tex2D(RFX_backbufferColor, texcoord);
  367.        
  368.         float magnitude = 0.0009;
  369.        
  370.        
  371.         // Set up offset
  372.         float2 offsetRedUV = texcoord;
  373.         offsetRedUV.x = texcoord.x + rand(float2(TimerVHS*0.03,texcoord.y*0.42)) * 0.001;
  374.         offsetRedUV.x += sin(rand(float2(TimerVHS*0.2, texcoord.y)))*magnitude;
  375.        
  376.         float2 offsetGreenUV = texcoord;
  377.         offsetGreenUV.x = texcoord.x + rand(float2(TimerVHS*0.004,texcoord.y*0.002)) * 0.004;
  378.         offsetGreenUV.x += sin(TimerVHS*9.0)*magnitude;
  379.        
  380.         float2 offsetBlueUV = texcoord;
  381.         offsetBlueUV.x = texcoord.y;
  382.         offsetBlueUV.x += rand(float2(cos(TimerVHS.x*0.01),sin(texcoord.y)));
  383.        
  384.         // Load Texture
  385.         float r = tex2D(RFX_backbufferColor, offsetRedUV).r;
  386.         float g = tex2D(RFX_backbufferColor, offsetGreenUV).g;
  387.         float b = tex2D(RFX_backbufferColor, texcoord).b;
  388.        
  389.         origcolor4 += float4(r,g,b,0);
  390.        
  391.         OutGet3 = origcolor4;
  392. }
  393.  
  394. float scanline(float2 uv) {
  395.         return sin(RFX_ScreenSize.y * uv.y * 0.7 - TimerVHS * 10.0);
  396. }
  397.  
  398. float slowscan(float2 uv) {
  399.         return sin(RFX_ScreenSize.y * uv.y * 0.02 + TimerVHS * 6.0);
  400. }
  401.  
  402. float2 colorShift(float2 uv) {
  403.         return float2(
  404.                 uv.x,
  405.                 uv.y + sin(TimerVHS)*0.02
  406.         );
  407. }
  408.  
  409. float noise2(float2 uv) {
  410.         return clamp(tex2D(SamNoise, uv.xy + TimerVHS*6.0).r +
  411.                 tex2D(SamNoise, uv.xy - TimerVHS*4.0).g, 0.96, 1.0);
  412. }
  413.  
  414. // from https://www.shadertoy.com/view/4sf3Dr
  415. // Thanks, Jasper
  416. float2 crt(float2 coord, float bend)
  417. {
  418.         // put in symmetrical coords
  419.         coord = (coord - 0.5) * 2.0;
  420.  
  421.         coord *= 0.5;  
  422.        
  423.         // deform coords
  424.         coord.x *= 1.0 + pow((abs(coord.y) / bend), 2.0);
  425.         coord.y *= 1.0 + pow((abs(coord.x) / bend), 2.0);
  426.  
  427.         // transform back to 0.0 - 1.0 space
  428.         coord  = (coord / 1.0) + 0.5;
  429.  
  430.         return coord;
  431. }
  432.  
  433. float2 colorshift(float2 uv, float amount, float rand) {
  434.        
  435.         return float2(
  436.                 uv.x,
  437.                 uv.y + amount * rand // * sin(uv.y * iResolution.y * 0.12 + TimerVHS)
  438.         );
  439. }
  440.  
  441. float2 scandistort(float2 uv) {
  442.         float scan1 = clamp(cos(uv.y * 2.0 + TimerVHS), 0.0, 1.0);
  443.         float scan2 = clamp(cos(uv.y * 2.0 + TimerVHS + 4.0) * 10.0, 0.0, 1.0) ;
  444.         float amount = scan1 * scan2 * uv.x;
  445.        
  446.         uv.x -= 0.05 * lerp(tex2D(SamNoise, float2(uv.x, amount)).r * amount, amount, 0.9);
  447.  
  448.         return uv;
  449.          
  450. }
  451.  
  452. float vignette(float2 uv) {
  453.         uv = (uv - 0.5) * 0.98;
  454.         return clamp(pow(cos(uv.x * 3.1415), 1.2) * pow(cos(uv.y * 3.1415), 1.2) * 50.0, 0.0, 1.0);
  455. }
  456.  
  457. void PS_Custom6(float4 vpos : SV_Position, float2 texcoord : TEXCOORD, out float4 OutGet3 : SV_Target0)
  458. {
  459.         float2 sdUv = scandistort(texcoord);
  460.         float2 crtUv = crt(sdUv, 2.0);
  461.        
  462.         float4 color;
  463.        
  464.         //float rand_r = sin(TimerVHS * 3.0 + sin(TimerVHS)) * sin(TimerVHS * 0.2);
  465.         //float rand_g = clamp(sin(TimerVHS * 1.52 * uv.y + sin(TimerVHS)) * sin(TimerVHS* 1.2), 0.0, 1.0);
  466.         float4 randss = tex2D(SamNoise, float2(TimerVHS * 0.01, TimerVHS * 0.02));
  467.        
  468.         color.r = tex2D(RFX_backbufferColor, crt(colorshift(sdUv, 0.025, randss.r), 2.0)).r;
  469.         color.g = tex2D(RFX_backbufferColor, crt(colorshift(sdUv, 0.01, randss.g), 2.0)).g;
  470.         color.b = tex2D(RFX_backbufferColor, crt(colorshift(sdUv, 0.024, randss.b), 2.0)).b;   
  471.                
  472.         float4 scanlineColor = scanline(crtUv);
  473.         float4 slowscanColor = slowscan(crtUv);
  474.        
  475.         OutGet3 = lerp(color, lerp(scanlineColor, slowscanColor, 0.5), 0.05) *
  476.                 vignette(texcoord) *
  477.                 noise2(texcoord);      
  478.         //fragColor = float4(vignette(uv));
  479.         //float2 scan_dist = scandistort(uv);
  480.         //fragColor = float4(scan_dist.x, scan_dist.y,0.0, 1.0);
  481. }
  482.  
  483. technique VHSReShade <bool enabled = 1; int toggle = 0x20; >
  484. {
  485.         pass NTSCFilter
  486.         {
  487.                 VertexShader = RFX_VS_PostProcess;
  488.                 PixelShader = PS_Custom;
  489.         }
  490.        
  491.         #if (bUseVCRDistort == 1)
  492.         pass CRTVignette
  493.         {
  494.                 VertexShader = RFX_VS_PostProcess;
  495.                 PixelShader = PS_Custom4;
  496.         }
  497.         #endif
  498.        
  499.         #if (bUseVHSDistort == 1)
  500.         pass VHSDistort
  501.         {
  502.                 VertexShader = RFX_VS_PostProcess;
  503.                 PixelShader = PS_Custom5;
  504.         }
  505.         #endif
  506.        
  507.         #if (bUseDirtyCRT == 1)
  508.         pass DirtyCRT
  509.         {
  510.                 VertexShader = RFX_VS_PostProcess;
  511.                 PixelShader = PS_Custom6;
  512.         }
  513.         #endif
  514.        
  515.         #if (bUseTapeNoise == 1)
  516.         pass TapeNoise
  517.         {
  518.                 VertexShader = RFX_VS_PostProcess;
  519.                 PixelShader = PS_Custom3;
  520.         }
  521.         #endif
  522.        
  523. }
  524.  
  525. #endif
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top