Gaussian blur post processing material

Hi all! While working on the project I needed Gaussian blur material. With the help of the forum folks, I managed to write one and thought that someone else may find it useful too! So here it is!

dbf6089bc392d3877b75d23260fa39fe5127b661.jpeg

As you see not much is going on in the graph :smiley: so here’s CustomNode code:


float3 res = 0;
float2 invSize = PostprocessInput0Size.zw;

float weights] =
{
  0.01, 0.02, 0.04, 0.02, 0.01,
  0.02, 0.04, 0.08, 0.04, 0.02,
  0.04, 0.08, 0.16, 0.08, 0.04,
  0.02, 0.04, 0.08, 0.04, 0.02,
  0.01, 0.02, 0.04, 0.02, 0.01
};
float offsets] = { -2, -1, 0, 1, 2 };

uv *= 0.5;
for (int i = 0; i < 5; ++i)
{
  float v = uv.y + offsets* * invSize.y;
  int temp = i * 5;
  for (int j = 0; j < 5; ++j)
  {
    float u = uv.x + offsets[j] * invSize.x;
    float2 uvShifted = uv + float2(u, v);
    float weight = weights[temp + j];
    float3 tex = Texture2DSample(PostprocessInput0, PostprocessInput0Sampler, uvShifted).rgb;
    res += tex * weight;
  }
}

return float4(res, 1);

Enjoy!

p.s. It’s possible to separate the blur into horizontal and vertical passes, however in my case I needed to retain original contents of the render target thus made blurring in single step.

2 Likes

Just wondering how you managed to get this to work. I’ve tried setting it up slightly differently using a CustomTexture instead of post-process, but I keep getting X3003 errors and its not working

(truth be told, I have no idea what I’m doing in HLSL, so if you can shed some light on how to make this work with a texture, I’d be super happy)

Also: no copy-paste functionality working in the texture editor?

Crow87, look for the instructions in this post. I was able to sample texture using technique described there. As for CustomTexture seems that it’s compiled incorrectly (texture is passed, but CustomExpression node has sampler2D as input, not texture object).

In UE4 4.9.2 I had to use this:


float3 res = 0;
float2 invSize = GetPostProcessInputSize(0).zw;
int TexIndex = 14;
float weights] =
{
  0.01, 0.02, 0.04, 0.02, 0.01,
  0.02, 0.04, 0.08, 0.04, 0.02,
  0.04, 0.08, 0.16, 0.08, 0.04,
  0.02, 0.04, 0.08, 0.04, 0.02,
  0.01, 0.02, 0.04, 0.02, 0.01
};
float offsets] = { -2, -1, 0, 1, 2 };

uv *= 0.5;
for (int i = 0; i < 5; ++i)
{
  float v = uv.y + offsets* * invSize.y;
  int temp = i * 5;
  for (int j = 0; j < 5; ++j)
  {
    float u = uv.x + offsets[j] * invSize.x;
    float2 uvShifted = uv + float2(u, v);
    float weight = weights[temp + j];
    float3 tex = SceneTextureLookup(uvShifted, TexIndex, false);
    res += tex * weight;
  }
}

return float4(res, 1);

I appreciate the update! I was using a modified version of this code in 4.5 to simulate bloom in splitscreen but when I updated to 4.9, it wasn’t working. Thanks!

Hi,

Thanks for code. I am a noob when it comes to HLSL. I am wondering if it’s possible to change the size of of blur applied to the scene?

Thanks a lot for the code. Can you help me on developping a bilateral filter ? I am totally lost with UE4 shader development ( and I am not hiding that in shaders I am a noob ). I would very much appreciate it

I would suggest the Guided Filter instead: http://research.microsoft.com/en-us/um/people/kahe/eccv10/ As stated on the website: “Try the guided filter in any situation when the bilateral filter works well. The guided filter is much faster and sometimes (though not always) works better.”

the problem with guided filter is that how do you use it in real time cases ? for example in my case it is gonna be using it on kinect v2 depth image

I tried looking around a bit and this would dedicate too much of my time where I have to work on the other projects where people are paying me. Sorry but I will not be able to be of any further use in this bilateral/guided filter issue.

I have a question regarding the usuage of UV in the gauss custom expression above.
is the UV.x and UV.y always give the same value or will it automatically iterate through all values ?

AFAIK, the GPU will call this material / shader for a given TexCoord (UV) that will be input into this custom node. It will change but only on the GPU as it is making calls in the scene. I think you are wanting to iterate over the entire screen and while you could do that you should consider a much better method as it will run very slowly… but I’m not a shader programmer or technical artist by any means and my knowledge is limited in this area.

The GPU will call a Pixel/Fragment shader(material) for each pixel that is rendered.
The same happens for the Vertex’s.

HTH

I have found a GLSL bilateral filter and tried to implement in in custom expression node.
but it does not seem to work correctly work. can any of you give me a hint ?

#define SIGMA 10.0
#define BSIGMA 0.1
#define MSIZE 10

#define normpdf(x, sigma) 0.39894exp(-0.5xx/(sigmasigma))/sigma
#define normpdf3(v, sigma) 0.39894exp(-0.5dot(v,v)/(sigma*sigma))/sigma

float3 c = Texture2DSample(Material.Texture2D_0,Material.Texture2D_0Sampler, float2(1.0, 1.0)-(UV.xy)).rgb;

const int kSize = (MSIZE-1)/2;
float kernel[MSIZE];
float3 final_colour = float3(0,0,0);

float Z = 0.0;
for (int j = 0; j <= kSize; ++j)
{
kernel[kSize+j] = kernel[kSize-j] = normpdf(float(j), SIGMA);
}

float3 cc;
float factor;
float bZ = 1.0/normpdf(0.0, BSIGMA);
for (int i=-kSize; i <= kSize; ++i)
{
for (int j=-kSize; j <= kSize; ++j)
{
cc = Texture2DSample(Material.Texture2D_0,Material.Texture2D_0Sampler, float2(1.0, 1.0)-(UV.xy+float2(float(i),float(j))) ).rgb;
factor = normpdf3(cc-c, BSIGMA)bZkernel[kSize+j]kernel[kSize+i];
Z += factor;
final_colour += factor
cc;

}

}

return float4(final_colour/Z, 1.0);

Thanks for doing most of the legwork, I did this in between compiling Squad so please do us a favor and please purchase it on Steam, I would appreciate it.

In the following picture you can see the right half is blurry with the filter but the left half is normal.

6b79f056c9bd8ff6609bc354e7f246c98df1df0d.jpeg

Here is the code (remove the if (UV.x < 0.5) check to make it apply to the entire image):


int TexIndex = 14;
float2 invSize = GetPostProcessInputSize(0).zw;
float offsets] = { -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7 };

#define SIGMA 10.0
#define BSIGMA 0.1
#define MSIZE 15

#define normpdf(x, sigma) 0.39894*exp(-0.5*x*x/(sigma*sigma))/sigma
#define normpdf3(v, sigma) 0.39894*exp(-0.5*dot(v,v)/(sigma*sigma))/sigma

const int kSize = (MSIZE-1)/2;
float kernel[MSIZE] = {0.031225216, 0.033322271, 0.035206333, 0.036826804, 0.038138565, 0.039104044, 0.039695028, 0.039894000, 0.039695028, 0.039104044, 0.038138565, 0.036826804, 0.035206333, 0.033322271, 0.031225216};

float3 final_colour = float3(0,0,0);

if (UV.x < 0.5)
{
  return c;
}

float Z = 0.0;
float3 cc;
float factor;
float bZ = 1.0/normpdf(0.0, BSIGMA);
[unroll(15)]
for (int i=-kSize; i <= kSize; ++i)
{
  float v = UV.y + offsets[i+kSize] * invSize.y;
  [unroll(15)]
  for (int j=-kSize; j <= kSize; ++j)
  {
    float u = UV.x + offsets[j+kSize] * invSize.x;
    float2 uvShifted = float2(u, v);
    cc = SceneTextureLookup(uvShifted, TexIndex, false);
    factor = normpdf3(cc-c, BSIGMA)*bZ*kernel[kSize+j]*kernel[kSize+i];
    Z += factor;
    final_colour += factor*cc;
  }
}

return float4(final_colour/Z, 1.0);

Here is my material layout for this image as well (you can actually just copy and paste this and it should work with a Material Domain set to Post Process):


Begin Object Class=MaterialGraphNode_Root Name="MaterialGraphNode_Root_1"
   Begin Object Class=EdGraphPin Name="EdGraphPin_249272"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_249271"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_249270"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_249269"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_249268"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_249267"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_249266"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_249265"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_249264"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_249263"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_249262"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_249261"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_249260"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_249259"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_249258"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_249257"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_249256"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_249255"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_249254"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_249253"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_249252"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_249251"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_249250"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_249249"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_249248"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_249247"
   End Object
   Begin Object Name="EdGraphPin_249272"
      PinName="Material Attributes"
      PinType=(PinCategory="materialinput")
   End Object
   Begin Object Name="EdGraphPin_249271"
      PinName="Pixel Depth Offset"
      PinType=(PinCategory="materialinput")
   End Object
   Begin Object Name="EdGraphPin_249270"
      PinName="Customized UV7"
      PinType=(PinCategory="materialinput")
   End Object
   Begin Object Name="EdGraphPin_249269"
      PinName="Customized UV6"
      PinType=(PinCategory="materialinput")
   End Object
   Begin Object Name="EdGraphPin_249268"
      PinName="Customized UV5"
      PinType=(PinCategory="materialinput")
   End Object
   Begin Object Name="EdGraphPin_249267"
      PinName="Customized UV4"
      PinType=(PinCategory="materialinput")
   End Object
   Begin Object Name="EdGraphPin_249266"
      PinName="Customized UV3"
      PinType=(PinCategory="materialinput")
   End Object
   Begin Object Name="EdGraphPin_249265"
      PinName="Customized UV2"
      PinType=(PinCategory="materialinput")
   End Object
   Begin Object Name="EdGraphPin_249264"
      PinName="Customized UV1"
      PinType=(PinCategory="materialinput")
   End Object
   Begin Object Name="EdGraphPin_249263"
      PinName="Customized UV0"
      PinType=(PinCategory="materialinput")
   End Object
   Begin Object Name="EdGraphPin_249262"
      PinName="Refraction"
      PinType=(PinCategory="materialinput")
   End Object
   Begin Object Name="EdGraphPin_249261"
      PinName="Ambient Occlusion"
      PinType=(PinCategory="materialinput")
   End Object
   Begin Object Name="EdGraphPin_249260"
      PinName="Clear Coat Roughness"
      PinType=(PinCategory="materialinput")
   End Object
   Begin Object Name="EdGraphPin_249259"
      PinName="Clear Coat"
      PinType=(PinCategory="materialinput")
   End Object
   Begin Object Name="EdGraphPin_249258"
      PinName="Subsurface Color"
      PinType=(PinCategory="materialinput")
   End Object
   Begin Object Name="EdGraphPin_249257"
      PinName="Tessellation Multiplier"
      PinType=(PinCategory="materialinput")
   End Object
   Begin Object Name="EdGraphPin_249256"
      PinName="World Displacement"
      PinType=(PinCategory="materialinput")
   End Object
   Begin Object Name="EdGraphPin_249255"
      PinName="World Position Offset"
      PinType=(PinCategory="materialinput")
   End Object
   Begin Object Name="EdGraphPin_249254"
      PinName="Normal"
      PinType=(PinCategory="materialinput")
   End Object
   Begin Object Name="EdGraphPin_249253"
      PinName="Opacity Mask"
      PinType=(PinCategory="materialinput")
   End Object
   Begin Object Name="EdGraphPin_249252"
      PinName="Opacity"
      PinType=(PinCategory="materialinput")
   End Object
   Begin Object Name="EdGraphPin_249251"
      PinName="Emissive Color"
      PinType=(PinCategory="materialinput")
      LinkedTo(0)=EdGraphPin'MaterialGraphNode_10.EdGraphPin_249276'
   End Object
   Begin Object Name="EdGraphPin_249250"
      PinName="Roughness"
      PinType=(PinCategory="materialinput")
   End Object
   Begin Object Name="EdGraphPin_249249"
      PinName="Specular"
      PinType=(PinCategory="materialinput")
   End Object
   Begin Object Name="EdGraphPin_249248"
      PinName="Metallic"
      PinType=(PinCategory="materialinput")
   End Object
   Begin Object Name="EdGraphPin_249247"
      PinName="Base Color"
      PinType=(PinCategory="materialinput")
   End Object
   Material=PreviewMaterial'/Engine/Transient.M_PostProcess_BiLateral'
   Pins(0)=EdGraphPin'EdGraphPin_249247'
   Pins(1)=EdGraphPin'EdGraphPin_249248'
   Pins(2)=EdGraphPin'EdGraphPin_249249'
   Pins(3)=EdGraphPin'EdGraphPin_249250'
   Pins(4)=EdGraphPin'EdGraphPin_249251'
   Pins(5)=EdGraphPin'EdGraphPin_249252'
   Pins(6)=EdGraphPin'EdGraphPin_249253'
   Pins(7)=EdGraphPin'EdGraphPin_249254'
   Pins(8)=EdGraphPin'EdGraphPin_249255'
   Pins(9)=EdGraphPin'EdGraphPin_249256'
   Pins(10)=EdGraphPin'EdGraphPin_249257'
   Pins(11)=EdGraphPin'EdGraphPin_249258'
   Pins(12)=EdGraphPin'EdGraphPin_249259'
   Pins(13)=EdGraphPin'EdGraphPin_249260'
   Pins(14)=EdGraphPin'EdGraphPin_249261'
   Pins(15)=EdGraphPin'EdGraphPin_249262'
   Pins(16)=EdGraphPin'EdGraphPin_249263'
   Pins(17)=EdGraphPin'EdGraphPin_249264'
   Pins(18)=EdGraphPin'EdGraphPin_249265'
   Pins(19)=EdGraphPin'EdGraphPin_249266'
   Pins(20)=EdGraphPin'EdGraphPin_249267'
   Pins(21)=EdGraphPin'EdGraphPin_249268'
   Pins(22)=EdGraphPin'EdGraphPin_249269'
   Pins(23)=EdGraphPin'EdGraphPin_249270'
   Pins(24)=EdGraphPin'EdGraphPin_249271'
   Pins(25)=EdGraphPin'EdGraphPin_249272'
   NodeGuid=4D99DDC344535A733185B684C84B3F66
End Object
Begin Object Class=MaterialGraphNode Name="MaterialGraphNode_10"
   Begin Object Class=EdGraphPin Name="EdGraphPin_249276"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_249275"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_249274"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_249273"
   End Object
   Begin Object Class=MaterialExpressionLinearInterpolate Name="MaterialExpressionLinearInterpolate_0"
   End Object
   Begin Object Name="EdGraphPin_249276"
      PinName="Output"
      PinFriendlyName=" "
      Direction=EGPD_Output
      LinkedTo(0)=EdGraphPin'MaterialGraphNode_Root_1.EdGraphPin_249251'
   End Object
   Begin Object Name="EdGraphPin_249275"
      PinName="Alpha"
      PinType=(PinCategory="optional")
      LinkedTo(0)=EdGraphPin'MaterialGraphNode_16.EdGraphPin_249292'
   End Object
   Begin Object Name="EdGraphPin_249274"
      PinName="B"
      PinType=(PinCategory="optional")
      LinkedTo(0)=EdGraphPin'MaterialGraphNode_12.EdGraphPin_249279'
   End Object
   Begin Object Name="EdGraphPin_249273"
      PinName="A"
      PinType=(PinCategory="optional")
      LinkedTo(0)=EdGraphPin'MaterialGraphNode_20.EdGraphPin_249321'
   End Object
   Begin Object Name="MaterialExpressionLinearInterpolate_0"
      A=(Expression=MaterialExpressionCustom'MaterialGraphNode_20.MaterialExpressionCustom_3')
      B=(Expression=MaterialExpressionSceneTexture'MaterialGraphNode_12.MaterialExpressionSceneTexture_0',Mask=1,MaskR=1,MaskG=1,MaskB=1,MaskA=1)
      Alpha=(Expression=MaterialExpressionMaterialFunctionCall'MaterialGraphNode_16.MaterialExpressionMaterialFunctionCall_1')
      MaterialExpressionEditorX=-176
      MaterialExpressionEditorY=112
      MaterialExpressionGuid=43A9AE0049A776174A0B92B054C6AB5B
      Material=PreviewMaterial'/Engine/Transient.M_PostProcess_BiLateral'
   End Object
   MaterialExpression=MaterialExpressionLinearInterpolate'MaterialExpressionLinearInterpolate_0'
   Pins(0)=EdGraphPin'EdGraphPin_249273'
   Pins(1)=EdGraphPin'EdGraphPin_249274'
   Pins(2)=EdGraphPin'EdGraphPin_249275'
   Pins(3)=EdGraphPin'EdGraphPin_249276'
   NodePosX=-176
   NodePosY=112
   ErrorType=1
   ErrorMsg="Coercion failed: 	MaterialFloat3 Local1 = CustomExpression0(Parameters,Local0);
: float3 -> unknown"
   NodeGuid=8B64A7D348ACB301F8A1AF8FF0696888
End Object
Begin Object Class=MaterialGraphNode Name="MaterialGraphNode_11"
   Begin Object Class=EdGraphPin Name="EdGraphPin_249277"
   End Object
   Begin Object Class=MaterialExpressionScreenPosition Name="MaterialExpressionScreenPosition_0"
   End Object
   Begin Object Name="EdGraphPin_249277"
      PinName="Output"
      PinFriendlyName=" "
      Direction=EGPD_Output
      LinkedTo(0)=EdGraphPin'MaterialGraphNode_12.EdGraphPin_249278'
      LinkedTo(1)=EdGraphPin'MaterialGraphNode_20.EdGraphPin_249319'
   End Object
   Begin Object Name="MaterialExpressionScreenPosition_0"
      MaterialExpressionEditorX=-1024
      MaterialExpressionEditorY=-16
      MaterialExpressionGuid=FE15A11344CA53920E5DD2A0BDB2D846
      Material=PreviewMaterial'/Engine/Transient.M_PostProcess_BiLateral'
   End Object
   MaterialExpression=MaterialExpressionScreenPosition'MaterialExpressionScreenPosition_0'
   Pins(0)=EdGraphPin'EdGraphPin_249277'
   NodePosX=-1024
   NodePosY=-16
   NodeGuid=79E10690463A07CEB3588AA09FA437E5
End Object
Begin Object Class=MaterialGraphNode Name="MaterialGraphNode_12"
   Begin Object Class=EdGraphPin Name="EdGraphPin_249281"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_249280"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_249279"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_249278"
   End Object
   Begin Object Class=MaterialExpressionSceneTexture Name="MaterialExpressionSceneTexture_0"
   End Object
   Begin Object Name="EdGraphPin_249281"
      PinName="InvSize"
      Direction=EGPD_Output
   End Object
   Begin Object Name="EdGraphPin_249280"
      PinName="Size"
      Direction=EGPD_Output
   End Object
   Begin Object Name="EdGraphPin_249279"
      PinName="Color"
      Direction=EGPD_Output
      PinType=(PinCategory="mask")
      LinkedTo(0)=EdGraphPin'MaterialGraphNode_10.EdGraphPin_249274'
      LinkedTo(1)=EdGraphPin'MaterialGraphNode_20.EdGraphPin_249320'
   End Object
   Begin Object Name="EdGraphPin_249278"
      PinName="UVs"
      PinType=(PinCategory="optional")
      LinkedTo(0)=EdGraphPin'MaterialGraphNode_11.EdGraphPin_249277'
   End Object
   Begin Object Name="MaterialExpressionSceneTexture_0"
      Coordinates=(Expression=MaterialExpressionScreenPosition'MaterialGraphNode_11.MaterialExpressionScreenPosition_0')
      SceneTextureId=PPI_PostProcessInput0
      MaterialExpressionEditorX=-768
      MaterialExpressionEditorY=128
      MaterialExpressionGuid=1203879E411BCB45BC5F2DA7A5423DD1
      Material=PreviewMaterial'/Engine/Transient.M_PostProcess_BiLateral'
   End Object
   MaterialExpression=MaterialExpressionSceneTexture'MaterialExpressionSceneTexture_0'
   Pins(0)=EdGraphPin'EdGraphPin_249278'
   Pins(1)=EdGraphPin'EdGraphPin_249279'
   Pins(2)=EdGraphPin'EdGraphPin_249280'
   Pins(3)=EdGraphPin'EdGraphPin_249281'
   NodePosX=-768
   NodePosY=128
   NodeGuid=D155171040284E49BF20138CE0CCA779
End Object
Begin Object Class=MaterialGraphNode Name="MaterialGraphNode_14"
   Begin Object Class=EdGraphPin Name="EdGraphPin_249285"
   End Object
   Begin Object Class=MaterialExpressionScalarParameter Name="MaterialExpressionScalarParameter_0"
   End Object
   Begin Object Name="EdGraphPin_249285"
      PinName="Output"
      PinFriendlyName=" "
      Direction=EGPD_Output
   End Object
   Begin Object Name="MaterialExpressionScalarParameter_0"
      DefaultValue=0.400000
      ParameterName="BlurAmount"
      ExpressionGUID=87FFC26A4E27FD512C77E290396F7DBD
      MaterialExpressionEditorX=-656
      MaterialExpressionEditorY=48
      MaterialExpressionGuid=D865857F4D4247CCA5D256B0E5EE7780
      Material=PreviewMaterial'/Engine/Transient.M_PostProcess_BiLateral'
   End Object
   MaterialExpression=MaterialExpressionScalarParameter'MaterialExpressionScalarParameter_0'
   Pins(0)=EdGraphPin'EdGraphPin_249285'
   NodePosX=-656
   NodePosY=48
   bCanRenameNode=True
   NodeGuid=C8EEBABE40F7D2E47FD061BCA2A32261
End Object
Begin Object Class=MaterialGraphNode Name="MaterialGraphNode_15"
   Begin Object Class=EdGraphPin Name="EdGraphPin_249286"
   End Object
   Begin Object Class=MaterialExpressionMaterialFunctionCall Name="MaterialExpressionMaterialFunctionCall_0"
   End Object
   Begin Object Name="EdGraphPin_249286"
      PinName="Result"
      Direction=EGPD_Output
      LinkedTo(0)=EdGraphPin'MaterialGraphNode_16.EdGraphPin_249287'
   End Object
   Begin Object Name="MaterialExpressionMaterialFunctionCall_0"
      MaterialFunction=MaterialFunction'/Engine/Functions/Engine_MaterialFunctions02/Texturing/ScreenAlignedUVs.ScreenAlignedUVs'
      FunctionOutputs(0)=(ExpressionOutputId=0B62F82A4407238F0BA4FE86805D8B50,Output=(OutputName="Result"))
      MaterialExpressionEditorX=-768
      MaterialExpressionEditorY=272
      MaterialExpressionGuid=98969B6F4B879034F9AD6F8A776EB2CF
      Material=PreviewMaterial'/Engine/Transient.M_PostProcess_BiLateral'
      Outputs(0)=(OutputName="Result")
   End Object
   MaterialExpression=MaterialExpressionMaterialFunctionCall'MaterialExpressionMaterialFunctionCall_0'
   Pins(0)=EdGraphPin'EdGraphPin_249286'
   NodePosX=-768
   NodePosY=272
   NodeGuid=33F85DE247CF887DFCA227A7306D9121
End Object
Begin Object Class=MaterialGraphNode Name="MaterialGraphNode_16"
   Begin Object Class=EdGraphPin Name="EdGraphPin_249292"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_249291"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_249290"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_249289"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_249288"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_249287"
   End Object
   Begin Object Class=MaterialExpressionMaterialFunctionCall Name="MaterialExpressionMaterialFunctionCall_1"
   End Object
   Begin Object Name="EdGraphPin_249292"
      PinName="RadialGradientExponential"
      Direction=EGPD_Output
      LinkedTo(0)=EdGraphPin'MaterialGraphNode_10.EdGraphPin_249275'
   End Object
   Begin Object Name="EdGraphPin_249291"
      PinName="Invert Density (B)"
      PinType=(PinCategory="optional")
   End Object
   Begin Object Name="EdGraphPin_249290"
      PinName="Density (S)"
      PinType=(PinCategory="optional")
      LinkedTo(0)=EdGraphPin'MaterialGraphNode_18.EdGraphPin_249294'
   End Object
   Begin Object Name="EdGraphPin_249289"
      PinName="Radius (S)"
      PinType=(PinCategory="optional")
      LinkedTo(0)=EdGraphPin'MaterialGraphNode_17.EdGraphPin_249293'
   End Object
   Begin Object Name="EdGraphPin_249288"
      PinName="CenterPosition (V2)"
      PinType=(PinCategory="optional")
   End Object
   Begin Object Name="EdGraphPin_249287"
      PinName="UVs (V2)"
      PinType=(PinCategory="optional")
      LinkedTo(0)=EdGraphPin'MaterialGraphNode_15.EdGraphPin_249286'
   End Object
   Begin Object Name="MaterialExpressionMaterialFunctionCall_1"
      MaterialFunction=MaterialFunction'/Engine/Functions/Engine_MaterialFunctions01/Gradient/RadialGradientExponential.RadialGradientExponential'
      FunctionInputs(0)=(ExpressionInputId=D38E6C0F499293F6CC65C0AE55AE0D4E,Input=(Expression=MaterialExpressionMaterialFunctionCall'MaterialGraphNode_15.MaterialExpressionMaterialFunctionCall_0',InputName="UVs"))
      FunctionInputs(1)=(ExpressionInputId=2997555B436C735459B9D695B58F219E,Input=(OutputIndex=-1,InputName="CenterPosition"))
      FunctionInputs(2)=(ExpressionInputId=B330351C4B254660CCDCA5923C8F3F26,Input=(Expression=MaterialExpressionScalarParameter'MaterialGraphNode_17.MaterialExpressionScalarParameter_1',InputName="Radius"))
      FunctionInputs(3)=(ExpressionInputId=2B61E834449DAE3BC4D079B953B5DE0E,Input=(Expression=MaterialExpressionScalarParameter'MaterialGraphNode_18.MaterialExpressionScalarParameter_2',InputName="Density"))
      FunctionInputs(4)=(ExpressionInputId=7D5AC5254448D12A92351AA36BEED90A,Input=(OutputIndex=-1,InputName="Invert Density"))
      FunctionOutputs(0)=(ExpressionOutputId=8D0763534D7AAC86623FB1AE8CD0CC39,Output=(OutputName="RadialGradientExponential"))
      MaterialExpressionEditorX=-528
      MaterialExpressionEditorY=272
      MaterialExpressionGuid=5249FC1140C4BF1C89A75C8FC79CADE0
      Material=PreviewMaterial'/Engine/Transient.M_PostProcess_BiLateral'
      Outputs(0)=(OutputName="RadialGradientExponential")
   End Object
   MaterialExpression=MaterialExpressionMaterialFunctionCall'MaterialExpressionMaterialFunctionCall_1'
   Pins(0)=EdGraphPin'EdGraphPin_249287'
   Pins(1)=EdGraphPin'EdGraphPin_249288'
   Pins(2)=EdGraphPin'EdGraphPin_249289'
   Pins(3)=EdGraphPin'EdGraphPin_249290'
   Pins(4)=EdGraphPin'EdGraphPin_249291'
   Pins(5)=EdGraphPin'EdGraphPin_249292'
   NodePosX=-528
   NodePosY=272
   NodeGuid=DFCECBF04FC08F0CF3767EAE618E13E0
End Object
Begin Object Class=MaterialGraphNode Name="MaterialGraphNode_17"
   Begin Object Class=EdGraphPin Name="EdGraphPin_249293"
   End Object
   Begin Object Class=MaterialExpressionScalarParameter Name="MaterialExpressionScalarParameter_1"
   End Object
   Begin Object Name="EdGraphPin_249293"
      PinName="Output"
      PinFriendlyName=" "
      Direction=EGPD_Output
      LinkedTo(0)=EdGraphPin'MaterialGraphNode_16.EdGraphPin_249289'
   End Object
   Begin Object Name="MaterialExpressionScalarParameter_1"
      DefaultValue=0.600000
      ParameterName="BlurRadius"
      ExpressionGUID=14CEA299455A9BD9DEC4F6AC9C9E3769
      MaterialExpressionEditorX=-768
      MaterialExpressionEditorY=336
      MaterialExpressionGuid=EFEF8E50429ABB12D8E61CBC0E726D50
      Material=PreviewMaterial'/Engine/Transient.M_PostProcess_BiLateral'
   End Object
   MaterialExpression=MaterialExpressionScalarParameter'MaterialExpressionScalarParameter_1'
   Pins(0)=EdGraphPin'EdGraphPin_249293'
   NodePosX=-768
   NodePosY=336
   bCanRenameNode=True
   NodeGuid=00AAE45A49C62C6E85CDC480A6706FF6
End Object
Begin Object Class=MaterialGraphNode Name="MaterialGraphNode_18"
   Begin Object Class=EdGraphPin Name="EdGraphPin_249294"
   End Object
   Begin Object Class=MaterialExpressionScalarParameter Name="MaterialExpressionScalarParameter_2"
   End Object
   Begin Object Name="EdGraphPin_249294"
      PinName="Output"
      PinFriendlyName=" "
      Direction=EGPD_Output
      LinkedTo(0)=EdGraphPin'MaterialGraphNode_16.EdGraphPin_249290'
   End Object
   Begin Object Name="MaterialExpressionScalarParameter_2"
      DefaultValue=2.000000
      ParameterName="RadiusExponent"
      ExpressionGUID=81EB1FEA452017AC4F415CB5DC532E36
      MaterialExpressionEditorX=-768
      MaterialExpressionEditorY=416
      MaterialExpressionGuid=7F1951BE4D6B4D01721363BD02870009
      Material=PreviewMaterial'/Engine/Transient.M_PostProcess_BiLateral'
   End Object
   MaterialExpression=MaterialExpressionScalarParameter'MaterialExpressionScalarParameter_2'
   Pins(0)=EdGraphPin'EdGraphPin_249294'
   NodePosX=-768
   NodePosY=416
   bCanRenameNode=True
   NodeGuid=7B448622491C6E915DE741AFD00C1E36
End Object
Begin Object Class=MaterialGraphNode Name="MaterialGraphNode_20"
   Begin Object Class=EdGraphPin Name="EdGraphPin_249321"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_249320"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_249319"
   End Object
   Begin Object Class=MaterialExpressionCustom Name="MaterialExpressionCustom_3"
   End Object
   Begin Object Name="EdGraphPin_249321"
      PinName="Output"
      PinFriendlyName=" "
      Direction=EGPD_Output
      LinkedTo(0)=EdGraphPin'MaterialGraphNode_10.EdGraphPin_249273'
   End Object
   Begin Object Name="EdGraphPin_249320"
      PinName="c"
      PinType=(PinCategory="required")
      LinkedTo(0)=EdGraphPin'MaterialGraphNode_12.EdGraphPin_249279'
   End Object
   Begin Object Name="EdGraphPin_249319"
      PinName="UV"
      PinType=(PinCategory="required")
      LinkedTo(0)=EdGraphPin'MaterialGraphNode_11.EdGraphPin_249277'
   End Object
   Begin Object Name="MaterialExpressionCustom_3"
      Code="int TexIndex = 14;
float2 invSize = GetPostProcessInputSize(0).zw;
float offsets] = { -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7 };

#define SIGMA 10.0
#define BSIGMA 0.1
#define MSIZE 15

#define normpdf(x, sigma) 0.39894*exp(-0.5*x*x/(sigma*sigma))/sigma
#define normpdf3(v, sigma) 0.39894*exp(-0.5*dot(v,v)/(sigma*sigma))/sigma

const int kSize = (MSIZE-1)/2;
float kernel[MSIZE] = {0.031225216, 0.033322271, 0.035206333, 0.036826804, 0.038138565, 0.039104044, 0.039695028, 0.039894000, 0.039695028, 0.039104044, 0.038138565, 0.036826804, 0.035206333, 0.033322271, 0.031225216};

float3 final_colour = float3(0,0,0);

if (UV.x < 0.5)
{
  return c;
}

float Z = 0.0;
float3 cc;
float factor;
float bZ = 1.0/normpdf(0.0, BSIGMA);
[unroll(15)]
for (int i=-kSize; i <= kSize; ++i)
{
  float v = UV.y + offsets[i+kSize] * invSize.y;
  [unroll(15)]
  for (int j=-kSize; j <= kSize; ++j)
  {
    float u = UV.x + offsets[j+kSize] * invSize.x;
    float2 uvShifted = float2(u, v);
    cc = SceneTextureLookup(uvShifted, TexIndex, false);
    factor = normpdf3(cc-c, BSIGMA)*bZ*kernel[kSize+j]*kernel[kSize+i];
    Z += factor;
    final_colour += factor*cc;
  }
}

return float4(final_colour/Z, 1.0);"
      OutputType=CMOT_Float4
      Description="BiLateral"
      Inputs(0)=(InputName="UV",Input=(Expression=MaterialExpressionScreenPosition'MaterialGraphNode_11.MaterialExpressionScreenPosition_0'))
      Inputs(1)=(InputName="c",Input=(Expression=MaterialExpressionSceneTexture'MaterialGraphNode_12.MaterialExpressionSceneTexture_0',Mask=1,MaskR=1,MaskG=1,MaskB=1,MaskA=1))
      MaterialExpressionEditorX=-480
      MaterialExpressionGuid=348C71E74317394FC9148E9FCD5C21F4
      Material=PreviewMaterial'/Engine/Transient.M_PostProcess_BiLateral'
   End Object
   MaterialExpression=MaterialExpressionCustom'MaterialExpressionCustom_3'
   Pins(0)=EdGraphPin'EdGraphPin_249319'
   Pins(1)=EdGraphPin'EdGraphPin_249320'
   Pins(2)=EdGraphPin'EdGraphPin_249321'
   NodePosX=-480
   ErrorType=1
   ErrorMsg="Custom material BiLateral missing input 2 (sceneTexture)"
   NodeGuid=FF42280C4C01FFA50887B881B036A268
End Object


I should mention that if you hook the output of the custom node directly to the emissive you will get this: dcddf9cf2edf61d85c5d252875571a1fe411a1e4.jpeg

is it possible to do the gaussian blur in a non post-process material ?
I see that the main issue could be GetPostProcessInputSize(0).zw, and SceneTextureLookup
can these two be replaced with a texture size and texture sampler function ?
I have tried it but seems does not work

Just use the bilateral filter custom node in your material in the proper place and change this line:


float2 invSize = GetPostProcessInputSize(0).zw;

to something like this but you will have to figure out what this should be for your given situation:


float2 invSize = float2(0.01, 0.01);

Thanks man, I will surely check it.

PS : how do you replace the sceneTexture to a texturesample to it can be used as well ?

Try this but please notice how expensive it is:

62bf38b0f660eb21d1b99a0587ce33497920fc2d.jpeg



Begin Object Class=MaterialGraphNode_Root Name="MaterialGraphNode_Root_1"
   Begin Object Class=EdGraphPin Name="EdGraphPin_250764"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_250763"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_250762"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_250761"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_250760"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_250759"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_250758"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_250757"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_250756"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_250755"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_250754"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_250753"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_250752"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_250751"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_250750"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_250749"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_250748"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_250747"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_250746"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_250745"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_250744"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_250743"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_250742"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_250741"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_250740"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_250739"
   End Object
   Begin Object Name="EdGraphPin_250764"
      PinName="Material Attributes"
      PinType=(PinCategory="materialinput")
   End Object
   Begin Object Name="EdGraphPin_250763"
      PinName="Pixel Depth Offset"
      PinType=(PinCategory="materialinput")
   End Object
   Begin Object Name="EdGraphPin_250762"
      PinName="Customized UV7"
      PinType=(PinCategory="materialinput")
   End Object
   Begin Object Name="EdGraphPin_250761"
      PinName="Customized UV6"
      PinType=(PinCategory="materialinput")
   End Object
   Begin Object Name="EdGraphPin_250760"
      PinName="Customized UV5"
      PinType=(PinCategory="materialinput")
   End Object
   Begin Object Name="EdGraphPin_250759"
      PinName="Customized UV4"
      PinType=(PinCategory="materialinput")
   End Object
   Begin Object Name="EdGraphPin_250758"
      PinName="Customized UV3"
      PinType=(PinCategory="materialinput")
   End Object
   Begin Object Name="EdGraphPin_250757"
      PinName="Customized UV2"
      PinType=(PinCategory="materialinput")
   End Object
   Begin Object Name="EdGraphPin_250756"
      PinName="Customized UV1"
      PinType=(PinCategory="materialinput")
   End Object
   Begin Object Name="EdGraphPin_250755"
      PinName="Customized UV0"
      PinType=(PinCategory="materialinput")
   End Object
   Begin Object Name="EdGraphPin_250754"
      PinName="Refraction"
      PinType=(PinCategory="materialinput")
   End Object
   Begin Object Name="EdGraphPin_250753"
      PinName="Ambient Occlusion"
      PinType=(PinCategory="materialinput")
   End Object
   Begin Object Name="EdGraphPin_250752"
      PinName="Clear Coat Roughness"
      PinType=(PinCategory="materialinput")
   End Object
   Begin Object Name="EdGraphPin_250751"
      PinName="Clear Coat"
      PinType=(PinCategory="materialinput")
   End Object
   Begin Object Name="EdGraphPin_250750"
      PinName="Subsurface Color"
      PinType=(PinCategory="materialinput")
   End Object
   Begin Object Name="EdGraphPin_250749"
      PinName="Tessellation Multiplier"
      PinType=(PinCategory="materialinput")
   End Object
   Begin Object Name="EdGraphPin_250748"
      PinName="World Displacement"
      PinType=(PinCategory="materialinput")
   End Object
   Begin Object Name="EdGraphPin_250747"
      PinName="World Position Offset"
      PinType=(PinCategory="materialinput")
   End Object
   Begin Object Name="EdGraphPin_250746"
      PinName="Normal"
      PinType=(PinCategory="materialinput")
   End Object
   Begin Object Name="EdGraphPin_250745"
      PinName="Opacity Mask"
      PinType=(PinCategory="materialinput")
   End Object
   Begin Object Name="EdGraphPin_250744"
      PinName="Opacity"
      PinType=(PinCategory="materialinput")
   End Object
   Begin Object Name="EdGraphPin_250743"
      PinName="Emissive Color"
      PinType=(PinCategory="materialinput")
   End Object
   Begin Object Name="EdGraphPin_250742"
      PinName="Roughness"
      PinType=(PinCategory="materialinput")
   End Object
   Begin Object Name="EdGraphPin_250741"
      PinName="Specular"
      PinType=(PinCategory="materialinput")
   End Object
   Begin Object Name="EdGraphPin_250740"
      PinName="Metallic"
      PinType=(PinCategory="materialinput")
   End Object
   Begin Object Name="EdGraphPin_250739"
      PinName="Base Color"
      PinType=(PinCategory="materialinput")
      LinkedTo(0)=EdGraphPin'MaterialGraphNode_9.EdGraphPin_250767'
   End Object
   Material=PreviewMaterial'/Engine/Transient.M_BiLateral'
   Pins(0)=EdGraphPin'EdGraphPin_250739'
   Pins(1)=EdGraphPin'EdGraphPin_250740'
   Pins(2)=EdGraphPin'EdGraphPin_250741'
   Pins(3)=EdGraphPin'EdGraphPin_250742'
   Pins(4)=EdGraphPin'EdGraphPin_250743'
   Pins(5)=EdGraphPin'EdGraphPin_250744'
   Pins(6)=EdGraphPin'EdGraphPin_250745'
   Pins(7)=EdGraphPin'EdGraphPin_250746'
   Pins(8)=EdGraphPin'EdGraphPin_250747'
   Pins(9)=EdGraphPin'EdGraphPin_250748'
   Pins(10)=EdGraphPin'EdGraphPin_250749'
   Pins(11)=EdGraphPin'EdGraphPin_250750'
   Pins(12)=EdGraphPin'EdGraphPin_250751'
   Pins(13)=EdGraphPin'EdGraphPin_250752'
   Pins(14)=EdGraphPin'EdGraphPin_250753'
   Pins(15)=EdGraphPin'EdGraphPin_250754'
   Pins(16)=EdGraphPin'EdGraphPin_250755'
   Pins(17)=EdGraphPin'EdGraphPin_250756'
   Pins(18)=EdGraphPin'EdGraphPin_250757'
   Pins(19)=EdGraphPin'EdGraphPin_250758'
   Pins(20)=EdGraphPin'EdGraphPin_250759'
   Pins(21)=EdGraphPin'EdGraphPin_250760'
   Pins(22)=EdGraphPin'EdGraphPin_250761'
   Pins(23)=EdGraphPin'EdGraphPin_250762'
   Pins(24)=EdGraphPin'EdGraphPin_250763'
   Pins(25)=EdGraphPin'EdGraphPin_250764'
   NodePosX=160
   NodeGuid=D5099884454FBAF2F68BACB27CF992D7
