{
  "Name": "AdjustColors",
  "_id": "61dd0e58-b23c-441c-af6e-e9b9295a9634",
  "Namespace": "lib.image.adjust",
  "Description": "Adjusts the color of an image by distinguishing between shadows, midtones and lights. Gray is neutral, intensity of the HUE adjustment increases with saturation of the parameter colors. \r\nThe alpha-channel decides in how far the saturation is boosted as well.\r\n\r\nFor HDR-Tone-Mapping use the ClampShadow and ClampLight parameters. The Bias-Component defines the s-curve for the light distribution.\r\n\r\nAlso note that SML stands for Shadow Midtones Lights.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nTo get most of the oparator, we suggest to get some background on colorgrading first. This is a good start: http://www.youtube.com/watch?v=k5rP2StmIXU&feature=BFa&list=PL6C89A9A9B9CEE4F7\r\n",
  "Inputs": [
    {
      "Name": "Code",
      "MetaInstanceID": "ca188f8e-8536-4de4-a9d1-aa43244802db",
      "DefaultValue": {
        "Type": "Text",
        "Value": [
          "//>>> _common parameters\r",
          "float4x4 objectToWorldMatrix;",
          "float4x4 worldToCameraMatrix;",
          "float4x4 projMatrix;",
          "Texture2D txDiffuse;",
          "float2 RenderTargetSize;",
          "//<<< _common parameters\r",
          "\r",
          "//>>> _parameters\r",
          "Texture2D Image;",
          "float Exposure;",
          "float4 Overall;",
          "float Saturation;",
          "float3 ExposureSML;",
          "float4 Shadows;",
          "float4 Midtones;",
          "float4 Lights;",
          "float3 SaturationSML;",
          "float2 ClampShadow;",
          "float2 ClampLight;",
          "float2 SMLRange;",
          "//<<< _parameters\r",
          "\r",
          "//>>> setup\r",
          "SamplerState samNearest\r",
          "{\r",
          "    Filter = MIN_MAG_MIP_LINEAR;\r",
          "    AddressU = Clamp;\r",
          "    AddressV = Clamp;\r",
          "};\r",
          "//<<< setup\r",
          "\r",
          "//>>> declarations\r",
          "struct VS_IN\r",
          "{\r",
          "    float4 pos : POSITION;\r",
          "    float2 texCoord : TEXCOORD;\r",
          "};\r",
          "\r",
          "struct PS_IN\r",
          "{\r",
          "    float4 pos : SV_POSITION;\r",
          "    float2 texCoord: TEXCOORD0;\t    \r",
          "    float3 worldTViewPos: TEXCOORD1;\r",
          "    float3 worldTViewDir: TEXCOORD2;\r",
          "};\r",
          "//<<< declarations\r",
          "\r",
          "//>>> _GS\r",
          "",
          "//<<< _GS\r",
          "\r",
          "//>>> _VS \r",
          "PS_IN VS( VS_IN input )",
          "{",
          "    PS_IN output = (PS_IN)0;",
          "",
          "    output.pos = mul(input.pos, worldToCameraMatrix);",
          "    output.pos = mul(output.pos, projMatrix);",
          "    output.texCoord = input.texCoord;",
          "",
          "    return output;",
          "}",
          "//<<< _VS\r",
          "\r",
          "//>>> PS\r",
          "\r",
          "float BiasedValue(float value, float aValue, float aBias, float bValue, float bBias) \r",
          "{\r",
          "    float u=  clamp((value-aValue)/(bValue-aValue),0,1);\r",
          "    \r",
          "\r",
          "    float fadeA= (float)pow(   u, pow( 0.5, -aBias));\r",
          "    float fadeB= (float)pow( 1-u, pow( 0.5, -bBias));\r",
          "    float v= fadeA * (1 - u) + u * (1-fadeB);\r",
          "    return aValue+v*(bValue-aValue);\r",
          "}\r",
          "\r",
          "\r",
          "\r",
          "float3 rgbToHsv(float r, float g, float b)\r",
          "{\r",
          "    float delta, h,s, v;\r",
          "    float tmp = (r < g) ? r : g;\r",
          "    float min = (tmp < b) ? tmp : b;\r",
          "\r",
          "    tmp = (r > g) ? r : g;\r",
          "    float max = (tmp > b) ? tmp : b;\r",
          "\r",
          "    v = max;\t\t\t\t\r",
          "    delta = max - min;\r",
          "    if (max == min)\r",
          "    {\r",
          "        return float3( 0, 0, max);\r",
          "    }\r",
          "    else if (max != 0)\r",
          "    {\r",
          "        s = delta/max;\r",
          "    }\r",
          "    else\r",
          "    {\r",
          "        // r = g = b = 0\t\t    // s = 0, v is undefined\r",
          "        s = 0;\r",
          "        h = 0;\r",
          "        return float3(h, s, v);\r",
          "    }\r",
          "    if (r == max)\r",
          "        h = (g - b) / delta;\t\t// between yellow & magenta\r",
          "    else if (g == max)\r",
          "        h = 2 + (b - r) / delta;\t// between cyan & yellow\r",
          "    else\r",
          "        h = 4 + (r - g) / delta;\t// between magenta & cyan\r",
          "    h *= 60;\t\t\t\t        // degrees\r",
          "    if (h < 0)\r",
          "        h += 360;\r",
          "    return float3(h,s,v);\r",
          "                \r",
          "}\r",
          "\r",
          "float3 hsvToRgb( float h, float s, float v)\r",
          "{\r",
          "    float satR, satG, satB;\r",
          "    if (h < 120.0f)\r",
          "    {\r",
          "        satR = (120.0f - h) / 60.0f;\r",
          "        satG = h / 60.0f;\r",
          "        satB = 0.0f;\r",
          "    }\r",
          "    else if (h < 240.0f)\r",
          "    {\r",
          "        satR = 0.0f;\r",
          "        satG = (240.0f - h) / 60.0f;\r",
          "        satB = (h - 120.0f) / 60.0f;\r",
          "    }\r",
          "    else\r",
          "    {\r",
          "        satR = (h - 240.0f) / 60.0f;\r",
          "        satG = 0.0f;\r",
          "        satB = (360.0f - h) / 60.0f;\r",
          "    }\r",
          "    satR = (satR < 1.0f) ? satR : 1.0f;\r",
          "    satG = (satG < 1.0f) ? satG : 1.0f;\r",
          "    satB = (satB < 1.0f) ? satB : 1.0f;\r",
          "\r",
          "    return float3( v*(s*satR + (1.0f - s)),\r",
          "                    v*(s*satG + (1.0f - s)),\r",
          "                    v*(s*satB + (1.0f - s)));\r",
          "                    \r",
          "}\r",
          "\r",
          "\r",
          "\r",
          "\r",
          "\r",
          "const float PI= 3.141578;\r",
          "const float toRad= 3.141578/180;\r",
          "\r",
          "float4 PS( PS_IN input ) : SV_Target\r",
          "{\r",
          "    // Convert colors-parameters to HSL\r",
          "    float3 overallHSL=  rgbToHsv(Overall.r,  Overall.g,  Overall.b);\r",
          "    float3 lightsHSL=   rgbToHsv(Lights.r,   Lights.g,   Lights.b);\r",
          "    float3 midtonesHSL= rgbToHsv(Midtones.r, Midtones.g, Midtones.b);\r",
          "    float3 shadowsHSL=  rgbToHsv(Shadows.r,  Shadows.g,  Shadows.b);\r",
          "    \r",
          "    float4 c=Image.Sample(samNearest, input.texCoord);\r",
          "    \r",
          "\r",
          "    // Adjust exposure\r",
          "    c *= Exposure;    \r",
          "                \r",
          "    c.r= clamp(BiasedValue( c.r, ClampShadow.x, ClampShadow.y, ClampLight.x, ClampLight.y),0,10);\r",
          "    c.g= clamp(BiasedValue( c.g, ClampShadow.x, ClampShadow.y, ClampLight.x, ClampLight.y),0,10);\r",
          "    c.b= clamp(BiasedValue( c.b, ClampShadow.x, ClampShadow.y, ClampLight.x, ClampLight.y),0,10);\r",
          "    \r",
          "    float3 HSL = rgbToHsv(c.r, c.g, c.b);\r",
          "    float h=HSL.x;\r",
          "    float s=HSL.y;     \r",
          "    float l=HSL.z;     \r",
          "   \r",
          "    // Compute Range levels for Shadow mids and lights\r",
          "    float shadows = clamp(-(l-SMLRange.x)/SMLRange.x,0,1);\r",
          "    float lights = clamp((l-SMLRange.y)/(1-SMLRange.y),0,1);\r",
          "    float mids=  1- cos(2*PI* clamp(l,0,1))/2+0.5;  // this is actually ignoring SMLRange\r",
          "        \r",
          "    // Adjust lighting\r",
          "    l *= (ExposureSML.x*shadows +ExposureSML.y*mids + ExposureSML.z*lights +1);\r",
          "\r",
          "    // Adjust saturation\r",
          "    s *= (Saturation +1);\r",
          "    s *= (SaturationSML.x*shadows + SaturationSML.y*mids+ + SaturationSML.z*lights+1);\r",
          "    s= clamp(s, 0,1);\r",
          "    \r",
          "    float3 rgb = hsvToRgb(h, s, l);\r",
          "    \r",
          "    //float3 overallRGB=  hsvToRgb(  overallHSL.x, s+2*Overall.a, l);\r",
          "    //float3 lightRGB=    hsvToRgb(   lightsHSL.x, s+2*Lights.a,  l);\r",
          "    //float3 midtonesRGB= hsvToRgb( midtonesHSL.x, s+2*Midtones.a,l);\r",
          "    //float3 shadowsRGB=  hsvToRgb(  shadowsHSL.x, s+2*Shadows.a, l);\r",
          "    \r",
          "\r",
          "    float3 overallColorRGB=  hsvToRgb(  overallHSL.x, overallHSL.y * (1 +  Overall.a), l);\r",
          "    float3 lightColorRGB=    hsvToRgb(   lightsHSL.x , lightsHSL.y * (1 +   Lights.a), l);\r",
          "    float3 midtonesColorRGB= hsvToRgb( midtonesHSL.x,midtonesHSL.y * (1 + Midtones.a), l);\r",
          "    float3 shadowsColorRGB=  hsvToRgb(  shadowsHSL.x, shadowsHSL.y * (1 +  Shadows.a), l);\r",
          "      \r",
          "    // Mix rgb colors with adjusted colors through saturation of color parameter\r",
          "    // i.e. affect more when moving the picker from the center to the edge of the color circle    \r",
          "    rgb= lerp( rgb, overallColorRGB,           overallHSL.y);   \r",
          "    rgb= lerp( rgb, midtonesColorRGB, mids  * midtonesHSL.y);\r",
          "    rgb= lerp( rgb, shadowsColorRGB,  shadows* shadowsHSL.y);\r",
          "    rgb= lerp( rgb, lightColorRGB,    lights *  lightsHSL.y);\r",
          "    \r",
          "    return float4(rgb,c.a);\r",
          "    \r",
          "}\r",
          "//<<< PS\r",
          "\r",
          "//>>> _technique\r",
          "technique10 Render",
          "{",
          "    pass P0",
          "    {",
          "        SetGeometryShader( 0 );",
          "        SetVertexShader( CompileShader( vs_4_0, VS() ) );",
          "        SetPixelShader( CompileShader( ps_4_0, PS() ) );",
          "    }",
          "}",
          "//<<< _technique\r",
          ""
        ]
      },
      "MetaID": "c522a66e-3260-4692-b3e3-79fd0361fa3d",
      "IsMultiInput": "False",
      "Relevance": "Optional",
      "Description": "",
      "Min": "-100000",
      "Max": "100000",
      "Scale": "0.1",
      "ScaleType": "Linear",
      "EnumValues": []
    },
    {
      "Name": "Image",
      "MetaInstanceID": "8d8aec47-95c2-4462-a208-ed305c8518f5",
      "DefaultValue": {
        "Type": "Image",
        "Value": "Framefield.Core.Image"
      },
      "MetaID": "9848060d-fd84-45b0-b658-d0d531c61dab",
      "IsMultiInput": "False",
      "Relevance": "Required",
      "Description": "",
      "Min": "-100000",
      "Max": "100000",
      "Scale": "1",
      "ScaleType": "Linear",
      "EnumValues": []
    },
    {
      "Name": "Exposure",
      "MetaInstanceID": "59dbff5b-8cd7-47e5-9b90-9afcd3c40a30",
      "DefaultValue": {
        "Type": "Float",
        "Value": "1"
      },
      "MetaID": "3f76dee3-3897-44ac-82d6-25ce9f53a506",
      "IsMultiInput": "False",
      "Relevance": "Optional",
      "Description": "",
      "Min": "-10",
      "Max": "100",
      "Scale": "0.01",
      "ScaleType": "Linear",
      "EnumValues": []
    },
    {
      "Name": "Overall.R",
      "MetaInstanceID": "1db31058-65e8-44e4-b36c-f46f9ac26835",
      "DefaultValue": {
        "Type": "Float",
        "Value": "0.5"
      },
      "MetaID": "3f76dee3-3897-44ac-82d6-25ce9f53a506",
      "IsMultiInput": "False",
      "Relevance": "Optional",
      "Description": "",
      "Min": "0",
      "Max": "1",
      "Scale": "0.01",
      "ScaleType": "Linear",
      "EnumValues": []
    },
    {
      "Name": "Overall.G",
      "MetaInstanceID": "aea5c4e7-b8d0-4722-b8f9-f5b8a1b7ae66",
      "DefaultValue": {
        "Type": "Float",
        "Value": "0.5"
      },
      "MetaID": "3f76dee3-3897-44ac-82d6-25ce9f53a506",
      "IsMultiInput": "False",
      "Relevance": "Optional",
      "Description": "",
      "Min": "0",
      "Max": "1",
      "Scale": "0.01",
      "ScaleType": "Linear",
      "EnumValues": []
    },
    {
      "Name": "Overall.B",
      "MetaInstanceID": "a71f8685-aefe-421e-b7dc-ab11eba3514b",
      "DefaultValue": {
        "Type": "Float",
        "Value": "0.5"
      },
      "MetaID": "3f76dee3-3897-44ac-82d6-25ce9f53a506",
      "IsMultiInput": "False",
      "Relevance": "Optional",
      "Description": "",
      "Min": "0",
      "Max": "1",
      "Scale": "0.01",
      "ScaleType": "Linear",
      "EnumValues": []
    },
    {
      "Name": "Overall.A",
      "MetaInstanceID": "b6396806-192b-49d6-bb95-7fae9efa78f1",
      "DefaultValue": {
        "Type": "Float",
        "Value": "0.2"
      },
      "MetaID": "3f76dee3-3897-44ac-82d6-25ce9f53a506",
      "IsMultiInput": "False",
      "Relevance": "Optional",
      "Description": "",
      "Min": "0",
      "Max": "1",
      "Scale": "0.01",
      "ScaleType": "Linear",
      "EnumValues": []
    },
    {
      "Name": "Saturation",
      "MetaInstanceID": "df3b33a1-b718-43ff-baeb-288e907f06f1",
      "DefaultValue": {
        "Type": "Float",
        "Value": "0"
      },
      "MetaID": "3f76dee3-3897-44ac-82d6-25ce9f53a506",
      "IsMultiInput": "False",
      "Relevance": "Optional",
      "Description": "",
      "Min": "-1",
      "Max": "1",
      "Scale": "0.01",
      "ScaleType": "Linear",
      "EnumValues": []
    },
    {
      "Name": "ExposureSML.X",
      "MetaInstanceID": "065f9bd3-51e2-401f-8825-35893e0e3381",
      "DefaultValue": {
        "Type": "Float",
        "Value": "0"
      },
      "MetaID": "3f76dee3-3897-44ac-82d6-25ce9f53a506",
      "IsMultiInput": "False",
      "Relevance": "Optional",
      "Description": "",
      "Min": "-1",
      "Max": "10",
      "Scale": "0.01",
      "ScaleType": "Linear",
      "EnumValues": []
    },
    {
      "Name": "ExposureSML.Y",
      "MetaInstanceID": "524a12fa-ef4c-4551-bcbf-878434d57fdf",
      "DefaultValue": {
        "Type": "Float",
        "Value": "0"
      },
      "MetaID": "3f76dee3-3897-44ac-82d6-25ce9f53a506",
      "IsMultiInput": "False",
      "Relevance": "Optional",
      "Description": "",
      "Min": "-1",
      "Max": "10",
      "Scale": "0.01",
      "ScaleType": "Linear",
      "EnumValues": []
    },
    {
      "Name": "ExposureSML.Z",
      "MetaInstanceID": "bce721b1-938e-4df0-bbe3-203ff27f1e3b",
      "DefaultValue": {
        "Type": "Float",
        "Value": "0"
      },
      "MetaID": "3f76dee3-3897-44ac-82d6-25ce9f53a506",
      "IsMultiInput": "False",
      "Relevance": "Optional",
      "Description": "",
      "Min": "-1",
      "Max": "10",
      "Scale": "0.01",
      "ScaleType": "Linear",
      "EnumValues": []
    },
    {
      "Name": "Shadows.R",
      "MetaInstanceID": "9efab6a3-7e5d-4285-b8ef-24a6e1ec7514",
      "DefaultValue": {
        "Type": "Float",
        "Value": "0.5"
      },
      "MetaID": "3f76dee3-3897-44ac-82d6-25ce9f53a506",
      "IsMultiInput": "False",
      "Relevance": "Optional",
      "Description": "",
      "Min": "0",
      "Max": "1",
      "Scale": "0.01",
      "ScaleType": "Linear",
      "EnumValues": []
    },
    {
      "Name": "Shadows.G",
      "MetaInstanceID": "bbed8769-835e-4045-bc47-0345507878a3",
      "DefaultValue": {
        "Type": "Float",
        "Value": "0.5"
      },
      "MetaID": "3f76dee3-3897-44ac-82d6-25ce9f53a506",
      "IsMultiInput": "False",
      "Relevance": "Optional",
      "Description": "",
      "Min": "0",
      "Max": "1",
      "Scale": "0.01",
      "ScaleType": "Linear",
      "EnumValues": []
    },
    {
      "Name": "Shadows.B",
      "MetaInstanceID": "6609f34d-b204-4477-86c0-387a9dc07cfc",
      "DefaultValue": {
        "Type": "Float",
        "Value": "0.5"
      },
      "MetaID": "3f76dee3-3897-44ac-82d6-25ce9f53a506",
      "IsMultiInput": "False",
      "Relevance": "Optional",
      "Description": "",
      "Min": "0",
      "Max": "1",
      "Scale": "0.01",
      "ScaleType": "Linear",
      "EnumValues": []
    },
    {
      "Name": "Shadows.A",
      "MetaInstanceID": "35ecd0e4-c6e7-45ed-88f8-ca2b7372b205",
      "DefaultValue": {
        "Type": "Float",
        "Value": "0.2"
      },
      "MetaID": "3f76dee3-3897-44ac-82d6-25ce9f53a506",
      "IsMultiInput": "False",
      "Relevance": "Optional",
      "Description": "",
      "Min": "0",
      "Max": "1",
      "Scale": "0.01",
      "ScaleType": "Linear",
      "EnumValues": []
    },
    {
      "Name": "Midtones.R",
      "MetaInstanceID": "8a456204-5099-4f93-a4f3-2133a9eec4a2",
      "DefaultValue": {
        "Type": "Float",
        "Value": "0.5"
      },
      "MetaID": "3f76dee3-3897-44ac-82d6-25ce9f53a506",
      "IsMultiInput": "False",
      "Relevance": "Optional",
      "Description": "",
      "Min": "0",
      "Max": "1",
      "Scale": "0.01",
      "ScaleType": "Linear",
      "EnumValues": []
    },
    {
      "Name": "Midtones.G",
      "MetaInstanceID": "5ce016b4-d6f4-4dd2-a27a-09b863fc7fb0",
      "DefaultValue": {
        "Type": "Float",
        "Value": "0.5"
      },
      "MetaID": "3f76dee3-3897-44ac-82d6-25ce9f53a506",
      "IsMultiInput": "False",
      "Relevance": "Optional",
      "Description": "",
      "Min": "0",
      "Max": "1",
      "Scale": "0.01",
      "ScaleType": "Linear",
      "EnumValues": []
    },
    {
      "Name": "Midtones.B",
      "MetaInstanceID": "c60f02b6-117b-495a-bd89-16c68964dd72",
      "DefaultValue": {
        "Type": "Float",
        "Value": "0.5"
      },
      "MetaID": "3f76dee3-3897-44ac-82d6-25ce9f53a506",
      "IsMultiInput": "False",
      "Relevance": "Optional",
      "Description": "",
      "Min": "0",
      "Max": "1",
      "Scale": "0.01",
      "ScaleType": "Linear",
      "EnumValues": []
    },
    {
      "Name": "Midtones.A",
      "MetaInstanceID": "78e4dcf7-82bb-41cb-8a11-f7201b2dd540",
      "DefaultValue": {
        "Type": "Float",
        "Value": "0.2"
      },
      "MetaID": "3f76dee3-3897-44ac-82d6-25ce9f53a506",
      "IsMultiInput": "False",
      "Relevance": "Optional",
      "Description": "",
      "Min": "0",
      "Max": "1",
      "Scale": "0.01",
      "ScaleType": "Linear",
      "EnumValues": []
    },
    {
      "Name": "Lights.R",
      "MetaInstanceID": "a6aefacf-a378-48a5-895b-a23d453e0432",
      "DefaultValue": {
        "Type": "Float",
        "Value": "0.5"
      },
      "MetaID": "3f76dee3-3897-44ac-82d6-25ce9f53a506",
      "IsMultiInput": "False",
      "Relevance": "Optional",
      "Description": "",
      "Min": "0",
      "Max": "1",
      "Scale": "0.01",
      "ScaleType": "Linear",
      "EnumValues": []
    },
    {
      "Name": "Lights.G",
      "MetaInstanceID": "3b9aba5c-ee52-4623-8738-877dabe99800",
      "DefaultValue": {
        "Type": "Float",
        "Value": "0.5"
      },
      "MetaID": "3f76dee3-3897-44ac-82d6-25ce9f53a506",
      "IsMultiInput": "False",
      "Relevance": "Optional",
      "Description": "",
      "Min": "0",
      "Max": "1",
      "Scale": "0.01",
      "ScaleType": "Linear",
      "EnumValues": []
    },
    {
      "Name": "Lights.B",
      "MetaInstanceID": "7d9909cb-9b34-4729-9daf-11212253220a",
      "DefaultValue": {
        "Type": "Float",
        "Value": "0.5"
      },
      "MetaID": "3f76dee3-3897-44ac-82d6-25ce9f53a506",
      "IsMultiInput": "False",
      "Relevance": "Optional",
      "Description": "",
      "Min": "0",
      "Max": "1",
      "Scale": "0.01",
      "ScaleType": "Linear",
      "EnumValues": []
    },
    {
      "Name": "Lights.A",
      "MetaInstanceID": "94bd2ca9-3ef0-451c-9532-caca1d3a1912",
      "DefaultValue": {
        "Type": "Float",
        "Value": "0.2"
      },
      "MetaID": "3f76dee3-3897-44ac-82d6-25ce9f53a506",
      "IsMultiInput": "False",
      "Relevance": "Optional",
      "Description": "",
      "Min": "0",
      "Max": "1",
      "Scale": "0.01",
      "ScaleType": "Linear",
      "EnumValues": []
    },
    {
      "Name": "SaturationSML.X",
      "MetaInstanceID": "9a877b52-0936-4465-b394-5490c8721d70",
      "DefaultValue": {
        "Type": "Float",
        "Value": "0"
      },
      "MetaID": "3f76dee3-3897-44ac-82d6-25ce9f53a506",
      "IsMultiInput": "False",
      "Relevance": "Optional",
      "Description": "",
      "Min": "-2",
      "Max": "2",
      "Scale": "0.01",
      "ScaleType": "Linear",
      "EnumValues": []
    },
    {
      "Name": "SaturationSML.Y",
      "MetaInstanceID": "5759b9e1-5f48-426a-a022-0434ecf457ed",
      "DefaultValue": {
        "Type": "Float",
        "Value": "0"
      },
      "MetaID": "3f76dee3-3897-44ac-82d6-25ce9f53a506",
      "IsMultiInput": "False",
      "Relevance": "Optional",
      "Description": "",
      "Min": "-2",
      "Max": "2",
      "Scale": "0.01",
      "ScaleType": "Linear",
      "EnumValues": []
    },
    {
      "Name": "SaturationSML.Z",
      "MetaInstanceID": "d65e53b4-87f3-408d-8256-00384ce0cb9c",
      "DefaultValue": {
        "Type": "Float",
        "Value": "0"
      },
      "MetaID": "3f76dee3-3897-44ac-82d6-25ce9f53a506",
      "IsMultiInput": "False",
      "Relevance": "Optional",
      "Description": "",
      "Min": "-2",
      "Max": "2",
      "Scale": "0.01",
      "ScaleType": "Linear",
      "EnumValues": []
    },
    {
      "Name": "ClampShadow.Value",
      "MetaInstanceID": "7c13af65-c52b-4a21-b927-412e4f056f43",
      "DefaultValue": {
        "Type": "Float",
        "Value": "0"
      },
      "MetaID": "3f76dee3-3897-44ac-82d6-25ce9f53a506",
      "IsMultiInput": "False",
      "Relevance": "Optional",
      "Description": "",
      "Min": "-100000",
      "Max": "100000",
      "Scale": "0.1",
      "ScaleType": "Linear",
      "EnumValues": []
    },
    {
      "Name": "ClampShadow.Bias",
      "MetaInstanceID": "3d09e29e-ad54-4519-8922-f7951e65bd32",
      "DefaultValue": {
        "Type": "Float",
        "Value": "0"
      },
      "MetaID": "3f76dee3-3897-44ac-82d6-25ce9f53a506",
      "IsMultiInput": "False",
      "Relevance": "Optional",
      "Description": "",
      "Min": "-100000",
      "Max": "100000",
      "Scale": "0.01",
      "ScaleType": "Linear",
      "EnumValues": []
    },
    {
      "Name": "ClampLight.Value",
      "MetaInstanceID": "23e6da43-077e-4856-88a2-4d78f38deef7",
      "DefaultValue": {
        "Type": "Float",
        "Value": "1"
      },
      "MetaID": "3f76dee3-3897-44ac-82d6-25ce9f53a506",
      "IsMultiInput": "False",
      "Relevance": "Optional",
      "Description": "",
      "Min": "-100000",
      "Max": "100000",
      "Scale": "0.1",
      "ScaleType": "Linear",
      "EnumValues": []
    },
    {
      "Name": "ClampLight.Bias",
      "MetaInstanceID": "8b36ca4f-c35c-47f9-9c95-0b353dcb364d",
      "DefaultValue": {
        "Type": "Float",
        "Value": "0"
      },
      "MetaID": "3f76dee3-3897-44ac-82d6-25ce9f53a506",
      "IsMultiInput": "False",
      "Relevance": "Optional",
      "Description": "",
      "Min": "-100000",
      "Max": "100000",
      "Scale": "0.1",
      "ScaleType": "Linear",
      "EnumValues": []
    },
    {
      "Name": "SMLRange.Low",
      "MetaInstanceID": "0d45efef-11ec-4963-b012-b6305f3720ad",
      "DefaultValue": {
        "Type": "Float",
        "Value": "1"
      },
      "MetaID": "3f76dee3-3897-44ac-82d6-25ce9f53a506",
      "IsMultiInput": "False",
      "Relevance": "Optional",
      "Description": "",
      "Min": "-100000",
      "Max": "100000",
      "Scale": "0.01",
      "ScaleType": "Linear",
      "EnumValues": []
    },
    {
      "Name": "SMLRange.High",
      "MetaInstanceID": "1bef4d5c-b277-46a4-85fe-62afa29d53d2",
      "DefaultValue": {
        "Type": "Float",
        "Value": "0"
      },
      "MetaID": "3f76dee3-3897-44ac-82d6-25ce9f53a506",
      "IsMultiInput": "False",
      "Relevance": "Optional",
      "Description": "",
      "Min": "-100000",
      "Max": "100000",
      "Scale": "0.01",
      "ScaleType": "Linear",
      "EnumValues": []
    }
  ],
  "Outputs": [
    {
      "Name": "Image",
      "MetaInstanceID": "d5df2446-e11e-4f4e-87de-b1b498c1ac60",
      "MetaID": "9848060d-fd84-45b0-b658-d0d531c61dab"
    }
  ],
  "OperatorParts": [
    {
      "MetaInstanceID": "7e7503d6-d027-49ae-9f8f-3708008230ad",
      "MetaID": "653cec7c-6651-470b-81c7-661ee4db79c6",
      "Name": "AdjustColorsFunc",
      "Version": "85999f96-c385-4253-8ee4-55f93a74cd07",
      "Type": "Float",
      "IsMultiInput": "True",
      "Script": [
        "//>>> _using",
        "using System;",
        "using System.Collections.Generic;",
        "using System.Linq;",
        "using System.Text;",
        "using SharpDX;",
        "using SharpDX.Direct3D11;",
        "using SharpDX.Windows;",
        "//<<< _using",
        "",
        "namespace Framefield.Core.ID653cec7c_6651_470b_81c7_661ee4db79c6",
        "{",
        "    public class Class_AdjustColors : FXImageFunction",
        "    {",
        "        //>>> _inputids",
        "        private enum InputId",
        "        {",
        "            Code = 0,",
        "            Image = 1,",
        "            Exposure = 2,",
        "            OverallR = 3,",
        "            OverallG = 4,",
        "            OverallB = 5,",
        "            OverallA = 6,",
        "            Saturation = 7,",
        "            ExposureSMLX = 8,",
        "            ExposureSMLY = 9,",
        "            ExposureSMLZ = 10,",
        "            ShadowsR = 11,",
        "            ShadowsG = 12,",
        "            ShadowsB = 13,",
        "            ShadowsA = 14,",
        "            MidtonesR = 15,",
        "            MidtonesG = 16,",
        "            MidtonesB = 17,",
        "            MidtonesA = 18,",
        "            LightsR = 19,",
        "            LightsG = 20,",
        "            LightsB = 21,",
        "            LightsA = 22,",
        "            SaturationSMLX = 23,",
        "            SaturationSMLY = 24,",
        "            SaturationSMLZ = 25,",
        "            ClampShadowValue = 26,",
        "            ClampShadowBias = 27,",
        "            ClampLightValue = 28,",
        "            ClampLightBias = 29,",
        "            SMLRangeLow = 30,",
        "            SMLRangeHigh = 31",
        "        }",
        "        //<<< _inputids",
        "",
        "        public override OperatorPartContext Eval(OperatorPartContext context, List<OperatorPart> inputs, int outputIdx)",
        "        {",
        "            return PrepareAndEvalOnChange(context, () =>",
        "            {",
        "                //>>> __params",
        "                var Code = inputs[(int)InputId.Code].Eval(context).Text;",
        "                var Image = inputs[(int)InputId.Image].Eval(context).Image;",
        "                var Exposure = inputs[(int)InputId.Exposure].Eval(context).Value;",
        "                var OverallR = inputs[(int)InputId.OverallR].Eval(context).Value;",
        "                var OverallG = inputs[(int)InputId.OverallG].Eval(context).Value;",
        "                var OverallB = inputs[(int)InputId.OverallB].Eval(context).Value;",
        "                var OverallA = inputs[(int)InputId.OverallA].Eval(context).Value;",
        "                var Overall = new Color4(OverallR, OverallG, OverallB, OverallA);",
        "                var Saturation = inputs[(int)InputId.Saturation].Eval(context).Value;",
        "                var ExposureSMLX = inputs[(int)InputId.ExposureSMLX].Eval(context).Value;",
        "                var ExposureSMLY = inputs[(int)InputId.ExposureSMLY].Eval(context).Value;",
        "                var ExposureSMLZ = inputs[(int)InputId.ExposureSMLZ].Eval(context).Value;",
        "                var ExposureSML = new Vector3(ExposureSMLX, ExposureSMLY, ExposureSMLZ);",
        "                var ShadowsR = inputs[(int)InputId.ShadowsR].Eval(context).Value;",
        "                var ShadowsG = inputs[(int)InputId.ShadowsG].Eval(context).Value;",
        "                var ShadowsB = inputs[(int)InputId.ShadowsB].Eval(context).Value;",
        "                var ShadowsA = inputs[(int)InputId.ShadowsA].Eval(context).Value;",
        "                var Shadows = new Color4(ShadowsR, ShadowsG, ShadowsB, ShadowsA);",
        "                var MidtonesR = inputs[(int)InputId.MidtonesR].Eval(context).Value;",
        "                var MidtonesG = inputs[(int)InputId.MidtonesG].Eval(context).Value;",
        "                var MidtonesB = inputs[(int)InputId.MidtonesB].Eval(context).Value;",
        "                var MidtonesA = inputs[(int)InputId.MidtonesA].Eval(context).Value;",
        "                var Midtones = new Color4(MidtonesR, MidtonesG, MidtonesB, MidtonesA);",
        "                var LightsR = inputs[(int)InputId.LightsR].Eval(context).Value;",
        "                var LightsG = inputs[(int)InputId.LightsG].Eval(context).Value;",
        "                var LightsB = inputs[(int)InputId.LightsB].Eval(context).Value;",
        "                var LightsA = inputs[(int)InputId.LightsA].Eval(context).Value;",
        "                var Lights = new Color4(LightsR, LightsG, LightsB, LightsA);",
        "                var SaturationSMLX = inputs[(int)InputId.SaturationSMLX].Eval(context).Value;",
        "                var SaturationSMLY = inputs[(int)InputId.SaturationSMLY].Eval(context).Value;",
        "                var SaturationSMLZ = inputs[(int)InputId.SaturationSMLZ].Eval(context).Value;",
        "                var SaturationSML = new Vector3(SaturationSMLX, SaturationSMLY, SaturationSMLZ);",
        "                var ClampShadowValue = inputs[(int)InputId.ClampShadowValue].Eval(context).Value;",
        "                var ClampShadowBias = inputs[(int)InputId.ClampShadowBias].Eval(context).Value;",
        "                var ClampShadow = new Vector2(ClampShadowValue, ClampShadowBias);",
        "                var ClampLightValue = inputs[(int)InputId.ClampLightValue].Eval(context).Value;",
        "                var ClampLightBias = inputs[(int)InputId.ClampLightBias].Eval(context).Value;",
        "                var ClampLight = new Vector2(ClampLightValue, ClampLightBias);",
        "                var SMLRangeLow = inputs[(int)InputId.SMLRangeLow].Eval(context).Value;",
        "                var SMLRangeHigh = inputs[(int)InputId.SMLRangeHigh].Eval(context).Value;",
        "                var SMLRange = new Vector2(SMLRangeLow, SMLRangeHigh);",
        "                //<<< __params",
        "                ",
        "                ",
        "    ",
        "                ClearRenderTarget(context, new SharpDX.Color4(0,0, 0, 1));",
        "",
        "                //>>> _setup",
        "                using (var ImageView = new ShaderResourceView(context.D3DDevice, Image))",
        "                {",
        "                    _effect.GetVariableByName(\"RenderTargetSize\").AsVector().Set(new Vector2(_usedViewport.Width, _usedViewport.Height));",
        "                    _effect.GetVariableByName(\"Image\").AsShaderResource().SetResource(ImageView);",
        "                    _effect.GetVariableByName(\"Exposure\").AsScalar().Set(Exposure);",
        "                    _effect.GetVariableByName(\"Overall\").AsVector().Set(new Vector4(OverallR, OverallG, OverallB, OverallA));",
        "                    _effect.GetVariableByName(\"Saturation\").AsScalar().Set(Saturation);",
        "                    _effect.GetVariableByName(\"ExposureSML\").AsVector().Set(new Vector3(ExposureSMLX, ExposureSMLY, ExposureSMLZ));",
        "                    _effect.GetVariableByName(\"Shadows\").AsVector().Set(new Vector4(ShadowsR, ShadowsG, ShadowsB, ShadowsA));",
        "                    _effect.GetVariableByName(\"Midtones\").AsVector().Set(new Vector4(MidtonesR, MidtonesG, MidtonesB, MidtonesA));",
        "                    _effect.GetVariableByName(\"Lights\").AsVector().Set(new Vector4(LightsR, LightsG, LightsB, LightsA));",
        "                    _effect.GetVariableByName(\"SaturationSML\").AsVector().Set(new Vector3(SaturationSMLX, SaturationSMLY, SaturationSMLZ));",
        "                    _effect.GetVariableByName(\"ClampShadow\").AsVector().Set(new Vector2(ClampShadowValue, ClampShadowBias));",
        "                    _effect.GetVariableByName(\"ClampLight\").AsVector().Set(new Vector2(ClampLightValue, ClampLightBias));",
        "                    _effect.GetVariableByName(\"SMLRange\").AsVector().Set(new Vector2(SMLRangeLow, SMLRangeHigh));",
        "                //<<< _setup",
        "",
        "                var prevBlendState = context.BlendState;",
        "                context.BlendState = OperatorPartContext.DefaultRenderer.DisabledBlendState;",
        "",
        "                Render(context);",
        "",
        "                context.BlendState = prevBlendState;",
        "",
        "                //>>> _cleanup",
        "                }",
        "                //<<< _cleanup",
        "            });",
        "        }",
        "",
        "    }",
        "}",
        ""
      ],
      "AdditionalAssemblies": []
    }
  ],
  "Operators": [],
  "Connections": [
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "7e7503d6-d027-49ae-9f8f-3708008230ad",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "d5df2446-e11e-4f4e-87de-b1b498c1ac60"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "ca188f8e-8536-4de4-a9d1-aa43244802db",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "7e7503d6-d027-49ae-9f8f-3708008230ad"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "8d8aec47-95c2-4462-a208-ed305c8518f5",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "7e7503d6-d027-49ae-9f8f-3708008230ad"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "59dbff5b-8cd7-47e5-9b90-9afcd3c40a30",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "7e7503d6-d027-49ae-9f8f-3708008230ad"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "1db31058-65e8-44e4-b36c-f46f9ac26835",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "7e7503d6-d027-49ae-9f8f-3708008230ad"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "aea5c4e7-b8d0-4722-b8f9-f5b8a1b7ae66",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "7e7503d6-d027-49ae-9f8f-3708008230ad"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "a71f8685-aefe-421e-b7dc-ab11eba3514b",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "7e7503d6-d027-49ae-9f8f-3708008230ad"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "b6396806-192b-49d6-bb95-7fae9efa78f1",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "7e7503d6-d027-49ae-9f8f-3708008230ad"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "df3b33a1-b718-43ff-baeb-288e907f06f1",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "7e7503d6-d027-49ae-9f8f-3708008230ad"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "065f9bd3-51e2-401f-8825-35893e0e3381",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "7e7503d6-d027-49ae-9f8f-3708008230ad"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "524a12fa-ef4c-4551-bcbf-878434d57fdf",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "7e7503d6-d027-49ae-9f8f-3708008230ad"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "bce721b1-938e-4df0-bbe3-203ff27f1e3b",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "7e7503d6-d027-49ae-9f8f-3708008230ad"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "9efab6a3-7e5d-4285-b8ef-24a6e1ec7514",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "7e7503d6-d027-49ae-9f8f-3708008230ad"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "bbed8769-835e-4045-bc47-0345507878a3",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "7e7503d6-d027-49ae-9f8f-3708008230ad"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "6609f34d-b204-4477-86c0-387a9dc07cfc",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "7e7503d6-d027-49ae-9f8f-3708008230ad"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "35ecd0e4-c6e7-45ed-88f8-ca2b7372b205",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "7e7503d6-d027-49ae-9f8f-3708008230ad"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "8a456204-5099-4f93-a4f3-2133a9eec4a2",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "7e7503d6-d027-49ae-9f8f-3708008230ad"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "5ce016b4-d6f4-4dd2-a27a-09b863fc7fb0",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "7e7503d6-d027-49ae-9f8f-3708008230ad"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "c60f02b6-117b-495a-bd89-16c68964dd72",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "7e7503d6-d027-49ae-9f8f-3708008230ad"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "78e4dcf7-82bb-41cb-8a11-f7201b2dd540",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "7e7503d6-d027-49ae-9f8f-3708008230ad"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "a6aefacf-a378-48a5-895b-a23d453e0432",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "7e7503d6-d027-49ae-9f8f-3708008230ad"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "3b9aba5c-ee52-4623-8738-877dabe99800",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "7e7503d6-d027-49ae-9f8f-3708008230ad"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "7d9909cb-9b34-4729-9daf-11212253220a",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "7e7503d6-d027-49ae-9f8f-3708008230ad"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "94bd2ca9-3ef0-451c-9532-caca1d3a1912",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "7e7503d6-d027-49ae-9f8f-3708008230ad"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "9a877b52-0936-4465-b394-5490c8721d70",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "7e7503d6-d027-49ae-9f8f-3708008230ad"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "5759b9e1-5f48-426a-a022-0434ecf457ed",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "7e7503d6-d027-49ae-9f8f-3708008230ad"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "d65e53b4-87f3-408d-8256-00384ce0cb9c",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "7e7503d6-d027-49ae-9f8f-3708008230ad"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "7c13af65-c52b-4a21-b927-412e4f056f43",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "7e7503d6-d027-49ae-9f8f-3708008230ad"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "3d09e29e-ad54-4519-8922-f7951e65bd32",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "7e7503d6-d027-49ae-9f8f-3708008230ad"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "23e6da43-077e-4856-88a2-4d78f38deef7",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "7e7503d6-d027-49ae-9f8f-3708008230ad"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "8b36ca4f-c35c-47f9-9c95-0b353dcb364d",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "7e7503d6-d027-49ae-9f8f-3708008230ad"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "0d45efef-11ec-4963-b012-b6305f3720ad",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "7e7503d6-d027-49ae-9f8f-3708008230ad"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "1bef4d5c-b277-46a4-85fe-62afa29d53d2",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "7e7503d6-d027-49ae-9f8f-3708008230ad"
    }
  ]
}