Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- uniform float LumaRed <
- ui_label = "Red Exposure";
- ui_type = "drag";
- ui_min = -10.0; ui_max = 10.0; ui_step = 0.001;
- > = 0.0;
- uniform float LumaOrange <
- ui_label = "Orange Exposure";
- ui_type = "drag";
- ui_min = -10.0; ui_max = 10.0; ui_step = 0.001;
- > = 0.0;
- uniform float LumaYellow <
- ui_label = "Yellow Exposure";
- ui_type = "drag";
- ui_min = -10.0; ui_max = 10.0; ui_step = 0.001;
- > = 0.0;
- uniform float LumaGreen <
- ui_label = "Green Exposure";
- ui_type = "drag";
- ui_min = -10.0; ui_max = 10.0; ui_step = 0.001;
- > = 0.0;
- uniform float LumaAqua <
- ui_label = "Light Blue Exposure";
- ui_type = "drag";
- ui_min = -10.0; ui_max = 10.0; ui_step = 0.001;
- > = 0.0;
- uniform float LumaBlue <
- ui_label = "Blue Exposure";
- ui_type = "drag";
- ui_min = -10.0; ui_max = 10.0; ui_step = 0.001;
- > = 0.0;
- uniform float LumaMagenta <
- ui_label = "Magenta Exposure";
- ui_type = "drag";
- ui_min = -10.0; ui_max = 10.0; ui_step = 0.001;
- > = 0.0;
- #include "ReShade.fxh"
- float3 RGB2HCV(in float3 RGB)
- {
- RGB = saturate(RGB);
- float Epsilon = 1e-10;
- // Based on work by Sam Hocevar and Emil Persson
- float4 P = (RGB.g < RGB.b) ? float4(RGB.bg, -1.0, 2.0/3.0) : float4(RGB.gb, 0.0, -1.0/3.0);
- float4 Q = (RGB.r < P.x) ? float4(P.xyw, RGB.r) : float4(RGB.r, P.yzx);
- float C = Q.x - min(Q.w, Q.y);
- float H = abs((Q.w - Q.y) / (6 * C + Epsilon) + Q.z);
- return float3(H, C, Q.x);
- }
- float3 RGB2HSL(in float3 RGB)
- {
- float3 HCV = RGB2HCV(RGB);
- float L = HCV.z - HCV.y * 0.5;
- float S = HCV.y / (1.0000001 - abs(L * 2 - 1));
- return float3(HCV.x, S, L);
- }
- float3 HSL2RGB(in float3 HSL)
- {
- HSL = saturate(HSL);
- //HSL.z *= 0.99;
- 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)));
- float C = (1 - abs(2 * HSL.z - 1)) * HSL.y;
- return (RGB - 0.5) * C + HSL.z;
- }
- float4 MainPS(float4 vpos : SV_Position, float2 texcoord : TexCoord) : SV_Target
- {
- float4 color = tex2D(ReShade::BackBuffer, texcoord);
- float3 HSL = RGB2HSL(color.rgb);
- float huemults[7] =
- {
- /*red*/ max(saturate(1.0 - abs(HSL.x*12.0)), saturate(1.0 - abs((HSL.x-12.0/12)* 6.0))),
- /*orange*/ saturate(1.0 - abs((HSL.x-1.0/12)*12.0)),
- /*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)),
- /*green*/ saturate(1.0 - abs((HSL.x-4.0/12)* 6.0)),
- /*aqua*/ saturate(1.0 - abs((HSL.x-6.0/12)* 6.0)),
- /*blue*/ saturate(1.0 - abs((HSL.x-8.0/12)* 6.0)),
- /*magenta*/ saturate(1.0 - abs((HSL.x-10.0/12)* 6.0))
- };
- float colorgray = 0;
- colorgray += huemults[0] * HSL.z * exp2(LumaRed);
- colorgray += huemults[1] * HSL.z * exp2(LumaOrange);
- colorgray += huemults[2] * HSL.z * exp2(LumaYellow);
- colorgray += huemults[3] * HSL.z * exp2(LumaGreen);
- colorgray += huemults[4] * HSL.z * exp2(LumaAqua);
- colorgray += huemults[5] * HSL.z * exp2(LumaBlue);
- colorgray += huemults[6] * HSL.z * exp2(LumaMagenta);
- return colorgray;
- }
- technique AchromatopsiaHelper
- {
- pass
- {
- VertexShader = PostProcessVS;
- PixelShader = MainPS;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement