scanlines-abs.fx (1581B)
1 /* 2 Scanlines Sine Absolute Value 3 An ultra light scanline shader 4 by RiskyJumps 5 license: public domain 6 */ 7 8 #include "ReShade.fxh" 9 10 uniform float texture_sizeY < 11 ui_type = "drag"; 12 ui_min = 1.0; 13 ui_max = BUFFER_HEIGHT; 14 ui_label = "Scanlines Height [Scanlines-Absolute]"; 15 > = 240.0; 16 17 uniform float amp < 18 ui_type = "drag"; 19 ui_min = 0.0; 20 ui_max = 2.0; 21 ui_step = 0.05; 22 ui_label = "Amplitude [Scanlines-Absolute]"; 23 > = 1.25; 24 25 uniform float phase < 26 ui_type = "drag"; 27 ui_min = 0.0; 28 ui_max = 2.0; 29 ui_step = 0.05; 30 ui_label = "Phase [Scanlines-Absolute]"; 31 > = 0.0; 32 33 uniform float lines_black < 34 ui_type = "drag"; 35 ui_min = 0.0; 36 ui_max = 1.0; 37 ui_step = 0.05; 38 ui_label = "Lines Blacks [Scanlines-Absolute]"; 39 > = 0.0; 40 41 uniform float lines_white < 42 ui_type = "drag"; 43 ui_min = 0.0; 44 ui_max = 2.0; 45 ui_step = 0.05; 46 ui_label = "Lines Whites [Scanlines-Absolute]"; 47 > = 1.0; 48 49 #define freq 0.500000 50 #define offset 0.000000 51 #define pi 3.141592654 52 53 float4 PS_ScanlinesAbs(float4 pos : SV_POSITION, float2 tex : TEXCOORD0) : SV_TARGET 54 { 55 float3 color = tex2D(ReShade::BackBuffer, tex).xyz; 56 float grid; 57 58 float lines; 59 60 float omega = 2.0 * pi * freq; // Angular frequency 61 float angle = tex.y * omega * texture_sizeY + phase; 62 63 lines = sin(angle); 64 lines *= amp; 65 lines += offset; 66 lines = abs(lines) * (lines_white - lines_black) + lines_black; 67 color *= lines; 68 69 return color.xyzz; 70 } 71 72 technique ScanlinesAbs { 73 pass ScanlinesAbsolute{ 74 VertexShader = PostProcessVS; 75 PixelShader = PS_ScanlinesAbs; 76 } 77 }