End Object
Begin Object Class=MaterialGraphNode Name="MaterialGraphNode_9"
   Begin Object Class=EdGraphPin Name="EdGraphPin_250767"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_250766"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_250765"
   End Object
   Begin Object Class=MaterialExpressionCustom Name="MaterialExpressionCustom_2"
   End Object
   Begin Object Name="EdGraphPin_250767"
      PinName="Output"
      PinFriendlyName=" "
      Direction=EGPD_Output
      LinkedTo(0)=EdGraphPin'MaterialGraphNode_Root_1.EdGraphPin_250739'
   End Object
   Begin Object Name="EdGraphPin_250766"
      PinName="c"
      PinType=(PinCategory="required")
      LinkedTo(0)=EdGraphPin'MaterialGraphNode_22.EdGraphPin_250813'
   End Object
   Begin Object Name="EdGraphPin_250765"
      PinName="UV"
      PinType=(PinCategory="required")
      LinkedTo(0)=EdGraphPin'MaterialGraphNode_18.EdGraphPin_250787'
   End Object
   Begin Object Name="MaterialExpressionCustom_2"
      Code="int TexIndex = 14;
float2 invSize = float2(0.01, 0.01);
float offsets] = { -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7 };

#define SIGMA 10.0
#define BSIGMA 0.1
#define MSIZE 15

#define normpdf(x, sigma) 0.39894*exp(-0.5*x*x/(sigma*sigma))/sigma
#define normpdf3(v, sigma) 0.39894*exp(-0.5*dot(v,v)/(sigma*sigma))/sigma

const int kSize = (MSIZE-1)/2;
float kernel[MSIZE] = {0.031225216, 0.033322271, 0.035206333, 0.036826804, 0.038138565, 0.039104044, 0.039695028, 0.039894000, 0.039695028, 0.039104044, 0.038138565, 0.036826804, 0.035206333, 0.033322271, 0.031225216};

float3 final_colour = float3(0,0,0);

if (UV.x < 0.5)
{
  return c;
}

float Z = 0.0;
float3 cc;
float factor;
float bZ = 1.0/normpdf(0.0, BSIGMA);
[unroll(15)]
for (int i=-kSize; i <= kSize; ++i)
{
  float v = UV.y + offsets[i+kSize] * invSize.y;
  [unroll(15)]
  for (int j=-kSize; j <= kSize; ++j)
  {
    float u = UV.x + offsets[j+kSize] * invSize.x;
    float2 uvShifted = float2(u, v);
    cc = Texture2DSample(Material.Texture2D_0,Material.Texture2D_0Sampler, uvShifted);
    factor = normpdf3(cc-c, BSIGMA)*bZ*kernel[kSize+j]*kernel[kSize+i];
    Z += factor;
    final_colour += factor*cc;
  }
}

return float4(final_colour/Z, 1.0);"
      OutputType=CMOT_Float4
      Description="BiLateral"
      Inputs(0)=(InputName="UV",Input=(Expression=MaterialExpressionTextureCoordinate'MaterialGraphNode_18.MaterialExpressionTextureCoordinate_3'))
      Inputs(1)=(InputName="c",Input=(Expression=MaterialExpressionMaterialFunctionCall'MaterialGraphNode_22.MaterialExpressionMaterialFunctionCall_11'))
      MaterialExpressionEditorX=-240
      MaterialExpressionGuid=348C71E74317394FC9148E9FCD5C21F4
      Material=PreviewMaterial'/Engine/Transient.M_BiLateral'
   End Object
   MaterialExpression=MaterialExpressionCustom'MaterialExpressionCustom_2'
   Pins(0)=EdGraphPin'EdGraphPin_250765'
   Pins(1)=EdGraphPin'EdGraphPin_250766'
   Pins(2)=EdGraphPin'EdGraphPin_250767'
   NodePosX=-240
   NodeGuid=3D29C0C1474B9B2A35F223AB53EEE8EC
End Object
Begin Object Class=MaterialGraphNode Name="MaterialGraphNode_18"
   Begin Object Class=EdGraphPin Name="EdGraphPin_250787"
   End Object
   Begin Object Class=MaterialExpressionTextureCoordinate Name="MaterialExpressionTextureCoordinate_3"
   End Object
   Begin Object Name="EdGraphPin_250787"
      PinName="Output"
      PinFriendlyName=" "
      Direction=EGPD_Output
      LinkedTo(0)=EdGraphPin'MaterialGraphNode_9.EdGraphPin_250765'
      LinkedTo(1)=EdGraphPin'MaterialGraphNode_19.EdGraphPin_250788'
   End Object
   Begin Object Name="MaterialExpressionTextureCoordinate_3"
      MaterialExpressionEditorX=-864
      MaterialExpressionGuid=6172FC9A428A9D83CE750B8D94084339
      Material=PreviewMaterial'/Engine/Transient.M_BiLateral'
   End Object
   MaterialExpression=MaterialExpressionTextureCoordinate'MaterialExpressionTextureCoordinate_3'
   Pins(0)=EdGraphPin'EdGraphPin_250787'
   NodePosX=-864
   NodeGuid=6F437A7E4771A829627855867A480D45
