{
  "Name": "SimpleSSAO",
  "_id": "57574b08-e2a8-4fe0-aaac-9a9fccdd6938",
  "Namespace": "lib.image.generate",
  "Description": "Try to port SSOA from Tooll11",
  "Inputs": [
    {
      "Name": "Code",
      "MetaInstanceID": "ff434e82-27c4-411e-87ff-b1175d31a52b",
      "DefaultValue": {
        "Type": "Text",
        "Value": [
          "//>>> _common parameters\r",
          "float4x4 objectToWorldMatrix;",
          "float4x4 worldToCameraMatrix;",
          "float4x4 projMatrix;",
          "Texture2D txDiffuse;",
          "float2 RenderTargetSize;",
          "//<<< _common parameters\r",
          "\r",
          "//>>> _parameters\r",
          "Texture2D NoiseTexture;",
          "Texture2D DepthImage;",
          "float Passes;",
          "float KernelSize;",
          "float Seed;",
          "float2 DepthClip;",
          "float MixOriginal;",
          "float MultiplyOriginal;",
          "float4 Color;",
          "float2 BoostShadows;",
          "float2 DepthRange;",
          "float2 NoiseOffset;",
          "//<<< _parameters\r",
          "Texture2D txDepth;\r",
          " \r",
          "SamplerState samLinear",
          "{",
          "    Filter = MIN_MAG_MIP_LINEAR;",
          "    AddressU = Wrap;",
          "    AddressV = Wrap;",
          "};",
          "\r",
          "//>>> _declarations\r",
          "struct VS_IN",
          "{",
          "    float4 pos : POSITION;",
          "    float2 texCoord : TEXCOORD;",
          "};",
          "",
          "struct PS_IN",
          "{",
          "    float4 pos : SV_POSITION;",
          "    float2 texCoord: TEXCOORD0;",
          "};",
          "//<<< _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",
          "const static int KERNEL_SIZE = 8;\r",
          "const static float3 avKernel[KERNEL_SIZE] = {\r",
          "\tnormalize( float3(  1,  1,  1 ) ) * 0.125,\r",
          "\tnormalize( float3( -1, -1, -1 ) ) * 0.250,\r",
          "\tnormalize( float3( -1, -1,  1 ) ) * 0.375,\r",
          "\tnormalize( float3( -1,  1, -1 ) ) * 0.500,\r",
          "\tnormalize( float3( -1,  1,  1 ) ) * 0.625,\r",
          "\tnormalize( float3(  1, -1, -1 ) ) * 0.750,\r",
          "\tnormalize( float3(  1, -1,  1 ) ) * 0.875,\r",
          "\tnormalize( float3(  1,  1, -1 ) ) * 1.000\r",
          "};\r",
          "\r",
          "float2 textureSize= float2(256,256);\r",
          "float initSum = 0;\r",
          "float4 params= float4(1,0,   1, 1);\r",
          "\r",
          "float4 PS( PS_IN input ) : SV_Target\r",
          "{\r",
          "    float refDepth = txDepth.Sample(samLinear, input.texCoord).r;\r",
          "    //float c = depth;\r",
          "\r",
          "    //float3 depthTexel = texture2D(depthTexture, gl_TexCoord[0].st).xyz;\r",
          "    //float3 depthTexel = txDepth.Sample(samLinear, input.texCoord).rgb;    \r",
          "    float2 texelSize = float2(1.0/textureSize.x, 1.0/textureSize.y);\r",
          "    float factor = initSum;\r",
          "    float factorIncrement = 1.0/(Passes*float(KERNEL_SIZE));\r",
          "    \r",
          "    //float refSceneZ = (-DepthRange.x * DepthRange.y) / (refDepth - DepthRange.y);\r",
          "    \r",
          "    float refSceneZ = ( DepthRange.x) / (DepthRange.y + DepthRange.x - refDepth * (DepthRange.y - DepthRange.x));    \r",
          "    //return float4(refSceneZ/ 1,0,0,1);\r",
          "    \r",
          "    \r",
          "    for (int j = 0; j < Passes; j++)\r",
          "    {\r",
          "        //float3 random = texture2D(offsetTexture, gl_TexCoord[0].st * (7.0 + float(j))).xyz;\r",
          "        float2 randomCoords= float2( fmod( input.texCoord.x + 1.412* j + NoiseOffset.x,1) , \r",
          "                                     fmod( input.texCoord.y + 1.1123* j + NoiseOffset.y,1));\r",
          "        float3 random = NoiseTexture.Sample(samLinear, randomCoords).rgb;\r",
          "        random = normalize(random * 2.0 - 1.0);\r",
          "        for (int i = 0; i < KERNEL_SIZE; i++)\r",
          "        {\r",
          "            float3 vRotatedKernel = normalize(reflect( avKernel[i], random ));// * vKernelScale;\r",
          "            float2 offset = vRotatedKernel.xy * KernelSize*texelSize + input.texCoord.xy;\r",
          "            float depth = txDepth.Sample(samLinear, offset).r;\r",
          "                        \r",
          "            //float sceneZ = (-params.z * params.w) / (depth - params.w);\r",
          "            //float sceneZ = (-DepthRange.x * DepthRange.y) / (depth - DepthRange.y);\r",
          "            float sceneZ = ( DepthRange.x) / (DepthRange.y + DepthRange.x - depth * (DepthRange.y - DepthRange.x));    \r",
          "            if (sceneZ > refSceneZ)\r",
          "            {\r",
          "              factor += factorIncrement;\r",
          "            }\r",
          "        }\r",
          "    }\r",
          "    float4 orgColor= DepthImage.Sample(samLinear, input.texCoord);\r",
          "    \r",
          "    //return float4( refSceneZ/1000, 0,0,1);\r",
          "\r",
          "    factor = (factor - BoostShadows.x) * BoostShadows.y;\r",
          "    factor = clamp(factor, 0.0, 1.0);\r",
          "    float3 AOColor= lerp( Color.rgb,  float3(1,1,1), factor);   // mix shadow color\r",
          "    \r",
          "    \r",
          "    float fadeInBackgroundFactor =    clamp(( refSceneZ - DepthClip.x ) /  (DepthClip.y - DepthClip.x), 0,1);\r",
          "    //float fadeInBackgroundFactor =    refSceneZ;\r",
          "    //return float4(fadeInBackgroundFactor,0,0,1);\r",
          "    //if(refSceneZ > 0.05)\r",
          "    //    fadeInBackgroundFactor = 1;\r",
          "        \r",
          "    //return float4(fadeInBackgroundFactor,0,0,1);\r",
          "    \r",
          "    AOColor = lerp( float3(1,1,1), AOColor, Color.a);           // fade with color Alpha    \r",
          "    \r",
          "    AOColor = lerp ( AOColor,  float4(1,1,1,1), (fadeInBackgroundFactor));\r",
          "    \r",
          "    \r",
          "    //if( refSceneZ > DepthClip.y) {\r",
          "    //    return float4(orgColor.rgb, 1);\r",
          "    //}\r",
          "    \r",
          "    /*\r",
          "    if (  refSceneZ < DepthClip.x) {\r",
          "        float fadeFactor =  (refDepth - DepthClip.x) / (DepthClip.y - DepthClip.x);\r",
          "        AOColor= lerp(AOColor, float3(1,1,1), fadeFactor);\r",
          "        factor=1;\r",
          "    }*/\r",
          "    \r",
          "\r",
          "    \r",
          "    float3 blendedColor = MixOriginal < 1 ? orgColor * MixOriginal \r",
          "                                          : orgColor + (1-orgColor) * (MixOriginal-1);\r",
          "    blendedColor *= MultiplyOriginal;\r",
          "    //blendedColor.rgb /= 0.5;\r",
          "    /*\r",
          "    float4 blendedColor= float4( \r",
          "            MixOriginal < 0.5 ? orgColor.r*2*MixOriginal : orgColor.r+(1-orgColor.r) * (MixOriginal-0.5)*2,\r",
          "            MixOriginal < 0.5 ? orgColor.g*2*MixOriginal : orgColor.g+(1-orgColor.g) * (MixOriginal-0.5)*2,\r",
          "            MixOriginal < 0.5 ? orgColor.b*2*MixOriginal : orgColor.b+(1-orgColor.b) * (MixOriginal-0.5)*2,\r",
          "            1);\r",
          "            */    \r",
          "    //return blendedColor;            \r",
          "    \r",
          "    return float4( blendedColor * AOColor,1);\r",
          "    \r",
          "    \r",
          "    //return float4( lerp( Color.rgb, blendedColor.rgb * AOColor.rgb, Color.a / (1-factor) ), 1); \r",
          "    //float3 blendedWithAO= lerp(blendedColor.rgb, blendedColor.rgb * factor, Color.a*2); \r",
          "    // Mix Shadow Color\r",
          "    //return float4( lerp(blendedWithAO, Color.rgb, 1-factor), orgColor.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": "NoiseTexture",
      "MetaInstanceID": "f6bc5551-52d8-483a-ac01-8fae4d28798a",
      "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": "DepthImage",
      "MetaInstanceID": "3c25e048-480a-4671-9f5c-c3b286030eb8",
      "DefaultValue": {
        "Type": "Image",
        "Value": "Framefield.Core.Image"
      },
      "MetaID": "9848060d-fd84-45b0-b658-d0d531c61dab",
      "IsMultiInput": "False",
      "Relevance": "Required",
      "Description": "",
      "Min": "-100000",
      "Max": "100000",
      "Scale": "0.1",
      "ScaleType": "Linear",
      "EnumValues": []
    },
    {
      "Name": "Passes",
      "MetaInstanceID": "8a744012-8a44-4ee7-9745-b8137e281822",
      "DefaultValue": {
        "Type": "Float",
        "Value": "4"
      },
      "MetaID": "3f76dee3-3897-44ac-82d6-25ce9f53a506",
      "IsMultiInput": "False",
      "Relevance": "Optional",
      "Description": "",
      "Min": "1",
      "Max": "100",
      "Scale": "0.1",
      "ScaleType": "Linear",
      "EnumValues": []
    },
    {
      "Name": "KernelSize",
      "MetaInstanceID": "c9aab38e-c0fc-4590-a233-2fdc4e2df5d4",
      "DefaultValue": {
        "Type": "Float",
        "Value": "8"
      },
      "MetaID": "3f76dee3-3897-44ac-82d6-25ce9f53a506",
      "IsMultiInput": "False",
      "Relevance": "Optional",
      "Description": "",
      "Min": "-100000",
      "Max": "100000",
      "Scale": "0.1",
      "ScaleType": "Linear",
      "EnumValues": []
    },
    {
      "Name": "Seed",
      "MetaInstanceID": "7f3fb4c3-050f-40d2-9cf5-9b8aa242daf8",
      "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": "DepthClip.Min",
      "MetaInstanceID": "c54fd105-3b90-4ba1-b5b9-8fe207cee1c7",
      "DefaultValue": {
        "Type": "Float",
        "Value": "0.9999"
      },
      "MetaID": "3f76dee3-3897-44ac-82d6-25ce9f53a506",
      "IsMultiInput": "False",
      "Relevance": "Optional",
      "Description": "",
      "Min": "0",
      "Max": "1",
      "Scale": "0.001",
      "ScaleType": "Linear",
      "EnumValues": []
    },
    {
      "Name": "MixOriginal",
      "MetaInstanceID": "20b6c277-a5e9-4daa-a6e8-17ce88f4fb7b",
      "DefaultValue": {
        "Type": "Float",
        "Value": "1"
      },
      "MetaID": "3f76dee3-3897-44ac-82d6-25ce9f53a506",
      "IsMultiInput": "False",
      "Relevance": "Optional",
      "Description": "",
      "Min": "0",
      "Max": "2",
      "Scale": "0.01",
      "ScaleType": "Linear",
      "EnumValues": []
    },
    {
      "Name": "MultiplyOriginal",
      "MetaInstanceID": "0091df8d-1e10-4c0c-b02c-e059977551e2",
      "DefaultValue": {
        "Type": "Float",
        "Value": "1"
      },
      "MetaID": "3f76dee3-3897-44ac-82d6-25ce9f53a506",
      "IsMultiInput": "False",
      "Relevance": "Optional",
      "Description": "",
      "Min": "-10",
      "Max": "10",
      "Scale": "0.01",
      "ScaleType": "Linear",
      "EnumValues": []
    },
    {
      "Name": "Color.R",
      "MetaInstanceID": "2a43cdca-a8e9-419d-925c-e38b8eb9f8cc",
      "DefaultValue": {
        "Type": "Float",
        "Value": "0"
      },
      "MetaID": "3f76dee3-3897-44ac-82d6-25ce9f53a506",
      "IsMultiInput": "False",
      "Relevance": "Optional",
      "Description": "",
      "Min": "0",
      "Max": "1",
      "Scale": "0.01",
      "ScaleType": "Linear",
      "EnumValues": []
    },
    {
      "Name": "Color.G",
      "MetaInstanceID": "2d5d62f2-1bf7-4d82-abdd-57481af1622d",
      "DefaultValue": {
        "Type": "Float",
        "Value": "0"
      },
      "MetaID": "3f76dee3-3897-44ac-82d6-25ce9f53a506",
      "IsMultiInput": "False",
      "Relevance": "Optional",
      "Description": "",
      "Min": "0",
      "Max": "1",
      "Scale": "0.01",
      "ScaleType": "Linear",
      "EnumValues": []
    },
    {
      "Name": "Color.B",
      "MetaInstanceID": "8e569fa6-cb1f-482c-a4d3-20abd1e5c89d",
      "DefaultValue": {
        "Type": "Float",
        "Value": "0"
      },
      "MetaID": "3f76dee3-3897-44ac-82d6-25ce9f53a506",
      "IsMultiInput": "False",
      "Relevance": "Optional",
      "Description": "",
      "Min": "0",
      "Max": "1",
      "Scale": "0.01",
      "ScaleType": "Linear",
      "EnumValues": []
    },
    {
      "Name": "Color.A",
      "MetaInstanceID": "6619838d-893f-4d27-8b39-78cbd609a51e",
      "DefaultValue": {
        "Type": "Float",
        "Value": "1"
      },
      "MetaID": "3f76dee3-3897-44ac-82d6-25ce9f53a506",
      "IsMultiInput": "False",
      "Relevance": "Optional",
      "Description": "",
      "Min": "0",
      "Max": "1",
      "Scale": "0.01",
      "ScaleType": "Linear",
      "EnumValues": []
    },
    {
      "Name": "BoostShadows.Add",
      "MetaInstanceID": "76787e00-5381-4712-af56-f9278f90c6f8",
      "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": "BoostShadows.Multiply",
      "MetaInstanceID": "12e36e63-db4b-4820-b842-46e4f16d7af6",
      "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": "DepthRange.Near",
      "MetaInstanceID": "f86dfe38-de79-4a44-aa0f-6ffea3130622",
      "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": "DepthRange.Far",
      "MetaInstanceID": "d14ae827-6560-4192-9f9f-41bd420b42fb",
      "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": "NoiseOffset.X",
      "MetaInstanceID": "eaedd474-f2e2-4753-87dd-a8c009fba40b",
      "DefaultValue": {
        "Type": "Float",
        "Value": "1"
      },
      "MetaID": "3f76dee3-3897-44ac-82d6-25ce9f53a506",
      "IsMultiInput": "False",
      "Relevance": "Optional",
      "Description": "",
      "Min": "-10000",
      "Max": "10000",
      "Scale": "0.1",
      "ScaleType": "Linear",
      "EnumValues": []
    },
    {
      "Name": "NoiseOffset.Y",
      "MetaInstanceID": "ea994eb7-1fef-40a1-9f00-f739ce21aaf4",
      "DefaultValue": {
        "Type": "Float",
        "Value": "1"
      },
      "MetaID": "3f76dee3-3897-44ac-82d6-25ce9f53a506",
      "IsMultiInput": "False",
      "Relevance": "Optional",
      "Description": "",
      "Min": "-10000",
      "Max": "10000",
      "Scale": "0.1",
      "ScaleType": "Linear",
      "EnumValues": []
    },
    {
      "Name": "DepthClip.Max",
      "MetaInstanceID": "007852b2-cf46-4f7b-8735-d8b52e57cdfb",
      "DefaultValue": {
        "Type": "Float",
        "Value": "0"
      },
      "MetaID": "3f76dee3-3897-44ac-82d6-25ce9f53a506",
      "IsMultiInput": "False",
      "Relevance": "Optional",
      "Description": "",
      "Min": "0",
      "Max": "10000",
      "Scale": "0.001",
      "ScaleType": "Linear",
      "EnumValues": []
    }
  ],
  "Outputs": [
    {
      "Name": "Image",
      "MetaInstanceID": "9d65f07d-e842-4269-bf40-67219ba4aedd",
      "MetaID": "9848060d-fd84-45b0-b658-d0d531c61dab"
    }
  ],
  "OperatorParts": [
    {
      "MetaInstanceID": "11a07980-abe5-4d2c-9654-1cadb9260a6a",
      "MetaID": "cb9977a3-9af6-4d15-9f3d-e7c2580e4068",
      "Name": "SimpleSSAOFunc",
      "Version": "19f6cb3c-c769-4f0b-8fbf-1656bd535f01",
      "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",
        "using SharpDX.Direct3D;",
        "using SharpDX.DXGI;",
        "",
        "namespace Framefield.Core.IDcb9977a3_9af6_4d15_9f3d_e7c2580e4068",
        "{",
        "    public class Class_SimpleSSAO : FXImageFunction",
        "    {",
        "        //>>> _inputids",
        "        private enum InputId",
        "        {",
        "            Code = 0,",
        "            NoiseTexture = 1,",
        "            DepthImage = 2,",
        "            Passes = 3,",
        "            KernelSize = 4,",
        "            Seed = 5,",
        "            DepthClipMin = 6,",
        "            MixOriginal = 7,",
        "            MultiplyOriginal = 8,",
        "            ColorR = 9,",
        "            ColorG = 10,",
        "            ColorB = 11,",
        "            ColorA = 12,",
        "            BoostShadowsAdd = 13,",
        "            BoostShadowsMultiply = 14,",
        "            DepthRangeNear = 15,",
        "            DepthRangeFar = 16,",
        "            NoiseOffsetX = 17,",
        "            NoiseOffsetY = 18,",
        "            DepthClipMax = 19",
        "        }",
        "        //<<< _inputids",
        "",
        "        public override OperatorPartContext Eval(OperatorPartContext context, List<OperatorPart> inputs, int outputIdx) {",
        "            //>>> _params",
        "            var Code = inputs[(int)InputId.Code].Eval(context).Text;",
        "            var NoiseTexture = inputs[(int)InputId.NoiseTexture].Eval(context).Image; // Needs to be checked for null!",
        "            var DepthImage = inputs[(int)InputId.DepthImage].Eval(context).Image; // Needs to be checked for null!",
        "            var Passes = inputs[(int)InputId.Passes].Eval(context).Value;",
        "            var KernelSize = inputs[(int)InputId.KernelSize].Eval(context).Value;",
        "            var Seed = inputs[(int)InputId.Seed].Eval(context).Value;",
        "            var DepthClipMin = inputs[(int)InputId.DepthClipMin].Eval(context).Value;",
        "            var DepthClipMax = inputs[(int)InputId.DepthClipMax].Eval(context).Value;",
        "            var DepthClip = new Vector2(DepthClipMin, DepthClipMax);",
        "            var MixOriginal = inputs[(int)InputId.MixOriginal].Eval(context).Value;",
        "            var MultiplyOriginal = inputs[(int)InputId.MultiplyOriginal].Eval(context).Value;",
        "            var ColorR = inputs[(int)InputId.ColorR].Eval(context).Value;",
        "            var ColorG = inputs[(int)InputId.ColorG].Eval(context).Value;",
        "            var ColorB = inputs[(int)InputId.ColorB].Eval(context).Value;",
        "            var ColorA = inputs[(int)InputId.ColorA].Eval(context).Value;",
        "            var Color = new Color4(ColorR, ColorG, ColorB, ColorA);",
        "            var BoostShadowsAdd = inputs[(int)InputId.BoostShadowsAdd].Eval(context).Value;",
        "            var BoostShadowsMultiply = inputs[(int)InputId.BoostShadowsMultiply].Eval(context).Value;",
        "            var BoostShadows = new Vector2(BoostShadowsAdd, BoostShadowsMultiply);",
        "            var DepthRangeNear = inputs[(int)InputId.DepthRangeNear].Eval(context).Value;",
        "            var DepthRangeFar = inputs[(int)InputId.DepthRangeFar].Eval(context).Value;",
        "            var DepthRange = new Vector2(DepthRangeNear, DepthRangeFar);",
        "            var NoiseOffsetX = inputs[(int)InputId.NoiseOffsetX].Eval(context).Value;",
        "            var NoiseOffsetY = inputs[(int)InputId.NoiseOffsetY].Eval(context).Value;",
        "            var NoiseOffset = new Vector2(NoiseOffsetX, NoiseOffsetY);",
        "            //<<< _params",
        "",
        "            return PrepareAndEvalOnChange(context, () => {",
        "                ClearRenderTarget(context, new SharpDX.Color4(0, 0, 0, 1));",
        "",
        "                var shaderDesc = new ShaderResourceViewDescription();",
        "                shaderDesc.Format = Format.R32_Float;",
        "                shaderDesc.Dimension = ShaderResourceViewDimension.Texture2D;",
        "                shaderDesc.Texture2D.MipLevels = 1;",
        "                using (var depthTexture = new ShaderResourceView(context.D3DDevice, context.DepthImage, shaderDesc)) {",
        "                    _effect.GetVariableByName(\"txDepth\").AsShaderResource().SetResource(depthTexture); ",
        "",
        "                //>>> _setup",
        "                using (var NoiseTextureView = new ShaderResourceView(context.D3DDevice, NoiseTexture))",
        "                using (var DepthImageView = new ShaderResourceView(context.D3DDevice, DepthImage))",
        "                {",
        "                    _effect.GetVariableByName(\"RenderTargetSize\").AsVector().Set(new Vector2(_usedViewport.Width, _usedViewport.Height));",
        "                    _effect.GetVariableByName(\"NoiseTexture\").AsShaderResource().SetResource(NoiseTextureView);",
        "                    _effect.GetVariableByName(\"DepthImage\").AsShaderResource().SetResource(DepthImageView);",
        "                    _effect.GetVariableByName(\"Passes\").AsScalar().Set(Passes);",
        "                    _effect.GetVariableByName(\"KernelSize\").AsScalar().Set(KernelSize);",
        "                    _effect.GetVariableByName(\"Seed\").AsScalar().Set(Seed);",
        "                    _effect.GetVariableByName(\"DepthClip\").AsVector().Set(new Vector2(DepthClipMin, DepthClipMax));",
        "                    _effect.GetVariableByName(\"MixOriginal\").AsScalar().Set(MixOriginal);",
        "                    _effect.GetVariableByName(\"MultiplyOriginal\").AsScalar().Set(MultiplyOriginal);",
        "                    _effect.GetVariableByName(\"Color\").AsVector().Set(new Vector4(ColorR, ColorG, ColorB, ColorA));",
        "                    _effect.GetVariableByName(\"BoostShadows\").AsVector().Set(new Vector2(BoostShadowsAdd, BoostShadowsMultiply));",
        "                    _effect.GetVariableByName(\"DepthRange\").AsVector().Set(new Vector2(DepthRangeNear, DepthRangeFar));",
        "                    _effect.GetVariableByName(\"NoiseOffset\").AsVector().Set(new Vector2(NoiseOffsetX, NoiseOffsetY));",
        "                //<<< _setup",
        "",
        "                Render(context);",
        "",
        "                //>>> _cleanup",
        "                }",
        "                //<<< _cleanup",
        "                }",
        "            });",
        "        }",
        "",
        "    }",
        "}",
        "",
        ""
      ],
      "AdditionalAssemblies": []
    }
  ],
  "Operators": [],
  "Connections": [
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "11a07980-abe5-4d2c-9654-1cadb9260a6a",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "9d65f07d-e842-4269-bf40-67219ba4aedd"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "ff434e82-27c4-411e-87ff-b1175d31a52b",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "11a07980-abe5-4d2c-9654-1cadb9260a6a"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "f6bc5551-52d8-483a-ac01-8fae4d28798a",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "11a07980-abe5-4d2c-9654-1cadb9260a6a"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "3c25e048-480a-4671-9f5c-c3b286030eb8",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "11a07980-abe5-4d2c-9654-1cadb9260a6a"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "8a744012-8a44-4ee7-9745-b8137e281822",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "11a07980-abe5-4d2c-9654-1cadb9260a6a"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "c9aab38e-c0fc-4590-a233-2fdc4e2df5d4",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "11a07980-abe5-4d2c-9654-1cadb9260a6a"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "7f3fb4c3-050f-40d2-9cf5-9b8aa242daf8",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "11a07980-abe5-4d2c-9654-1cadb9260a6a"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "c54fd105-3b90-4ba1-b5b9-8fe207cee1c7",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "11a07980-abe5-4d2c-9654-1cadb9260a6a"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "20b6c277-a5e9-4daa-a6e8-17ce88f4fb7b",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "11a07980-abe5-4d2c-9654-1cadb9260a6a"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "0091df8d-1e10-4c0c-b02c-e059977551e2",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "11a07980-abe5-4d2c-9654-1cadb9260a6a"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "2a43cdca-a8e9-419d-925c-e38b8eb9f8cc",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "11a07980-abe5-4d2c-9654-1cadb9260a6a"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "2d5d62f2-1bf7-4d82-abdd-57481af1622d",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "11a07980-abe5-4d2c-9654-1cadb9260a6a"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "8e569fa6-cb1f-482c-a4d3-20abd1e5c89d",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "11a07980-abe5-4d2c-9654-1cadb9260a6a"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "6619838d-893f-4d27-8b39-78cbd609a51e",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "11a07980-abe5-4d2c-9654-1cadb9260a6a"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "76787e00-5381-4712-af56-f9278f90c6f8",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "11a07980-abe5-4d2c-9654-1cadb9260a6a"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "12e36e63-db4b-4820-b842-46e4f16d7af6",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "11a07980-abe5-4d2c-9654-1cadb9260a6a"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "f86dfe38-de79-4a44-aa0f-6ffea3130622",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "11a07980-abe5-4d2c-9654-1cadb9260a6a"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "d14ae827-6560-4192-9f9f-41bd420b42fb",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "11a07980-abe5-4d2c-9654-1cadb9260a6a"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "eaedd474-f2e2-4753-87dd-a8c009fba40b",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "11a07980-abe5-4d2c-9654-1cadb9260a6a"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "ea994eb7-1fef-40a1-9f00-f739ce21aaf4",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "11a07980-abe5-4d2c-9654-1cadb9260a6a"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "007852b2-cf46-4f7b-8735-d8b52e57cdfb",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "11a07980-abe5-4d2c-9654-1cadb9260a6a"
    }
  ]
}