Download

Sharper image without the edge artifacts

I decided to see if I could get somewhat the same effect as my post process TAA Sharpen code with a Post Process Material.
I’m quite pleased with the result, so here is the code. Should work regardless of UE4 version. :slight_smile:

What it does (Zoom in to see the details)

How to use

  • Create a new material
  • Set Material Domain to Post Process, and Blendable Location to Before Translucency.
  • Paste the code below and link the output to Emissive Color.
  • Add the material to your Post Process Materials under Rendering Features.
  • Adjust **SharpenWeight **in the material to desired strength. Default is 0.5
  • Adjust **DistanceFadeOff **in the material to desired fade off. Default is 5000 (50 meters).

Begin Object Class=/Script/UnrealEd.MaterialGraphNode_Root Name="MaterialGraphNode_Root_0"
   Material=PreviewMaterial'"/Engine/Transient.M_Sharpen"'
   NodePosX=512
   NodePosY=-384
   NodeGuid=2C1D5A8142D963D33A3480942FB9C6A8
   CustomProperties Pin (PinId=AE27B9AC43466833BA812EB9D92A3F8E,PinName="Base Color",PinType.PinCategory="materialinput",PinType.PinSubCategory="5",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=E9B3F48A4DADAF957E1819BF00226854,PinName="Metallic",PinType.PinCategory="materialinput",PinType.PinSubCategory="6",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=6D883031425ACB5842CCA7BF563FA7DD,PinName="Specular",PinType.PinCategory="materialinput",PinType.PinSubCategory="7",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=1A0BBA3D4C8BBDF26A1365BA4AF7F918,PinName="Roughness",PinType.PinCategory="materialinput",PinType.PinSubCategory="8",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=06D8EA764F834D36938510B71A6AB152,PinName="Emissive Color",PinType.PinCategory="materialinput",PinType.PinSubCategory="0",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_0 8B6E8C834B57797AB8F68AB2B2211CC5,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=55A3579B410C63D0EEA92985A4B229CB,PinName="Opacity",PinType.PinCategory="materialinput",PinType.PinSubCategory="1",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=255056D64ECC496FCE796BB53AAC8F3F,PinName="Opacity Mask",PinType.PinCategory="materialinput",PinType.PinSubCategory="2",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=DE354C584A28C0FE0840A9A50CDFE46C,PinName="Normal",PinType.PinCategory="materialinput",PinType.PinSubCategory="9",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=76C3D94F434CC3E02A432CAB89A939DE,PinName="World Position Offset",PinType.PinCategory="materialinput",PinType.PinSubCategory="10",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=BBA7C5A5498BE2DAA57257B06F6AC279,PinName="World Displacement",PinType.PinCategory="materialinput",PinType.PinSubCategory="11",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=D7D655F04E5B1143F6435B8029336637,PinName="Tessellation Multiplier",PinType.PinCategory="materialinput",PinType.PinSubCategory="12",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=4936738548A692E142D983B3BEC9F89A,PinName="Subsurface Color",PinType.PinCategory="materialinput",PinType.PinSubCategory="13",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=2A630EA44C32A56CD9BE35993EC0B1E4,PinName="Custom Data 0",PinType.PinCategory="materialinput",PinType.PinSubCategory="14",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=973F9A4347D82AECAD9C38BC0B181A22,PinName="Custom Data 1",PinType.PinCategory="materialinput",PinType.PinSubCategory="15",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=E8F8B793451AF59125C00B8CDDA1CEFE,PinName="Ambient Occlusion",PinType.PinCategory="materialinput",PinType.PinSubCategory="16",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=C88F28C4412E0CA05CC0C98F67CA2983,PinName="Refraction",PinType.PinCategory="materialinput",PinType.PinSubCategory="17",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=6453A69447C3B82C9DA052AEEF0C55CE,PinName="Customized UV0",PinType.PinCategory="materialinput",PinType.PinSubCategory="18",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=1E4C24E64CB186187520AFB6EB76AA10,PinName="Customized UV1",PinType.PinCategory="materialinput",PinType.PinSubCategory="19",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=BC4F170941AB17A0E87D60B06C777566,PinName="Customized UV2",PinType.PinCategory="materialinput",PinType.PinSubCategory="20",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=9B68F0734FC17A9FC568EEA52F82D728,PinName="Customized UV3",PinType.PinCategory="materialinput",PinType.PinSubCategory="21",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=AE5211E040A42F358F200E89077C19CF,PinName="Customized UV4",PinType.PinCategory="materialinput",PinType.PinSubCategory="22",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=1B53F9F344AF61258A0398900A2843AD,PinName="Customized UV5",PinType.PinCategory="materialinput",PinType.PinSubCategory="23",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=936AEBDC4857E466F3CB31AE9EFD06FE,PinName="Customized UV6",PinType.PinCategory="materialinput",PinType.PinSubCategory="24",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=E6945447465184E48164F19549FB0D66,PinName="Customized UV7",PinType.PinCategory="materialinput",PinType.PinSubCategory="25",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=1A5BF8A245B0C3DA7D4B0B89C44A7F97,PinName="Pixel Depth Offset",PinType.PinCategory="materialinput",PinType.PinSubCategory="26",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=8ABD3859442795BED6C4CD986EEC2D28,PinName="Material Attributes",PinType.PinCategory="materialinput",PinType.PinSubCategory="27",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
End Object
Begin Object Class=/Script/UnrealEd.MaterialGraphNode Name="MaterialGraphNode_0"
   Begin Object Class=/Script/Engine.MaterialExpressionCustom Name="MaterialExpressionCustom_0"
   End Object
   Begin Object Name="MaterialExpressionCustom_0"
      Code="float3 CenterColor =  Color;

half3 C1 = SceneTextureLookup(UV + float2(-1, 0) * TexelScale, 0, false).rgb;
half3 C2 = SceneTextureLookup(UV + float2(0, -1) * TexelScale, 0, false).rgb;
half3 C3 = SceneTextureLookup(UV + float2(1, 0) * TexelScale, 0, false).rgb;
half3 C4 = SceneTextureLookup(UV + float2(0, 1) * TexelScale, 0, false).rgb;

half A0 = Luminance(CenterColor);
half4 LuminanceNeightbors = half4(Luminance(C1), Luminance(C2), Luminance(C3), Luminance(C4));
float4 A0LuminanceNeightbors = abs(A0 - LuminanceNeightbors);
half HDREdge = max(max(A0LuminanceNeightbors.r, A0LuminanceNeightbors.g), max(A0LuminanceNeightbors.b, A0LuminanceNeightbors.a));
half EdgeMask = saturate(1.0f - HDREdge);
float LerpFactor = -EdgeMask * SharpenWeight;
half3 DeltaColor = (C1 + C2 + C3 + C4) - CenterColor * 4;
CenterColor.rgb += DeltaColor * LerpFactor;

return CenterColor.rgb;"
      Description="Sharpen"
      Inputs(0)=(InputName="UV",Input=(Expression=MaterialExpressionCustom'"MaterialGraphNode_4.MaterialExpressionCustom_3"'))
      Inputs(1)=(InputName="Color",Input=(Expression=MaterialExpressionSceneTexture'"MaterialGraphNode_2.MaterialExpressionSceneTexture_0"',Mask=1,MaskR=1,MaskG=1,MaskB=1,MaskA=1))
      Inputs(2)=(InputName="TexelScale",Input=(Expression=MaterialExpressionCustom'"MaterialGraphNode_10.MaterialExpressionCustom_17"'))
      Inputs(3)=(InputName="SharpenWeight",Input=(Expression=MaterialExpressionMultiply'"MaterialGraphNode_15.MaterialExpressionMultiply_2"'))
      MaterialExpressionEditorX=256
      MaterialExpressionEditorY=-384
      MaterialExpressionGuid=210EEB4F41C620C4310A67981D9E4E41
      Material=PreviewMaterial'"/Engine/Transient.M_Sharpen"'
   End Object
   MaterialExpression=MaterialExpressionCustom'"MaterialExpressionCustom_0"'
   NodePosX=256
   NodePosY=-384
   ErrorType=1
   ErrorMsg="Custom material Sharpen missing input 4 (SharpenWeight)"
   NodeGuid=451FBBBE4BF078DD2FC07E8A47EE7E06
   CustomProperties Pin (PinId=0ED8D9EE4CFBF0FF9EC919AF8F53574A,PinName="UV",PinType.PinCategory="required",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_4 D5EA8BC84EF2FFC272A3A482723F6643,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=24F15B9A441D8BDFD2A7BFB0051DF98A,PinName="Color",PinType.PinCategory="required",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_2 123D3B3B40D8727C5EC37A88F087A5BF,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=88ACE3C54B852D16F9A1559353353142,PinName="TexelScale",PinType.PinCategory="required",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_10 D7A2D63E4EF471D213740DAD687515BC,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=32DB99F441D3E046BB927FAE33242711,PinName="SharpenWeight",PinType.PinCategory="required",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_15 3ACF13D6487AB908CDA74B857C288266,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=8B6E8C834B57797AB8F68AB2B2211CC5,PinName="Output",PinFriendlyName=" ",Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_Root_0 06D8EA764F834D36938510B71A6AB152,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
End Object
Begin Object Class=/Script/UnrealEd.MaterialGraphNode Name="MaterialGraphNode_1"
   Begin Object Class=/Script/Engine.MaterialExpressionMultiply Name="MaterialExpressionMultiply_1"
   End Object
   Begin Object Name="MaterialExpressionMultiply_1"
      A=(Expression=MaterialExpressionMultiply'"MaterialGraphNode_7.MaterialExpressionMultiply_0"')
      B=(Expression=MaterialExpressionScalarParameter'"MaterialGraphNode_8.MaterialExpressionScalarParameter_3"')
      MaterialExpressionEditorX=-224
      MaterialExpressionEditorY=-256
      MaterialExpressionGuid=496ED3774D80B9675B16C184580C9CE5
      Material=PreviewMaterial'"/Engine/Transient.M_Sharpen"'
   End Object
   MaterialExpression=MaterialExpressionMultiply'"MaterialExpressionMultiply_1"'
   NodePosX=-224
   NodePosY=-256
   NodeGuid=5B58FCCB4B125B3C0A0341B8CAD9CE5A
   CustomProperties Pin (PinId=F3A37045489DB5AB4CA43983F6E99EC6,PinName="A",PinType.PinCategory="optional",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_7 7C5B154C44AEB8A9599E2BA79F830E22,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=5ED8501E43F8E1DEB97D4E8D6A9140DD,PinName="B",PinType.PinCategory="optional",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_8 8A9E5D274A8592255473BC878CBCEAD2,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=3A87A9AC45281993C761B8ADD8D461AC,PinName="Output",PinFriendlyName=" ",Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_15 60398C164E2F92146661DF8E6CB24D0C,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
End Object
Begin Object Class=/Script/UnrealEd.MaterialGraphNode Name="MaterialGraphNode_2"
   Begin Object Class=/Script/Engine.MaterialExpressionSceneTexture Name="MaterialExpressionSceneTexture_0"
   End Object
   Begin Object Name="MaterialExpressionSceneTexture_0"
      SceneTextureId=PPI_PostProcessInput0
      MaterialExpressionEditorX=-1314
      MaterialExpressionEditorY=-38
      MaterialExpressionGuid=2683E4664DE80A68DDCABEBA11B373AD
      Material=PreviewMaterial'"/Engine/Transient.M_Sharpen"'
   End Object
   MaterialExpression=MaterialExpressionSceneTexture'"MaterialExpressionSceneTexture_0"'
   NodePosX=-1314
   NodePosY=-38
   NodeGuid=4759F8554C21E3CD571FE5AA5ECF85AC
   CustomProperties Pin (PinId=4F9A2D054043514D1C57949DB86EDAB5,PinName="UVs",PinType.PinCategory="optional",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=123D3B3B40D8727C5EC37A88F087A5BF,PinName="Color",Direction="EGPD_Output",PinType.PinCategory="mask",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_0 24F15B9A441D8BDFD2A7BFB0051DF98A,MaterialGraphNode_6 16C8FD894D0AC54AF78D12A3A2B996A1,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=139EA53A43DDC98C164C51B8F66E59E1,PinName="Size",Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=A248B6FC4E6F7D310FB2D0AC8970CC5B,PinName="InvSize",Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
End Object
Begin Object Class=/Script/UnrealEd.MaterialGraphNode Name="MaterialGraphNode_3"
   Begin Object Class=/Script/Engine.MaterialExpressionSceneTexture Name="MaterialExpressionSceneTexture_1"
   End Object
   Begin Object Name="MaterialExpressionSceneTexture_1"
      SceneTextureId=PPI_SceneDepth
      MaterialExpressionEditorX=-1314
      MaterialExpressionEditorY=-198
      MaterialExpressionGuid=2683E4664DE80A68DDCABEBA11B373AD
      Material=PreviewMaterial'"/Engine/Transient.M_Sharpen"'
   End Object
   MaterialExpression=MaterialExpressionSceneTexture'"MaterialExpressionSceneTexture_1"'
   NodePosX=-1314
   NodePosY=-198
   NodeGuid=35E86F0A48C1DB8E855647B4C4473B77
   CustomProperties Pin (PinId=3B74BAEC4EBCB21C2A8467BE688A9750,PinName="UVs",PinType.PinCategory="optional",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=FF1B4A6C44A415545E09F1B1B099B4E3,PinName="Color",Direction="EGPD_Output",PinType.PinCategory="mask",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_5 C2EA01D44D829A80AA1EBEB5F42ACA85,MaterialGraphNode_11 14B429C046A073AEE665EFB258A84CF7,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=EF94301145B48DC2F2BF96AA111FB41D,PinName="Size",Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=4A20C08E424C13F3DC1E8F861F735025,PinName="InvSize",Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
End Object
Begin Object Class=/Script/UnrealEd.MaterialGraphNode Name="MaterialGraphNode_4"
   Begin Object Class=/Script/Engine.MaterialExpressionCustom Name="MaterialExpressionCustom_3"
   End Object
   Begin Object Name="MaterialExpressionCustom_3"
      Code="return GetSceneTextureUV(Parameters);"
      OutputType=CMOT_Float2
      Description="SceneUV"
      Inputs=
      MaterialExpressionEditorX=-1314
      MaterialExpressionEditorY=-406
      MaterialExpressionGuid=1DBC64204F255784608569B4A9C11C32
      Material=PreviewMaterial'"/Engine/Transient.M_Sharpen"'
      bCollapsed=True
   End Object
   MaterialExpression=MaterialExpressionCustom'"MaterialExpressionCustom_3"'
   NodePosX=-1314
   NodePosY=-406
   NodeGuid=9507F1CF4C50F2E66F794EB5C7D48DD1
   CustomProperties Pin (PinId=D5EA8BC84EF2FFC272A3A482723F6643,PinName="Output",PinFriendlyName=" ",Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_0 0ED8D9EE4CFBF0FF9EC919AF8F53574A,MaterialGraphNode_5 71911F504C7239709127939D156B40AA,MaterialGraphNode_6 562AFAAE4BBFF308A3A687B1FD03EE9C,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
End Object
Begin Object Class=/Script/UnrealEd.MaterialGraphNode Name="MaterialGraphNode_5"
   Begin Object Class=/Script/Engine.MaterialExpressionCustom Name="MaterialExpressionCustom_4"
   End Object
   Begin Object Name="MaterialExpressionCustom_4"
      Code="half CenterDepth = Depth;

half D1 = abs(CenterDepth - SceneTextureLookup(UV + float2(-1, 0) * TexelScale, 1, false).r);
half D2 = abs(CenterDepth - SceneTextureLookup(UV + float2(0, -1) * TexelScale, 1, false).r);
half D3 = abs(CenterDepth - SceneTextureLookup(UV + float2(1, 0) * TexelScale, 1, false).r);
half D4 = abs(CenterDepth - SceneTextureLookup(UV + float2(0, 1) * TexelScale, 1, false).r);

half D5 = abs(CenterDepth - SceneTextureLookup(UV + float2(-2, 0) * TexelScale, 1, false).r);
half D6 = abs(CenterDepth - SceneTextureLookup(UV + float2(0, -2) * TexelScale, 1, false).r);
half D7 = abs(CenterDepth - SceneTextureLookup(UV + float2(2, 0) * TexelScale, 1, false).r);
half D8 = abs(CenterDepth - SceneTextureLookup(UV + float2(0, 2) * TexelScale, 1, false).r);

half D9 = abs(CenterDepth - SceneTextureLookup(UV + float2(-3, 0) * TexelScale, 1, false).r);
half D10 = abs(CenterDepth - SceneTextureLookup(UV + float2(0, -3) * TexelScale, 1, false).r);
half D11 = abs(CenterDepth - SceneTextureLookup(UV + float2(3, 0) * TexelScale, 1, false).r);
half D12 = abs(CenterDepth - SceneTextureLookup(UV + float2(0, 3) * TexelScale, 1, false).r);

half MaxDepthDifference = max(CenterDepth, 150) / 150;
half SceneNeighborDepth0 = saturate(max(max(D1, D2), max(D3, D4)) / MaxDepthDifference);
half SceneNeighborDepth1 = saturate(max(max(D5, D6), max(D7, D8)) / (MaxDepthDifference * 2));
half SceneNeighborDepth2 = saturate(max(max(D9, D10), max(D11, D12)) / (MaxDepthDifference * 3)) / 2;
half SceneNeighborDepth = max(max(SceneNeighborDepth0, SceneNeighborDepth1), SceneNeighborDepth2);
return saturate(1 - saturate(SceneNeighborDepth));"
      OutputType=CMOT_Float1
      Description="Depth"
      Inputs(0)=(InputName="UV",Input=(Expression=MaterialExpressionCustom'"MaterialGraphNode_4.MaterialExpressionCustom_3"'))
      Inputs(1)=(InputName="TexelScale",Input=(Expression=MaterialExpressionCustom'"MaterialGraphNode_10.MaterialExpressionCustom_17"'))
      Inputs(2)=(InputName="Depth",Input=(Expression=MaterialExpressionSceneTexture'"MaterialGraphNode_3.MaterialExpressionSceneTexture_1"',Mask=1,MaskR=1,MaskG=1,MaskB=1,MaskA=1))
      MaterialExpressionEditorX=-816
      MaterialExpressionEditorY=-384
      MaterialExpressionGuid=EE6165774BB2AA315508A28D434EE6B4
      Material=PreviewMaterial'"/Engine/Transient.M_Sharpen"'
   End Object
   MaterialExpression=MaterialExpressionCustom'"MaterialExpressionCustom_4"'
   NodePosX=-816
   NodePosY=-384
   NodeGuid=059C0150403EC778F4195DAC325BC772
   CustomProperties Pin (PinId=71911F504C7239709127939D156B40AA,PinName="UV",PinType.PinCategory="required",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_4 D5EA8BC84EF2FFC272A3A482723F6643,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=0A8347104CABDFA9F60223A1F4E8AF5F,PinName="TexelScale",PinType.PinCategory="required",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_10 D7A2D63E4EF471D213740DAD687515BC,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=C2EA01D44D829A80AA1EBEB5F42ACA85,PinName="Depth",PinType.PinCategory="required",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_3 FF1B4A6C44A415545E09F1B1B099B4E3,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=308ECEA943236EBA0AAC01B6EEC58C46,PinName="Output",PinFriendlyName=" ",Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_7 8519AD004011275858022681756DECD4,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
End Object
Begin Object Class=/Script/UnrealEd.MaterialGraphNode Name="MaterialGraphNode_6"
   Begin Object Class=/Script/Engine.MaterialExpressionCustom Name="MaterialExpressionCustom_5"
   End Object
   Begin Object Name="MaterialExpressionCustom_5"
      Code="float3 CenterColor =  Color;

half3 C1 = SceneTextureLookup(UV + float2(-1, 0) * TexelScale, 0, false).rgb;
half3 C2 = SceneTextureLookup(UV + float2(0, -1) * TexelScale, 0, false).rgb;
half3 C3 = SceneTextureLookup(UV + float2(1, 0) * TexelScale, 0, false).rgb;
half3 C4 = SceneTextureLookup(UV + float2(0, 1) * TexelScale, 0, false).rgb;

float c1 = Luminance(C1);
float c2 = Luminance(CenterColor);
float l1 = max(c1, c2);
float l2 = min(c1, c2);
half L1 = ((l1 + 0.05) / (l2 + 0.05) - 1) / 20;

c1 = Luminance(C2);
l1 = max(c1, c2);
l2 = min(c1, c2);
half L2 = ((l1 + 0.05) / (l2 + 0.05) - 1) / 20;

c1 = Luminance(C3);
l1 = max(c1, c2);
l2 = min(c1, c2);
half L3 = ((l1 + 0.05) / (l2 + 0.05) - 1) / 20;

c1 = Luminance(C4);
l1 = max(c1, c2);
l2 = min(c1, c2);
half L4 = ((l1 + 0.05) / (l2 + 0.05) - 1) / 20;

half NeighborDifference = max(max(L1, L2), max(L3, L4));
return saturate(1 - NeighborDifference);"
      OutputType=CMOT_Float1
      Description="Luminance"
      Inputs(0)=(InputName="UV",Input=(Expression=MaterialExpressionCustom'"MaterialGraphNode_4.MaterialExpressionCustom_3"'))
      Inputs(1)=(InputName="TexelScale",Input=(Expression=MaterialExpressionCustom'"MaterialGraphNode_10.MaterialExpressionCustom_17"'))
      Inputs(2)=(InputName="Color",Input=(Expression=MaterialExpressionSceneTexture'"MaterialGraphNode_2.MaterialExpressionSceneTexture_0"',Mask=1,MaskR=1,MaskG=1,MaskB=1,MaskA=1))
      MaterialExpressionEditorX=-818
      MaterialExpressionEditorY=-182
      MaterialExpressionGuid=EE6165774BB2AA315508A28D434EE6B4
      Material=PreviewMaterial'"/Engine/Transient.M_Sharpen"'
   End Object
   MaterialExpression=MaterialExpressionCustom'"MaterialExpressionCustom_5"'
   NodePosX=-818
   NodePosY=-182
   NodeGuid=9B48C498462591F243976EAD7A616C38
   CustomProperties Pin (PinId=562AFAAE4BBFF308A3A687B1FD03EE9C,PinName="UV",PinType.PinCategory="required",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_4 D5EA8BC84EF2FFC272A3A482723F6643,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=7F331D9B4EB86E93CF133184554B13D5,PinName="TexelScale",PinType.PinCategory="required",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_10 D7A2D63E4EF471D213740DAD687515BC,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=16C8FD894D0AC54AF78D12A3A2B996A1,PinName="Color",PinType.PinCategory="required",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_2 123D3B3B40D8727C5EC37A88F087A5BF,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=C0EF3DFF476D3EB1F23273B3AE624B69,PinName="Output",PinFriendlyName=" ",Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_7 987389FD4E4F79FAE891C7ADEBBCB435,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
End Object
Begin Object Class=/Script/UnrealEd.MaterialGraphNode Name="MaterialGraphNode_7"
   Begin Object Class=/Script/Engine.MaterialExpressionMultiply Name="MaterialExpressionMultiply_0"
   End Object
   Begin Object Name="MaterialExpressionMultiply_0"
      A=(Expression=MaterialExpressionCustom'"MaterialGraphNode_5.MaterialExpressionCustom_4"')
      B=(Expression=MaterialExpressionCustom'"MaterialGraphNode_6.MaterialExpressionCustom_5"')
      MaterialExpressionEditorX=-480
      MaterialExpressionEditorY=-256
      MaterialExpressionGuid=11F9E406498F65354096FE8D4F3A0217
      Material=PreviewMaterial'"/Engine/Transient.M_Sharpen"'
   End Object
   MaterialExpression=MaterialExpressionMultiply'"MaterialExpressionMultiply_0"'
   NodePosX=-480
   NodePosY=-256
   NodeGuid=7C02E19043C29E1015156684F2517E57
   CustomProperties Pin (PinId=8519AD004011275858022681756DECD4,PinName="A",PinType.PinCategory="optional",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_5 308ECEA943236EBA0AAC01B6EEC58C46,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=987389FD4E4F79FAE891C7ADEBBCB435,PinName="B",PinType.PinCategory="optional",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_6 C0EF3DFF476D3EB1F23273B3AE624B69,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=7C5B154C44AEB8A9599E2BA79F830E22,PinName="Output",PinFriendlyName=" ",Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_1 F3A37045489DB5AB4CA43983F6E99EC6,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
End Object
Begin Object Class=/Script/UnrealEd.MaterialGraphNode Name="MaterialGraphNode_8"
   Begin Object Class=/Script/Engine.MaterialExpressionScalarParameter Name="MaterialExpressionScalarParameter_3"
   End Object
   Begin Object Name="MaterialExpressionScalarParameter_3"
      DefaultValue=0.500000
      ParameterName="SharpenWeight"
      ExpressionGUID=0FB7810242017410F04D8893B5E926B9
      MaterialExpressionEditorX=-432
      MaterialExpressionEditorY=-128
      MaterialExpressionGuid=19D9205140F703E91D51EAADB938BD72
      Material=PreviewMaterial'"/Engine/Transient.M_Sharpen"'
   End Object
   MaterialExpression=MaterialExpressionScalarParameter'"MaterialExpressionScalarParameter_3"'
   NodePosX=-432
   NodePosY=-128
   bCanRenameNode=True
   NodeGuid=CF7A0B06425C167E080D4CB60A73F0D7
   CustomProperties Pin (PinId=8A9E5D274A8592255473BC878CBCEAD2,PinName="Output",PinFriendlyName=" ",Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_1 5ED8501E43F8E1DEB97D4E8D6A9140DD,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
End Object
Begin Object Class=/Script/UnrealEd.MaterialGraphNode Name="MaterialGraphNode_10"
   Begin Object Class=/Script/Engine.MaterialExpressionCustom Name="MaterialExpressionCustom_17"
   End Object
   Begin Object Name="MaterialExpressionCustom_17"
      Code="return View.BufferSizeAndInvSize.zw;"
      OutputType=CMOT_Float2
      Description="BufferTexelSize"
      Inputs=
      MaterialExpressionEditorX=-1312
      MaterialExpressionEditorY=-304
      MaterialExpressionGuid=99D774D54CC0E5C8D02B37991F61BC9E
      Material=PreviewMaterial'"/Engine/Transient.M_Sharpen"'
      bCollapsed=True
   End Object
   MaterialExpression=MaterialExpressionCustom'"MaterialExpressionCustom_17"'
   NodePosX=-1312
   NodePosY=-304
   NodeGuid=78A22D324AAE06AD66D682967597008C
   CustomProperties Pin (PinId=D7A2D63E4EF471D213740DAD687515BC,PinName="Output",PinFriendlyName=" ",Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_0 88ACE3C54B852D16F9A1559353353142,MaterialGraphNode_5 0A8347104CABDFA9F60223A1F4E8AF5F,MaterialGraphNode_6 7F331D9B4EB86E93CF133184554B13D5,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
End Object
Begin Object Class=/Script/UnrealEd.MaterialGraphNode Name="MaterialGraphNode_11"
   Begin Object Class=/Script/Engine.MaterialExpressionDivide Name="MaterialExpressionDivide_0"
   End Object
   Begin Object Name="MaterialExpressionDivide_0"
      A=(Expression=MaterialExpressionSceneTexture'"MaterialGraphNode_3.MaterialExpressionSceneTexture_1"',Mask=1,MaskR=1,MaskG=1,MaskB=1,MaskA=1)
      B=(Expression=MaterialExpressionScalarParameter'"MaterialGraphNode_18.MaterialExpressionScalarParameter_0"')
      ConstB=5000.000000
      MaterialExpressionEditorX=-432
      MaterialExpressionGuid=C37E3BF445B02C5974D57EA3772DA61B
      Material=PreviewMaterial'"/Engine/Transient.M_Sharpen"'
   End Object
   MaterialExpression=MaterialExpressionDivide'"MaterialExpressionDivide_0"'
   NodePosX=-432
   NodeGuid=64B233E94C7BEB2AACEA32A15EF5BD0E
   CustomProperties Pin (PinId=14B429C046A073AEE665EFB258A84CF7,PinName="A",PinType.PinCategory="optional",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_3 FF1B4A6C44A415545E09F1B1B099B4E3,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=67D1399E4223694B8E4813AE2CC1F3A0,PinName="B",PinType.PinCategory="optional",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_18 3C907B2F4E17772B623FA0928DFB9977,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=9B41172C4F2EC9F215370C90F8A155E1,PinName="Output",PinFriendlyName=" ",Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_16 6264B4294C89F0C16140B4B80BFB32A5,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
End Object
Begin Object Class=/Script/UnrealEd.MaterialGraphNode Name="MaterialGraphNode_13"
   Begin Object Class=/Script/Engine.MaterialExpressionClamp Name="MaterialExpressionClamp_0"
   End Object
   Begin Object Name="MaterialExpressionClamp_0"
      Input=(Expression=MaterialExpressionOneMinus'"MaterialGraphNode_16.MaterialExpressionOneMinus_0"')
      MaterialExpressionEditorX=-208
      MaterialExpressionGuid=6FF90D0644A7E453A75FDA8D68C9ACBA
      Material=PreviewMaterial'"/Engine/Transient.M_Sharpen"'
   End Object
   MaterialExpression=MaterialExpressionClamp'"MaterialExpressionClamp_0"'
   NodePosX=-208
   NodeGuid=BC22923140EA88941DE3F8B00CFA53B4
   CustomProperties Pin (PinId=7D5F35454C28AFAB4A707187C71C6B32,PinName="Input",PinFriendlyName=" ",PinType.PinCategory="required",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_16 0BA28B0F4A96AB422CB108907EB87889,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=A34096B5469D8C6C1FB1B4BC8E891A98,PinName="Min",PinType.PinCategory="optional",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=B11692D0424A3EC14515DDB1620EA67B,PinName="Max",PinType.PinCategory="optional",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=CB27BFF240766DC481704FAF05E1A51B,PinName="Output",PinFriendlyName=" ",Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_15 7C02DCC842B921D4E0FFD9BB5AAA1641,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
End Object
Begin Object Class=/Script/UnrealEd.MaterialGraphNode Name="MaterialGraphNode_15"
   Begin Object Class=/Script/Engine.MaterialExpressionMultiply Name="MaterialExpressionMultiply_2"
   End Object
   Begin Object Name="MaterialExpressionMultiply_2"
      A=(Expression=MaterialExpressionMultiply'"MaterialGraphNode_1.MaterialExpressionMultiply_1"')
      B=(Expression=MaterialExpressionClamp'"MaterialGraphNode_13.MaterialExpressionClamp_0"')
      MaterialExpressionEditorX=32
      MaterialExpressionEditorY=-256
      MaterialExpressionGuid=AE5CEDE5458D219B3A323DAB31146F37
      Material=PreviewMaterial'"/Engine/Transient.M_Sharpen"'
   End Object
   MaterialExpression=MaterialExpressionMultiply'"MaterialExpressionMultiply_2"'
   NodePosX=32
   NodePosY=-256
   NodeGuid=40FF16254CB69421DA4117B5D2C72966
   CustomProperties Pin (PinId=60398C164E2F92146661DF8E6CB24D0C,PinName="A",PinType.PinCategory="optional",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_1 3A87A9AC45281993C761B8ADD8D461AC,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=7C02DCC842B921D4E0FFD9BB5AAA1641,PinName="B",PinType.PinCategory="optional",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_13 CB27BFF240766DC481704FAF05E1A51B,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=3ACF13D6487AB908CDA74B857C288266,PinName="Output",PinFriendlyName=" ",Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_0 32DB99F441D3E046BB927FAE33242711,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
End Object
Begin Object Class=/Script/UnrealEd.MaterialGraphNode Name="MaterialGraphNode_16"
   Begin Object Class=/Script/Engine.MaterialExpressionOneMinus Name="MaterialExpressionOneMinus_0"
   End Object
   Begin Object Name="MaterialExpressionOneMinus_0"
      Input=(Expression=MaterialExpressionDivide'"MaterialGraphNode_11.MaterialExpressionDivide_0"')
      MaterialExpressionEditorX=-288
      MaterialExpressionGuid=0230478341A7584BDE577E90465C4F4E
      Material=PreviewMaterial'"/Engine/Transient.M_Sharpen"'
   End Object
   MaterialExpression=MaterialExpressionOneMinus'"MaterialExpressionOneMinus_0"'
   NodePosX=-288
   NodeGuid=F0F30B474629FA5F65DF9DADEE3A4FE1
   CustomProperties Pin (PinId=6264B4294C89F0C16140B4B80BFB32A5,PinName="Input",PinFriendlyName=" ",PinType.PinCategory="required",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_11 9B41172C4F2EC9F215370C90F8A155E1,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=0BA28B0F4A96AB422CB108907EB87889,PinName="Output",PinFriendlyName=" ",Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_13 7D5F35454C28AFAB4A707187C71C6B32,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
End Object
Begin Object Class=/Script/UnrealEd.MaterialGraphNode Name="MaterialGraphNode_18"
   Begin Object Class=/Script/Engine.MaterialExpressionScalarParameter Name="MaterialExpressionScalarParameter_0"
   End Object
   Begin Object Name="MaterialExpressionScalarParameter_0"
      DefaultValue=5000.000000
      ParameterName="DistanceFadeOff"
      ExpressionGUID=F2CFCD094C91096D51A5E69FE11ADFC9
      MaterialExpressionEditorX=-640
      MaterialExpressionEditorY=128
      MaterialExpressionGuid=9F095F064FD556E5621FDE99EF46CA46
      Material=PreviewMaterial'"/Engine/Transient.M_Sharpen"'
   End Object
   MaterialExpression=MaterialExpressionScalarParameter'"MaterialExpressionScalarParameter_0"'
   NodePosX=-640
   NodePosY=128
   bCanRenameNode=True
   NodeGuid=1C8A37A84F58379A2E330DABDAA6F419
   CustomProperties Pin (PinId=3C907B2F4E17772B623FA0928DFB9977,PinName="Output",PinFriendlyName=" ",Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_11 67D1399E4223694B8E4813AE2CC1F3A0,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
End Object


nice work Hallatore! ive been using your camera code to sharpen my scenes ever since i saw it (the one that adjusts the tonemapper based on the camera velocity). one thing with this, im using a dynamic circle depth of field camera mod(line trace to set focal distance), when i apply this sharpener to either my player camera or pp volume, it clears out my depth of field completely. any ideas?

nice!
are there any fundamental differences between this and your previous attempt? I never quite had time to look at the previous one under the hood but this one seems to do a depth+luminance aware sharpen to skip edges
I don’t suppose there’s any way to make the TemporalAA history or the velocity buffer affect this for a combined temporal-aware TemporalAA sharpen (to counter the blurryness on moving objects/camera) ?

btw fixed your bug so it works on all editor viewports simultaneously :slight_smile:


Begin Object Class=/Script/UnrealEd.MaterialGraphNode Name="MaterialGraphNode_4"
   Begin Object Class=/Script/Engine.MaterialExpressionCustom Name="MaterialExpressionCustom_0"
   End Object
   Begin Object Name="MaterialExpressionCustom_0"
      Code="half CenterDepth = SceneTextureLookup(UV, 1, false).r;

half D1 = abs(CenterDepth - SceneTextureLookup(UV + float2(-1, 0) * TexelScale, 1, false).r);
half D2 = abs(CenterDepth - SceneTextureLookup(UV + float2(0, -1) * TexelScale, 1, false).r);
half D3 = abs(CenterDepth - SceneTextureLookup(UV + float2(1, 0) * TexelScale, 1, false).r);
half D4 = abs(CenterDepth - SceneTextureLookup(UV + float2(0, 1) * TexelScale, 1, false).r);

half D5 = abs(CenterDepth - SceneTextureLookup(UV + float2(-2, 0) * TexelScale, 1, false).r);
half D6 = abs(CenterDepth - SceneTextureLookup(UV + float2(0, -2) * TexelScale, 1, false).r);
half D7 = abs(CenterDepth - SceneTextureLookup(UV + float2(2, 0) * TexelScale, 1, false).r);
half D8 = abs(CenterDepth - SceneTextureLookup(UV + float2(0, 2) * TexelScale, 1, false).r);

half D9 = abs(CenterDepth - SceneTextureLookup(UV + float2(-3, 0) * TexelScale, 1, false).r);
half D10 = abs(CenterDepth - SceneTextureLookup(UV + float2(0, -3) * TexelScale, 1, false).r);
half D11 = abs(CenterDepth - SceneTextureLookup(UV + float2(3, 0) * TexelScale, 1, false).r);
half D12 = abs(CenterDepth - SceneTextureLookup(UV + float2(0, 3) * TexelScale, 1, false).r);

half MaxDepthDifference = CenterDepth / 50;
half SceneNeighborDepth0 = saturate(max(max(D1, D2), max(D3, D4)) / MaxDepthDifference);
half SceneNeighborDepth1 = saturate(max(max(D5, D6), max(D7, D8)) / (MaxDepthDifference * 2));
half SceneNeighborDepth2 = saturate(max(max(D9, D10), max(D11, D12)) / (MaxDepthDifference * 3)) / 2;
half SceneNeighborDepth = max(max(SceneNeighborDepth0, SceneNeighborDepth1), SceneNeighborDepth2);
float4 CenterColor =  SceneTextureLookup(UV, 0, false);

half3 C1 = SceneTextureLookup(UV + float2(-1, 0) * TexelScale, 0, false).rgb;
half3 C2 = SceneTextureLookup(UV + float2(0, -1) * TexelScale, 0, false).rgb;
half3 C3 = SceneTextureLookup(UV + float2(1, 0) * TexelScale, 0, false).rgb;
half3 C4 = SceneTextureLookup(UV + float2(0, 1) * TexelScale, 0, false).rgb;

float c1 = Luminance(C1.rgb);
float c2 = Luminance(CenterColor.rgb);
float l1 = max(c1, c2);
float l2 = min(c1, c2);
half L1 = ((l1 + 0.05) / (l2 + 0.05) - 1) / 20;

c1 = Luminance(C2.rgb);
l1 = max(c1, c2);
l2 = min(c1, c2);
half L2 = ((l1 + 0.05) / (l2 + 0.05) - 1) / 20;

c1 = Luminance(C3.rgb);
l1 = max(c1, c2);
l2 = min(c1, c2);
half L3 = ((l1 + 0.05) / (l2 + 0.05) - 1) / 20;

c1 = Luminance(C4.rgb);
l1 = max(c1, c2);
l2 = min(c1, c2);
half L4 = ((l1 + 0.05) / (l2 + 0.05) - 1) / 20;

half NeighborDifference = max(max(L1, L2), max(L3, L4));
half LuminanceContrastFactor = saturate(1 - NeighborDifference * SharpenWeight * 10);
half DepthFactor = saturate(1 - SceneNeighborDepth);

half A0 = Luminance(CenterColor);
half4 LuminanceNeightbors = half4(Luminance(C1), Luminance(C2), Luminance(C3), Luminance(C4));
float4 A0LuminanceNeightbors = abs(A0 - LuminanceNeightbors);
half HDREdge = max(max(A0LuminanceNeightbors.r, A0LuminanceNeightbors.g), max(A0LuminanceNeightbors.b, A0LuminanceNeightbors.a));
half EdgeMask = saturate(1.0f - HDREdge);
float LerpFactor = -EdgeMask * SharpenWeight * DepthFactor * LuminanceContrastFactor;
half3 DeltaColor = (C1 + C2 + C3 + C4) - CenterColor * 4;
CenterColor.rgb += DeltaColor * LerpFactor;

return CenterColor.rgb;"
      Inputs(0)=(InputName="UV",Input=(Expression=MaterialExpressionCustom'"MaterialGraphNode_11.MaterialExpressionCustom_2"'))
      Inputs(1)=(InputName="Tex",Input=(Expression=MaterialExpressionSceneTexture'"MaterialGraphNode_6.MaterialExpressionSceneTexture_0"',Mask=1,MaskR=1,MaskG=1,MaskB=1,MaskA=1))
      Inputs(2)=(InputName="Depth",Input=(Expression=MaterialExpressionSceneTexture'"MaterialGraphNode_8.MaterialExpressionSceneTexture_1"',Mask=1,MaskR=1,MaskG=1,MaskB=1,MaskA=1))
      Inputs(3)=(InputName="TexelScale",Input=(Expression=MaterialExpressionSceneTexelSize'"MaterialGraphNode_9.MaterialExpressionSceneTexelSize_0"'))
      Inputs(4)=(InputName="SharpenWeight",Input=(Expression=MaterialExpressionScalarParameter'"MaterialGraphNode_10.MaterialExpressionScalarParameter_0"'))
      MaterialExpressionEditorX=-784
      MaterialExpressionEditorY=96
      MaterialExpressionGuid=210EEB4F41C620C4310A67981D9E4E41
      Material=PreviewMaterial'"/Engine/Transient.M_Sharpen"'
   End Object
   MaterialExpression=MaterialExpressionCustom'"MaterialExpressionCustom_0"'
   NodePosX=-784
   NodePosY=96
   NodeGuid=32CC9B3B41A9D178A6621BB28DEA1A90
   CustomProperties Pin (PinId=EE0C8CD44E02C113D870F3AB893308A6,PinName="UV",PinType.PinCategory="required",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_11 FB40BD3B46CBEF0549E0AC929D47A164,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=87AC9EE04CEBE5B2BC67EE8E90948261,PinName="Tex",PinType.PinCategory="required",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_6 8F5B6861482A15A34CF4E28B62AA3D3F,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=32DF1D14427BD2A791EB43B5D6C79691,PinName="Depth",PinType.PinCategory="required",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_8 A1E385CE40E2E22588B4888243E99740,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=DEAC56414A03EA171137D189717067DF,PinName="TexelScale",PinType.PinCategory="required",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_9 96716D3E4AF446098C5E2F8DFCAC09D3,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=8DAFD581455C6C9433B6E58A76DD7099,PinName="SharpenWeight",PinType.PinCategory="required",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_10 BE51D15740CE2A274FE3839DBB8285B3,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=DCE9A73147DAE56B8F355D8E97966363,PinName="Output",PinFriendlyName=" ",Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_Root_1 733EC3B0428AA034B4000E8B6659F0EC,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
End Object
Begin Object Class=/Script/UnrealEd.MaterialGraphNode Name="MaterialGraphNode_5"
   Begin Object Class=/Script/Engine.MaterialExpressionScreenPosition Name="MaterialExpressionScreenPosition_0"
   End Object
   Begin Object Name="MaterialExpressionScreenPosition_0"
      MaterialExpressionEditorX=-1296
      MaterialExpressionEditorY=-160
      MaterialExpressionGuid=A04331B94FA160F96CC081B07C3BA01F
      Material=PreviewMaterial'"/Engine/Transient.M_Sharpen"'
   End Object
   MaterialExpression=MaterialExpressionScreenPosition'"MaterialExpressionScreenPosition_0"'
   NodePosX=-1296
   NodePosY=-160
   NodeGuid=64E5787A4C957E860075E5BF502DEF16
   CustomProperties Pin (PinId=3A137F084B8BD86707AB5CBE936F9B8C,PinName="ViewportUV",Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=068BCD164E45B9F1397D32BF2A111EC4,PinName="PixelPosition",Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
End Object
Begin Object Class=/Script/UnrealEd.MaterialGraphNode Name="MaterialGraphNode_6"
   Begin Object Class=/Script/Engine.MaterialExpressionSceneTexture Name="MaterialExpressionSceneTexture_0"
   End Object
   Begin Object Name="MaterialExpressionSceneTexture_0"
      SceneTextureId=PPI_PostProcessInput0
      MaterialExpressionEditorX=-1296
      MaterialExpressionEditorY=64
      MaterialExpressionGuid=2683E4664DE80A68DDCABEBA11B373AD
      Material=PreviewMaterial'"/Engine/Transient.M_Sharpen"'
   End Object
   MaterialExpression=MaterialExpressionSceneTexture'"MaterialExpressionSceneTexture_0"'
   NodePosX=-1296
   NodePosY=64
   NodeGuid=0E71B27E455CE6BD847B4090144CF10A
   CustomProperties Pin (PinId=3DE14FD14CBC8388A2D4EC8B60367D0E,PinName="UVs",PinType.PinCategory="optional",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=8F5B6861482A15A34CF4E28B62AA3D3F,PinName="Color",Direction="EGPD_Output",PinType.PinCategory="mask",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_4 87AC9EE04CEBE5B2BC67EE8E90948261,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=8CEA30104DF60BB359ABD4AA93DFDEC3,PinName="Size",Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=D3C35D1F495A47576668F181343C7DEF,PinName="InvSize",Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
End Object
Begin Object Class=/Script/UnrealEd.MaterialGraphNode Name="MaterialGraphNode_8"
   Begin Object Class=/Script/Engine.MaterialExpressionSceneTexture Name="MaterialExpressionSceneTexture_1"
   End Object
   Begin Object Name="MaterialExpressionSceneTexture_1"
      SceneTextureId=PPI_SceneDepth
      MaterialExpressionEditorX=-1232
      MaterialExpressionEditorY=208
      MaterialExpressionGuid=2683E4664DE80A68DDCABEBA11B373AD
      Material=PreviewMaterial'"/Engine/Transient.M_Sharpen"'
   End Object
   MaterialExpression=MaterialExpressionSceneTexture'"MaterialExpressionSceneTexture_1"'
   NodePosX=-1232
   NodePosY=208
   NodeGuid=F7B92AC04ACB28DE32DA1F9316797172
   CustomProperties Pin (PinId=75736072417603EE2DF756BBDD32D64C,PinName="UVs",PinType.PinCategory="optional",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=A1E385CE40E2E22588B4888243E99740,PinName="Color",Direction="EGPD_Output",PinType.PinCategory="mask",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_4 32DF1D14427BD2A791EB43B5D6C79691,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=83A4C82C499224B29E6228A672F1F717,PinName="Size",Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=F40AD9F245053388FA16D1A4587BEB98,PinName="InvSize",Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
End Object
Begin Object Class=/Script/UnrealEd.MaterialGraphNode Name="MaterialGraphNode_9"
   Begin Object Class=/Script/Engine.MaterialExpressionSceneTexelSize Name="MaterialExpressionSceneTexelSize_0"
   End Object
   Begin Object Name="MaterialExpressionSceneTexelSize_0"
      MaterialExpressionEditorX=-1168
      MaterialExpressionEditorY=336
      MaterialExpressionGuid=7148DC654F2C66A716797988BD59859A
      Material=PreviewMaterial'"/Engine/Transient.M_Sharpen"'
   End Object
   MaterialExpression=MaterialExpressionSceneTexelSize'"MaterialExpressionSceneTexelSize_0"'
   NodePosX=-1168
   NodePosY=336
   NodeGuid=2601B9324E2B0D9744E78B80F680053D
   CustomProperties Pin (PinId=96716D3E4AF446098C5E2F8DFCAC09D3,PinName="Output",PinFriendlyName=" ",Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_4 DEAC56414A03EA171137D189717067DF,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
End Object
Begin Object Class=/Script/UnrealEd.MaterialGraphNode Name="MaterialGraphNode_10"
   Begin Object Class=/Script/Engine.MaterialExpressionScalarParameter Name="MaterialExpressionScalarParameter_0"
   End Object
   Begin Object Name="MaterialExpressionScalarParameter_0"
      DefaultValue=0.700000
      ParameterName="SharpenWeight"
      ExpressionGUID=AB8FA00347C854A0D86F8B932ADCB50B
      MaterialExpressionEditorX=-1168
      MaterialExpressionEditorY=432
      MaterialExpressionGuid=6C4AC22742271C16C0F960977D4CFE19
      Material=PreviewMaterial'"/Engine/Transient.M_Sharpen"'
   End Object
   MaterialExpression=MaterialExpressionScalarParameter'"MaterialExpressionScalarParameter_0"'
   NodePosX=-1168
   NodePosY=432
   bCanRenameNode=True
   NodeGuid=CB9713C146A7646BA13D9593C61FC4AF
   CustomProperties Pin (PinId=BE51D15740CE2A274FE3839DBB8285B3,PinName="Output",PinFriendlyName=" ",Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_4 8DAFD581455C6C9433B6E58A76DD7099,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
End Object
Begin Object Class=/Script/UnrealEd.MaterialGraphNode_Comment Name="MaterialGraphNode_Comment_1"
   Begin Object Class=/Script/Engine.MaterialExpressionComment Name="MaterialExpressionComment_0"
   End Object
   Begin Object Name="MaterialExpressionComment_0"
      SizeX=560
      SizeY=240
      Text="UV is buggy in editor because of multiple viewports. Works fine in-game."
      MaterialExpressionEditorX=-1328
      MaterialExpressionEditorY=-272
      MaterialExpressionGuid=3548C7504A602F4E9E1CF9A3BEA49D66
      Material=PreviewMaterial'"/Engine/Transient.M_Sharpen"'
   End Object
   MaterialExpressionComment=MaterialExpressionComment'"MaterialExpressionComment_0"'
   NodePosX=-1328
   NodePosY=-272
   NodeWidth=560
   NodeHeight=240
   NodeComment="UV is buggy in editor because of multiple viewports. Works fine in-game."
   NodeGuid=1F077D3E4463DF85DEDB8FA9AAC11E90
End Object
Begin Object Class=/Script/UnrealEd.MaterialGraphNode Name="MaterialGraphNode_11"
   Begin Object Class=/Script/Engine.MaterialExpressionCustom Name="MaterialExpressionCustom_2"
   End Object
   Begin Object Name="MaterialExpressionCustom_2"
      Code="return GetDefaultSceneTextureUV(Parameters, 14);"
      OutputType=CMOT_Float2
      Description="SceneUV"
      Inputs=
      MaterialExpressionEditorX=-1168
      MaterialExpressionEditorY=-16
      MaterialExpressionGuid=1DBC64204F255784608569B4A9C11C32
      Material=PreviewMaterial'"/Engine/Transient.M_Sharpen"'
      bCollapsed=True
   End Object
   MaterialExpression=MaterialExpressionCustom'"MaterialExpressionCustom_2"'
   NodePosX=-1168
   NodePosY=-16
   NodeGuid=162604D24EF7837C0868609A7540751B
   CustomProperties Pin (PinId=FB40BD3B46CBEF0549E0AC929D47A164,PinName="Output",PinFriendlyName=" ",Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_4 EE0C8CD44E02C113D870F3AB893308A6,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
End Object


This one just uses depth and some luminance as you said. It’s not as good as the other one, but it might be a good trade off given you can use it this easily.
I decided to see if I could get something to work with just a post process material. :slight_smile:

Thanks for the SceneUV! That bug was really annoying! :smiley:

Here are some examples of the mask it uses to sharpen.

Split the code into different parts.

Also found a strange bug with TexelScale. It becomes wrong if you turn r.screenPercentage up and then back down again. Restarting the editor resets it to normal.

Thanks for this hallatore! Awesome that you figured out a way to “dumb” things down and squeeze it into a PP material.

anyone else have the problem of this killing any DoF?

You set Blendable Location to Before Translucency?

I haven’t tried it. But I have found a couple of weird bugs with Post Porcess Materials, so it might be a bit buggy.
TexelSize is wrong if you change r.screenPercentage around.

ahh, that might be it, not at my main pc atm, but i think maybe i read your first post as “before tonemapper” not before translucency, will confirm asap. thanks man :slight_smile:

try using this instead of the TexelSize node. not sure if it will solve the issue but it solved another postprocess-related texelsize bug I had


Begin Object Class=/Script/UnrealEd.MaterialGraphNode Name="MaterialGraphNode_1097"
   Begin Object Class=/Script/Engine.MaterialExpressionCustom Name="MaterialExpressionCustom_17"
   End Object
   Begin Object Name="MaterialExpressionCustom_17"
      Code="return View.BufferSizeAndInvSize.zw;"
      OutputType=CMOT_Float2
      Description="BufferTexelSize"
      Inputs=
      MaterialExpressionEditorX=-3824
      MaterialExpressionEditorY=64
      MaterialExpressionGuid=99D774D54CC0E5C8D02B37991F61BC9E
      Material=PreviewMaterial'"/Engine/Transient.M_WMap"'
      bCollapsed=True
   End Object
   MaterialExpression=MaterialExpressionCustom'"MaterialExpressionCustom_17"'
   NodePosX=-3824
   NodePosY=64
   NodeGuid=B575D51542248D52CD65028CF1B4E2B2
   CustomProperties Pin (PinId=21E0714D48DD3FCBC237889FCABEF01F,PinName="Output",PinFriendlyName=" ",Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_1080 E2B5393141864C18E9D1F88731BD17C6,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
End Object


Thanks! This one works perfectly :slight_smile:

PS: Updated the code in the initial post.

I had it at before tonemapper initially. But that really screws up translucency also :stuck_out_tongue:

turns out it was my inability to read when i get excited about stuff. i absolutely had it set to before tonemapper and not before translucency! everything works perfectly

This is very timely as I was just trying to do something similar. I tried your solution however I hit a snag with a Material compile error:


"GetDefaultSceneTextureUV" undeclared identifier

. GetDefaultSceneTextureUV is referenced in the ScreenUV node and I couldn’t find any references to it in the ush/usf files. Version issue? I’m on 4.18. Thanks!

Addendum to my above: I installed 4.19 and it works fine. Thoughts on a replacement for this node for 4.18?

Yeah I was having the same problem, couldn’t find anything on it I would also appreciate it if you knew of a fix as well.

And another followup: I went ahead and grabbed a copy of the 4.19 engine shaders and grabbed the code out of their. My updated code material graph:



Begin Object Class=/Script/UnrealEd.MaterialGraphNode Name="MaterialGraphNode_0"
   Begin Object Class=/Script/Engine.MaterialExpressionCustom Name="MaterialExpressionCustom_0"
   End Object
   Begin Object Name="MaterialExpressionCustom_0"
      Code="float3 CenterColor =  Color;

half3 C1 = SceneTextureLookup(UV + float2(-1, 0) * TexelScale, 0, false).rgb;
half3 C2 = SceneTextureLookup(UV + float2(0, -1) * TexelScale, 0, false).rgb;
half3 C3 = SceneTextureLookup(UV + float2(1, 0) * TexelScale, 0, false).rgb;
half3 C4 = SceneTextureLookup(UV + float2(0, 1) * TexelScale, 0, false).rgb;

half A0 = Luminance(CenterColor);
half4 LuminanceNeightbors = half4(Luminance(C1), Luminance(C2), Luminance(C3), Luminance(C4));
float4 A0LuminanceNeightbors = abs(A0 - LuminanceNeightbors);
half HDREdge = max(max(A0LuminanceNeightbors.r, A0LuminanceNeightbors.g), max(A0LuminanceNeightbors.b, A0LuminanceNeightbors.a));
half EdgeMask = saturate(1.0f - HDREdge);
float LerpFactor = -EdgeMask * SharpenWeight;
half3 DeltaColor = (C1 + C2 + C3 + C4) - CenterColor * 4;
CenterColor.rgb += DeltaColor * LerpFactor;

//float debug = DepthFactor * LuminanceContrastFactor / 2;
//return float3(0, debug, 0);

return CenterColor.rgb;"
      Description="Sharpen"
      Inputs(0)=(InputName="UV",Input=(Expression=MaterialExpressionCustom'"MaterialGraphNode_4.MaterialExpressionCustom_3"'))
      Inputs(1)=(InputName="Color",Input=(Expression=MaterialExpressionSceneTexture'"MaterialGraphNode_2.MaterialExpressionSceneTexture_0"',Mask=1,MaskR=1,MaskG=1,MaskB=1,MaskA=1))
      Inputs(2)=(InputName="TexelScale",Input=(Expression=MaterialExpressionCustom'"MaterialGraphNode_9.MaterialExpressionCustom_17"'))
      Inputs(3)=(InputName="SharpenWeight",Input=(Expression=MaterialExpressionMultiply'"MaterialGraphNode_1.MaterialExpressionMultiply_1"'))
      MaterialExpressionEditorX=-384
      MaterialExpressionEditorY=128
      MaterialExpressionGuid=210EEB4F41C620C4310A67981D9E4E41
      Material=PreviewMaterial'"/Engine/Transient.TemporalAASharpen"'
   End Object
   MaterialExpression=MaterialExpressionCustom'"MaterialExpressionCustom_0"'
   NodePosX=-384
   NodePosY=128
   NodeGuid=B468F4214D209807D9DBE3806F82BD01
   CustomProperties Pin (PinId=9D4C43AF4D88B143C70331A716FEA46B,PinName="UV",PinType.PinCategory="required",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_4 47EAA776485CA7AD55AC91BE84347445,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=79F1F36D40988E2FFC83FFB37700741B,PinName="Color",PinType.PinCategory="required",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_2 FE15B7184D31E7AC14AB05B769A8ED1F,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=F84EF0534F31646B727ED2BE25761135,PinName="TexelScale",PinType.PinCategory="required",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_9 206DB29347781DE47CE068B5230F25B9,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=02A8C8B5441770DCCB9F0482CCD01BB4,PinName="SharpenWeight",PinType.PinCategory="required",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_1 43D4A1584887E86707563F86210317F7,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=0754622E492AAFBE042D1294E1233460,PinName="Output",PinFriendlyName=" ",Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_Root_0 2076F6154D003B6FABDCC1B8D5FC06E0,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
End Object
Begin Object Class=/Script/UnrealEd.MaterialGraphNode Name="MaterialGraphNode_1"
   Begin Object Class=/Script/Engine.MaterialExpressionMultiply Name="MaterialExpressionMultiply_1"
   End Object
   Begin Object Name="MaterialExpressionMultiply_1"
      A=(Expression=MaterialExpressionScalarParameter'"MaterialGraphNode_8.MaterialExpressionScalarParameter_3"')
      B=(Expression=MaterialExpressionMultiply'"MaterialGraphNode_7.MaterialExpressionMultiply_0"')
      MaterialExpressionEditorX=-528
      MaterialExpressionEditorY=32
      MaterialExpressionGuid=496ED3774D80B9675B16C184580C9CE5
      Material=PreviewMaterial'"/Engine/Transient.TemporalAASharpen"'
   End Object
   MaterialExpression=MaterialExpressionMultiply'"MaterialExpressionMultiply_1"'
   NodePosX=-528
   NodePosY=32
   NodeGuid=BB37587B4157F5A835DB338D81CA076A
   CustomProperties Pin (PinId=FB672E374264AE6F62688AA8043C0DA7,PinName="A",PinType.PinCategory="optional",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_8 D5136A09470715BF657849AF7E978382,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=9DE780224549FAADE6BDC1983B000ED4,PinName="B",PinType.PinCategory="optional",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_7 DB9D7A404EB943D43A3497A9D4A693BA,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=43D4A1584887E86707563F86210317F7,PinName="Output",PinFriendlyName=" ",Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_0 02A8C8B5441770DCCB9F0482CCD01BB4,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
End Object
Begin Object Class=/Script/UnrealEd.MaterialGraphNode Name="MaterialGraphNode_2"
   Begin Object Class=/Script/Engine.MaterialExpressionSceneTexture Name="MaterialExpressionSceneTexture_0"
   End Object
   Begin Object Name="MaterialExpressionSceneTexture_0"
      SceneTextureId=PPI_PostProcessInput0
      MaterialExpressionEditorX=-1456
      MaterialExpressionEditorY=288
      MaterialExpressionGuid=2683E4664DE80A68DDCABEBA11B373AD
      Material=PreviewMaterial'"/Engine/Transient.TemporalAASharpen"'
   End Object
   MaterialExpression=MaterialExpressionSceneTexture'"MaterialExpressionSceneTexture_0"'
   NodePosX=-1456
   NodePosY=288
   NodeGuid=CD25F0E442D5AF6588FAEBA664DF3970
   CustomProperties Pin (PinId=E1AC74BB4DAFE0E19E03F19CE6D37B9E,PinName="UVs",PinType.PinCategory="optional",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=FE15B7184D31E7AC14AB05B769A8ED1F,PinName="Color",Direction="EGPD_Output",PinType.PinCategory="mask",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_0 79F1F36D40988E2FFC83FFB37700741B,MaterialGraphNode_6 930E54EF45C261E70F9C5FA83D7F3703,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=C8FACE7C4A32D7AFDA6C9090585B349F,PinName="Size",Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=9256674F4501FA535231E1AD292E4D12,PinName="InvSize",Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
End Object
Begin Object Class=/Script/UnrealEd.MaterialGraphNode Name="MaterialGraphNode_3"
   Begin Object Class=/Script/Engine.MaterialExpressionSceneTexture Name="MaterialExpressionSceneTexture_1"
   End Object
   Begin Object Name="MaterialExpressionSceneTexture_1"
      SceneTextureId=PPI_SceneDepth
      MaterialExpressionEditorX=-1456
      MaterialExpressionEditorY=128
      MaterialExpressionGuid=2683E4664DE80A68DDCABEBA11B373AD
      Material=PreviewMaterial'"/Engine/Transient.TemporalAASharpen"'
   End Object
   MaterialExpression=MaterialExpressionSceneTexture'"MaterialExpressionSceneTexture_1"'
   NodePosX=-1456
   NodePosY=128
   NodeGuid=CCD2996043D063B2990C4CB26FD255F0
   CustomProperties Pin (PinId=ACDF414D4034D142A6DEF8885DE7E652,PinName="UVs",PinType.PinCategory="optional",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=4C69EEEC492FDB5376DBB3BEACAA0399,PinName="Color",Direction="EGPD_Output",PinType.PinCategory="mask",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_5 FFCAD9D8458D6A550393F28C1F6D18E3,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=620660C343FF7E9A5EA00C99B69BD6B2,PinName="Size",Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=4DDBE80B45C8BF6A50804CA769CB6C3D,PinName="InvSize",Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
End Object
Begin Object Class=/Script/UnrealEd.MaterialGraphNode Name="MaterialGraphNode_4"
   Begin Object Class=/Script/Engine.MaterialExpressionCustom Name="MaterialExpressionCustom_3"
   End Object
   Begin Object Name="MaterialExpressionCustom_3"
      Code="	#if POST_PROCESS_MATERIAL
	{
		// If compiling for material permutation that assume BufferSize == ViewSize, then return scene texture UV.
		#if POST_PROCESS_MATERIAL_UV_POLICY == 0
		{
			return GetSceneTextureUV(Parameters);
		}
		#endif

		#if POST_PROCESS_MATERIAL_AFTER_TAA_UPSAMPLE
		{
			return ViewportUVToSceneTextureUV(GetViewportUV(Parameters), SceneTextureId);
		}
		#endif
	}
	#endif

	return GetSceneTextureUV(Parameters);"
      OutputType=CMOT_Float2
      Description="SceneUV"
      Inputs=
      MaterialExpressionEditorX=-1456
      MaterialExpressionEditorY=-80
      MaterialExpressionGuid=1DBC64204F255784608569B4A9C11C32
      Material=PreviewMaterial'"/Engine/Transient.TemporalAASharpen"'
      bCollapsed=True
   End Object
   MaterialExpression=MaterialExpressionCustom'"MaterialExpressionCustom_3"'
   NodePosX=-1456
   NodePosY=-80
   NodeGuid=542CC44B4D6E0CE68E4F0DAA0E1CD719
   CustomProperties Pin (PinId=47EAA776485CA7AD55AC91BE84347445,PinName="Output",PinFriendlyName=" ",Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_0 9D4C43AF4D88B143C70331A716FEA46B,MaterialGraphNode_5 5BE1B63D42B66580A3A5BF85D18B6A51,MaterialGraphNode_6 9A8127AE4C33B844F48D3BBC72EE7F6E,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
End Object
Begin Object Class=/Script/UnrealEd.MaterialGraphNode Name="MaterialGraphNode_5"
   Begin Object Class=/Script/Engine.MaterialExpressionCustom Name="MaterialExpressionCustom_4"
   End Object
   Begin Object Name="MaterialExpressionCustom_4"
      Code="half CenterDepth = Depth;

half D1 = abs(CenterDepth - SceneTextureLookup(UV + float2(-1, 0) * TexelScale, 1, false).r);
half D2 = abs(CenterDepth - SceneTextureLookup(UV + float2(0, -1) * TexelScale, 1, false).r);
half D3 = abs(CenterDepth - SceneTextureLookup(UV + float2(1, 0) * TexelScale, 1, false).r);
half D4 = abs(CenterDepth - SceneTextureLookup(UV + float2(0, 1) * TexelScale, 1, false).r);

half D5 = abs(CenterDepth - SceneTextureLookup(UV + float2(-2, 0) * TexelScale, 1, false).r);
half D6 = abs(CenterDepth - SceneTextureLookup(UV + float2(0, -2) * TexelScale, 1, false).r);
half D7 = abs(CenterDepth - SceneTextureLookup(UV + float2(2, 0) * TexelScale, 1, false).r);
half D8 = abs(CenterDepth - SceneTextureLookup(UV + float2(0, 2) * TexelScale, 1, false).r);

half D9 = abs(CenterDepth - SceneTextureLookup(UV + float2(-3, 0) * TexelScale, 1, false).r);
half D10 = abs(CenterDepth - SceneTextureLookup(UV + float2(0, -3) * TexelScale, 1, false).r);
half D11 = abs(CenterDepth - SceneTextureLookup(UV + float2(3, 0) * TexelScale, 1, false).r);
half D12 = abs(CenterDepth - SceneTextureLookup(UV + float2(0, 3) * TexelScale, 1, false).r);

half MaxDepthDifference = max(CenterDepth, 150) / 150;
half SceneNeighborDepth0 = saturate(max(max(D1, D2), max(D3, D4)) / MaxDepthDifference);
half SceneNeighborDepth1 = saturate(max(max(D5, D6), max(D7, D8)) / (MaxDepthDifference * 2));
half SceneNeighborDepth2 = saturate(max(max(D9, D10), max(D11, D12)) / (MaxDepthDifference * 3)) / 2;
half SceneNeighborDepth = max(max(SceneNeighborDepth0, SceneNeighborDepth1), SceneNeighborDepth2);
return saturate(1 - saturate(SceneNeighborDepth));"
      OutputType=CMOT_Float1
      Description="Depth"
      Inputs(0)=(InputName="UV",Input=(Expression=MaterialExpressionCustom'"MaterialGraphNode_4.MaterialExpressionCustom_3"'))
      Inputs(1)=(InputName="TexelScale",Input=(Expression=MaterialExpressionCustom'"MaterialGraphNode_9.MaterialExpressionCustom_17"'))
      Inputs(2)=(InputName="Depth",Input=(Expression=MaterialExpressionSceneTexture'"MaterialGraphNode_3.MaterialExpressionSceneTexture_1"',Mask=1,MaskR=1,MaskG=1,MaskB=1,MaskA=1))
      MaterialExpressionEditorX=-960
      MaterialExpressionEditorY=-64
      MaterialExpressionGuid=EE6165774BB2AA315508A28D434EE6B4
      Material=PreviewMaterial'"/Engine/Transient.TemporalAASharpen"'
   End Object
   MaterialExpression=MaterialExpressionCustom'"MaterialExpressionCustom_4"'
   NodePosX=-960
   NodePosY=-64
   NodeGuid=CB36A50F44E49265E666D5BA0D904A86
   CustomProperties Pin (PinId=5BE1B63D42B66580A3A5BF85D18B6A51,PinName="UV",PinType.PinCategory="required",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_4 47EAA776485CA7AD55AC91BE84347445,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=B69C60844ED01BFEB25CB9A1B2CE9D5C,PinName="TexelScale",PinType.PinCategory="required",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_9 206DB29347781DE47CE068B5230F25B9,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=FFCAD9D8458D6A550393F28C1F6D18E3,PinName="Depth",PinType.PinCategory="required",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_3 4C69EEEC492FDB5376DBB3BEACAA0399,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=54CA01064CAFE64A4B0824A11C3F33A4,PinName="Output",PinFriendlyName=" ",Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_7 C371C08E4316FC583A86F9AAF7E935B7,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
End Object
Begin Object Class=/Script/UnrealEd.MaterialGraphNode Name="MaterialGraphNode_6"
   Begin Object Class=/Script/Engine.MaterialExpressionCustom Name="MaterialExpressionCustom_5"
   End Object
   Begin Object Name="MaterialExpressionCustom_5"
      Code="float3 CenterColor =  Color;

half3 C1 = SceneTextureLookup(UV + float2(-1, 0) * TexelScale, 0, false).rgb;
half3 C2 = SceneTextureLookup(UV + float2(0, -1) * TexelScale, 0, false).rgb;
half3 C3 = SceneTextureLookup(UV + float2(1, 0) * TexelScale, 0, false).rgb;
half3 C4 = SceneTextureLookup(UV + float2(0, 1) * TexelScale, 0, false).rgb;

float c1 = Luminance(C1);
float c2 = Luminance(CenterColor);
float l1 = max(c1, c2);
float l2 = min(c1, c2);
half L1 = ((l1 + 0.05) / (l2 + 0.05) - 1) / 20;

c1 = Luminance(C2);
l1 = max(c1, c2);
l2 = min(c1, c2);
half L2 = ((l1 + 0.05) / (l2 + 0.05) - 1) / 20;

c1 = Luminance(C3);
l1 = max(c1, c2);
l2 = min(c1, c2);
half L3 = ((l1 + 0.05) / (l2 + 0.05) - 1) / 20;

c1 = Luminance(C4);
l1 = max(c1, c2);
l2 = min(c1, c2);
half L4 = ((l1 + 0.05) / (l2 + 0.05) - 1) / 20;

half NeighborDifference = max(max(L1, L2), max(L3, L4));
return saturate(1 - NeighborDifference);"
      OutputType=CMOT_Float1
      Description="Luminance"
      Inputs(0)=(InputName="UV",Input=(Expression=MaterialExpressionCustom'"MaterialGraphNode_4.MaterialExpressionCustom_3"'))
      Inputs(1)=(InputName="TexelScale",Input=(Expression=MaterialExpressionCustom'"MaterialGraphNode_9.MaterialExpressionCustom_17"'))
      Inputs(2)=(InputName="Color",Input=(Expression=MaterialExpressionSceneTexture'"MaterialGraphNode_2.MaterialExpressionSceneTexture_0"',Mask=1,MaskR=1,MaskG=1,MaskB=1,MaskA=1))
      MaterialExpressionEditorX=-960
      MaterialExpressionEditorY=144
      MaterialExpressionGuid=EE6165774BB2AA315508A28D434EE6B4
      Material=PreviewMaterial'"/Engine/Transient.TemporalAASharpen"'
   End Object
   MaterialExpression=MaterialExpressionCustom'"MaterialExpressionCustom_5"'
   NodePosX=-960
   NodePosY=144
   NodeGuid=E5ECF5934646EC0F491A3B9F76B32E2F
   CustomProperties Pin (PinId=9A8127AE4C33B844F48D3BBC72EE7F6E,PinName="UV",PinType.PinCategory="required",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_4 47EAA776485CA7AD55AC91BE84347445,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=CFACE6164D562795C4B8BA8D87BB24B8,PinName="TexelScale",PinType.PinCategory="required",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_9 206DB29347781DE47CE068B5230F25B9,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=930E54EF45C261E70F9C5FA83D7F3703,PinName="Color",PinType.PinCategory="required",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_2 FE15B7184D31E7AC14AB05B769A8ED1F,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=61E03AAC4BBC0EC96D02658B3E3F75F9,PinName="Output",PinFriendlyName=" ",Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_7 F255DE9149DF0FE7D2CD7AAD8BBBEC54,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
End Object
Begin Object Class=/Script/UnrealEd.MaterialGraphNode Name="MaterialGraphNode_7"
   Begin Object Class=/Script/Engine.MaterialExpressionMultiply Name="MaterialExpressionMultiply_0"
   End Object
   Begin Object Name="MaterialExpressionMultiply_0"
      A=(Expression=MaterialExpressionCustom'"MaterialGraphNode_5.MaterialExpressionCustom_4"')
      B=(Expression=MaterialExpressionCustom'"MaterialGraphNode_6.MaterialExpressionCustom_5"')
      MaterialExpressionEditorX=-688
      MaterialExpressionEditorY=32
      MaterialExpressionGuid=11F9E406498F65354096FE8D4F3A0217
      Material=PreviewMaterial'"/Engine/Transient.TemporalAASharpen"'
   End Object
   MaterialExpression=MaterialExpressionMultiply'"MaterialExpressionMultiply_0"'
   NodePosX=-688
   NodePosY=32
   NodeGuid=83D71F9B4D210AC56CBA3A86CF824EDB
   CustomProperties Pin (PinId=C371C08E4316FC583A86F9AAF7E935B7,PinName="A",PinType.PinCategory="optional",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_5 54CA01064CAFE64A4B0824A11C3F33A4,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=F255DE9149DF0FE7D2CD7AAD8BBBEC54,PinName="B",PinType.PinCategory="optional",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_6 61E03AAC4BBC0EC96D02658B3E3F75F9,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=DB9D7A404EB943D43A3497A9D4A693BA,PinName="Output",PinFriendlyName=" ",Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_1 9DE780224549FAADE6BDC1983B000ED4,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
End Object
Begin Object Class=/Script/UnrealEd.MaterialGraphNode Name="MaterialGraphNode_8"
   Begin Object Class=/Script/Engine.MaterialExpressionScalarParameter Name="MaterialExpressionScalarParameter_3"
   End Object
   Begin Object Name="MaterialExpressionScalarParameter_3"
      DefaultValue=0.500000
      SliderMax=1.000000
      ParameterName="SharpenWeight"
      ExpressionGUID=3CCBFD354733AEB49058E8A0A281566C
      MaterialExpressionEditorX=-784
      MaterialExpressionEditorY=-176
      MaterialExpressionGuid=19D9205140F703E91D51EAADB938BD72
      Material=PreviewMaterial'"/Engine/Transient.TemporalAASharpen"'
   End Object
   MaterialExpression=MaterialExpressionScalarParameter'"MaterialExpressionScalarParameter_3"'
   NodePosX=-784
   NodePosY=-176
   bCanRenameNode=True
   NodeGuid=B122C97B40DD66FC16DDD8919A2D26AE
   CustomProperties Pin (PinId=D5136A09470715BF657849AF7E978382,PinName="Output",PinFriendlyName=" ",Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_1 FB672E374264AE6F62688AA8043C0DA7,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
End Object
Begin Object Class=/Script/UnrealEd.MaterialGraphNode Name="MaterialGraphNode_9"
   Begin Object Class=/Script/Engine.MaterialExpressionCustom Name="MaterialExpressionCustom_17"
   End Object
   Begin Object Name="MaterialExpressionCustom_17"
      Code="return View.BufferSizeAndInvSize.zw;"
      OutputType=CMOT_Float2
      Description="BufferTexelSize"
      Inputs=
      MaterialExpressionEditorX=-1456
      MaterialExpressionEditorY=16
      MaterialExpressionGuid=99D774D54CC0E5C8D02B37991F61BC9E
      Material=PreviewMaterial'"/Engine/Transient.TemporalAASharpen"'
      bCollapsed=True
   End Object
   MaterialExpression=MaterialExpressionCustom'"MaterialExpressionCustom_17"'
   NodePosX=-1456
   NodePosY=16
   NodeGuid=9D1B46894914FF6C810B09B717661647
   CustomProperties Pin (PinId=206DB29347781DE47CE068B5230F25B9,PinName="Output",PinFriendlyName=" ",Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_0 F84EF0534F31646B727ED2BE25761135,MaterialGraphNode_5 B69C60844ED01BFEB25CB9A1B2CE9D5C,MaterialGraphNode_6 CFACE6164D562795C4B8BA8D87BB24B8,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
End Object


It looks like that could be simplified to just


GetSceneTextureUV

as well but I wasn’t sure.

You’re right. This works just fine. I’ve updated the original code.


return GetSceneTextureUV(Parameters);

Hello!
i`m a little dumb with “code” :frowning:
so - i need to create a custom node in PP material and paste code from OP where? and put output into emissive?