End Object
Begin Object Class=MaterialGraphNode Name="MaterialGraphNode_19"
   Begin Object Class=EdGraphPin Name="EdGraphPin_250793"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_250792"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_250791"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_250790"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_250789"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_250788"
   End Object
   Begin Object Class=MaterialExpressionTextureSample Name="MaterialExpressionTextureSample_3"
   End Object
   Begin Object Name="EdGraphPin_250793"
      PinName="Output5"
      PinFriendlyName=" "
      Direction=EGPD_Output
      PinType=(PinCategory="mask",PinSubCategory="alpha")
   End Object
   Begin Object Name="EdGraphPin_250792"
      PinName="Output4"
      PinFriendlyName=" "
      Direction=EGPD_Output
      PinType=(PinCategory="mask",PinSubCategory="blue")
      LinkedTo(0)=EdGraphPin'MaterialGraphNode_22.EdGraphPin_250811'
   End Object
   Begin Object Name="EdGraphPin_250791"
      PinName="Output3"
      PinFriendlyName=" "
      Direction=EGPD_Output
      PinType=(PinCategory="mask",PinSubCategory="green")
      LinkedTo(0)=EdGraphPin'MaterialGraphNode_22.EdGraphPin_250810'
   End Object
   Begin Object Name="EdGraphPin_250790"
      PinName="Output2"
      PinFriendlyName=" "
      Direction=EGPD_Output
      PinType=(PinCategory="mask",PinSubCategory="red")
      LinkedTo(0)=EdGraphPin'MaterialGraphNode_22.EdGraphPin_250809'
   End Object
   Begin Object Name="EdGraphPin_250789"
      PinName="Output"
      PinFriendlyName=" "
      Direction=EGPD_Output
      PinType=(PinCategory="mask")
   End Object
   Begin Object Name="EdGraphPin_250788"
      PinName="UVs"
      PinType=(PinCategory="optional")
      LinkedTo(0)=EdGraphPin'MaterialGraphNode_18.EdGraphPin_250787'
   End Object
   Begin Object Name="MaterialExpressionTextureSample_3"
      Coordinates=(Expression=MaterialExpressionTextureCoordinate'MaterialGraphNode_18.MaterialExpressionTextureCoordinate_3')
      Texture=Texture2D'/Game/Textures/T_Rock_Slate_D.T_Rock_Slate_D'
      MaterialExpressionEditorX=-688
      MaterialExpressionEditorY=64
      MaterialExpressionGuid=B48D577F4AA9D639685ACCAFE8F7F7FD
      Material=PreviewMaterial'/Engine/Transient.M_BiLateral'
   End Object
   MaterialExpression=MaterialExpressionTextureSample'MaterialExpressionTextureSample_3'
   Pins(0)=EdGraphPin'EdGraphPin_250788'
   Pins(1)=EdGraphPin'EdGraphPin_250789'
   Pins(2)=EdGraphPin'EdGraphPin_250790'
   Pins(3)=EdGraphPin'EdGraphPin_250791'
   Pins(4)=EdGraphPin'EdGraphPin_250792'
   Pins(5)=EdGraphPin'EdGraphPin_250793'
   NodePosX=-688
   NodePosY=64
   ErrorType=1
   ErrorMsg="TextureSample> Missing input texture"
   NodeGuid=6C21D9D5462A79FD99B1899E27569292
End Object
Begin Object Class=MaterialGraphNode Name="MaterialGraphNode_22"
   Begin Object Class=EdGraphPin Name="EdGraphPin_250813"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_250812"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_250811"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_250810"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_250809"
   End Object
   Begin Object Class=MaterialExpressionMaterialFunctionCall Name="MaterialExpressionMaterialFunctionCall_11"
   End Object
   Begin Object Name="EdGraphPin_250813"
      PinName="Result"
      Direction=EGPD_Output
      LinkedTo(0)=EdGraphPin'MaterialGraphNode_9.EdGraphPin_250766'
   End Object
   Begin Object Name="EdGraphPin_250812"
      PinName="A (S)"
      PinType=(PinCategory="optional")
      LinkedTo(0)=EdGraphPin'MaterialGraphNode_23.EdGraphPin_250814'
   End Object
   Begin Object Name="EdGraphPin_250811"
      PinName="Z (S)"
      PinType=(PinCategory="optional")
      LinkedTo(0)=EdGraphPin'MaterialGraphNode_19.EdGraphPin_250792'
   End Object
   Begin Object Name="EdGraphPin_250810"
      PinName="Y (S)"
      PinType=(PinCategory="optional")
      LinkedTo(0)=EdGraphPin'MaterialGraphNode_19.EdGraphPin_250791'
   End Object
   Begin Object Name="EdGraphPin_250809"
      PinName="X (S)"
      PinType=(PinCategory="optional")
      LinkedTo(0)=EdGraphPin'MaterialGraphNode_19.EdGraphPin_250790'
   End Object
   Begin Object Name="MaterialExpressionMaterialFunctionCall_11"
      MaterialFunction=MaterialFunction'/Engine/Functions/Engine_MaterialFunctions02/Utility/MakeFloat4.MakeFloat4'
      FunctionInputs(0)=(ExpressionInputId=529C1D96441E07EB03A9E59B8A7F67B6,Input=(Expression=MaterialExpressionTextureSample'MaterialGraphNode_19.MaterialExpressionTextureSample_3',OutputIndex=1,InputName="X",Mask=1,MaskR=1))
      FunctionInputs(1)=(ExpressionInputId=B5BD7D1B494F6928732CCDA1C63D8E15,Input=(Expression=MaterialExpressionTextureSample'MaterialGraphNode_19.MaterialExpressionTextureSample_3',OutputIndex=2,InputName="Y",Mask=1,MaskG=1))
      FunctionInputs(2)=(ExpressionInputId=050F17B8471570B47A802CB7CAA5A201,Input=(Expression=MaterialExpressionTextureSample'MaterialGraphNode_19.MaterialExpressionTextureSample_3',OutputIndex=3,InputName="Z",Mask=1,MaskB=1))
      FunctionInputs(3)=(ExpressionInputId=4302C68A4D3ABCFB34DE619C2867A488,Input=(Expression=MaterialExpressionConstant'MaterialGraphNode_23.MaterialExpressionConstant_3',InputName="A"))
      FunctionOutputs(0)=(ExpressionOutputId=0DD6F9954C067C3E5DDBBBA0D6910DD2,Output=(OutputName="Result"))
      MaterialExpressionEditorX=-432
      MaterialExpressionEditorY=64
      MaterialExpressionGuid=F2B77D1545EDF03F3554DD86E9FDABB6
      Material=PreviewMaterial'/Engine/Transient.M_BiLateral'
      Outputs(0)=(OutputName="Result")
   End Object
   MaterialExpression=MaterialExpressionMaterialFunctionCall'MaterialExpressionMaterialFunctionCall_11'
   Pins(0)=EdGraphPin'EdGraphPin_250809'
   Pins(1)=EdGraphPin'EdGraphPin_250810'
   Pins(2)=EdGraphPin'EdGraphPin_250811'
   Pins(3)=EdGraphPin'EdGraphPin_250812'
   Pins(4)=EdGraphPin'EdGraphPin_250813'
   NodePosX=-432
   NodePosY=64
   NodeGuid=6D3E096342EBF6738C9639A52BE3DFCD
End Object
Begin Object Class=MaterialGraphNode Name="MaterialGraphNode_23"
   Begin Object Class=EdGraphPin Name="EdGraphPin_250814"
   End Object
   Begin Object Class=MaterialExpressionConstant Name="MaterialExpressionConstant_3"
   End Object
   Begin Object Name="EdGraphPin_250814"
      PinName="Output"
      PinFriendlyName=" "
      Direction=EGPD_Output
      LinkedTo(0)=EdGraphPin'MaterialGraphNode_22.EdGraphPin_250812'
   End Object
   Begin Object Name="MaterialExpressionConstant_3"
      R=1.000000
      MaterialExpressionEditorX=-499
      MaterialExpressionEditorY=181
      MaterialExpressionGuid=E6188E384CEF5DC86A18F191881DCAF5
      Material=PreviewMaterial'/Engine/Transient.M_BiLateral'
   End Object
   MaterialExpression=MaterialExpressionConstant'MaterialExpressionConstant_3'
   Pins(0)=EdGraphPin'EdGraphPin_250814'
   NodePosX=-499
   NodePosY=181
   NodeGuid=BC8B17A04C3A2C5ADFAB99B3D03F5BC4
End Object