SHARE
TWEET

w

a guest May 6th, 2018 94 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. uniform float LumaRed <
  2.     ui_label = "Red Exposure";
  3.     ui_type = "drag";
  4.     ui_min = -10.0; ui_max = 10.0; ui_step = 0.001;
  5. > = 0.0;
  6.  
  7. uniform float LumaOrange <
  8.     ui_label = "Orange Exposure";
  9.     ui_type = "drag";
  10.     ui_min = -10.0; ui_max = 10.0; ui_step = 0.001;
  11. > = 0.0;
  12.  
  13. uniform float LumaYellow <
  14.     ui_label = "Yellow Exposure";
  15.     ui_type = "drag";
  16.     ui_min = -10.0; ui_max = 10.0; ui_step = 0.001;
  17. > = 0.0;
  18.  
  19. uniform float LumaGreen <
  20.     ui_label = "Green Exposure";
  21.     ui_type = "drag";
  22.     ui_min = -10.0; ui_max = 10.0; ui_step = 0.001;
  23. > = 0.0;
  24.  
  25. uniform float LumaAqua <
  26.     ui_label = "Light Blue Exposure";
  27.     ui_type = "drag";
  28.     ui_min = -10.0; ui_max = 10.0; ui_step = 0.001;
  29. > = 0.0;
  30.  
  31. uniform float LumaBlue <
  32.     ui_label = "Blue Exposure";
  33.     ui_type = "drag";
  34.     ui_min = -10.0; ui_max = 10.0; ui_step = 0.001;
  35. > = 0.0;
  36.  
  37. uniform float LumaMagenta <
  38.     ui_label = "Magenta Exposure";
  39.     ui_type = "drag";
  40.     ui_min = -10.0; ui_max = 10.0; ui_step = 0.001;
  41. > = 0.0;
  42.  
  43. #include "ReShade.fxh"
  44.  
  45. float3 RGB2HCV(in float3 RGB)
  46. {
  47.     RGB = saturate(RGB);
  48.     float Epsilon = 1e-10;
  49.         // Based on work by Sam Hocevar and Emil Persson
  50.         float4 P = (RGB.g < RGB.b) ? float4(RGB.bg, -1.0, 2.0/3.0) : float4(RGB.gb, 0.0, -1.0/3.0);
  51.         float4 Q = (RGB.r < P.x) ? float4(P.xyw, RGB.r) : float4(RGB.r, P.yzx);
  52.         float C = Q.x - min(Q.w, Q.y);
  53.         float H = abs((Q.w - Q.y) / (6 * C + Epsilon) + Q.z);
  54.         return float3(H, C, Q.x);
  55. }
  56.  
  57. float3 RGB2HSL(in float3 RGB)
  58. {
  59.         float3 HCV = RGB2HCV(RGB);
  60.         float L = HCV.z - HCV.y * 0.5;
  61.         float S = HCV.y / (1.0000001 - abs(L * 2 - 1));
  62.         return float3(HCV.x, S, L);
  63. }
  64.  
  65. float3 HSL2RGB(in float3 HSL)
  66. {
  67.     HSL = saturate(HSL);
  68.     //HSL.z *= 0.99;
  69.         float3 RGB = saturate(float3(abs(HSL.x * 6.0 - 3.0) - 1.0,2.0 - abs(HSL.x * 6.0 - 2.0),2.0 - abs(HSL.x * 6.0 - 4.0)));
  70.         float C = (1 - abs(2 * HSL.z - 1)) * HSL.y;
  71.         return (RGB - 0.5) * C + HSL.z;
  72. }
  73.  
  74. float4 MainPS(float4 vpos : SV_Position, float2 texcoord : TexCoord) : SV_Target
  75. {
  76.     float4 color = tex2D(ReShade::BackBuffer, texcoord);
  77.  
  78.         float3 HSL = RGB2HSL(color.rgb);
  79.  
  80.         float huemults[7] =
  81.     {
  82.     /*red*/ max(saturate(1.0 - abs(HSL.x*12.0)), saturate(1.0 - abs((HSL.x-12.0/12)* 6.0))),
  83.      /*orange*/ saturate(1.0 - abs((HSL.x-1.0/12)*12.0)),
  84.      /*yellow*/ max(saturate(1.0 - abs((HSL.x-2.0/12)*12.0))*step(HSL.x,2.0/12.0), saturate(1.0 - abs((HSL.x-2.0/12)* 6.0))*step(2.0/12.0,HSL.x)),
  85.       /*green*/ saturate(1.0 - abs((HSL.x-4.0/12)* 6.0)),
  86.        /*aqua*/ saturate(1.0 - abs((HSL.x-6.0/12)* 6.0)),
  87.        /*blue*/ saturate(1.0 - abs((HSL.x-8.0/12)* 6.0)),
  88.     /*magenta*/ saturate(1.0 - abs((HSL.x-10.0/12)* 6.0))
  89.     };
  90.  
  91.         float colorgray = 0;
  92.         colorgray += huemults[0] * HSL.z * exp2(LumaRed);
  93.         colorgray += huemults[1] * HSL.z * exp2(LumaOrange);
  94.         colorgray += huemults[2] * HSL.z * exp2(LumaYellow);
  95.         colorgray += huemults[3] * HSL.z * exp2(LumaGreen);
  96.         colorgray += huemults[4] * HSL.z * exp2(LumaAqua);
  97.         colorgray += huemults[5] * HSL.z * exp2(LumaBlue);
  98.         colorgray += huemults[6] * HSL.z * exp2(LumaMagenta);
  99.  
  100.         return colorgray;
  101.  
  102. }
  103.  
  104. technique AchromatopsiaHelper
  105. {
  106.     pass
  107.     {
  108.         VertexShader = PostProcessVS;
  109.         PixelShader = MainPS;
  110.     }
  111. }
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