Download

Sharper image without the edge artifacts

I don’t know if it’s the right way but I seem to have fixed that by changing this in the Sharpen node. I’m not entirely sure why it broke in the first place.


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;

to


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

I updated the SceneTextureLookups in the Luminocity Node and the Sharpen Node from 0 (SceneColor) to 14 (PostProcessInput0) like StGaeb suggested. I don´t know why 0 worked until now since the mat is a PP material and those were not supposed to sample SceneColor before via graph nodes.
It is also important to note that I had to change the mat from “beforeTranslucency” to “AfterTonemapping”, as far as I know that is because thats where the PostProcessInput starts working. The setting is not contained in the copied code, so you will have to set it manually in your material attributes.
Here is the updated Material:


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

half3 C1 = SceneTextureLookup(UV + float2(-1, 0) * TexelScale, 14, false).rgb;
half3 C2 = SceneTextureLookup(UV + float2(0, -1) * TexelScale, 14, false).rgb;
half3 C3 = SceneTextureLookup(UV + float2(1, 0) * TexelScale, 14, false).rgb;
half3 C4 = SceneTextureLookup(UV + float2(0, 1) * TexelScale, 14, 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_14.MaterialExpressionCustom_3"'))
      Inputs(1)=(InputName="Color",Input=(Expression=MaterialExpressionSceneTexture'"MaterialGraphNode_12.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_15.MaterialExpressionMultiply_5"'))
      MaterialExpressionEditorX=-32
      MaterialExpressionEditorY=32
      MaterialExpressionGuid=210EEB4F41C620C4310A67981D9E4E41
      Material=PreviewMaterial'"/Engine/Transient.SharpenAA_PP"'
   End Object
   MaterialExpression=MaterialExpressionCustom'"MaterialExpressionCustom_1"'
   NodePosX=-32
   NodePosY=32
   NodeGuid=6E66F2944ABFCB078A1458B015BDE232
   CustomProperties Pin (PinId=1E8274F9463A5445C483F89DF1E1A64D,PinName="UV",PinType.PinCategory="required",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_14 3F1176814F08059635F0A28F2CA63E51,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=27CEF40944DFCB566985B3879DF74B9D,PinName="Color",PinType.PinCategory="required",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_12 029E0FBB459FDC19629173BCB74D9E1A,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=A6B852F045E0313838C6F1A1DCB865C7,PinName="TexelScale",PinType.PinCategory="required",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_9 99487C3F484C3EA616B6BE9E7BC2CE85,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=D33B4B8F4F843CB84D80EA9F8F711EED,PinName="SharpenWeight",PinType.PinCategory="required",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,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=5571B0724700DA11FC0EE98D022A706D,PinName="Output",PinFriendlyName=NSLOCTEXT("MaterialGraphNode", "Space", " "),Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_Root_0 89A5C12C411E3F2B749B64867CFEE90F,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
End Object
Begin Object Class=/Script/UnrealEd.MaterialGraphNode Name="MaterialGraphNode_20"
   Begin Object Class=/Script/Engine.MaterialExpressionMultiply Name="MaterialExpressionMultiply_1"
   End Object
   Begin Object Name="MaterialExpressionMultiply_1"
      A=(Expression=MaterialExpressionScalarParameter'"MaterialGraphNode_24.MaterialExpressionScalarParameter_3"')
      B=(Expression=MaterialExpressionMultiply'"MaterialGraphNode_17.MaterialExpressionMultiply_0"')
      MaterialExpressionEditorX=-416
      MaterialExpressionEditorY=48
      MaterialExpressionGuid=496ED3774D80B9675B16C184580C9CE5
      Material=PreviewMaterial'"/Engine/Transient.SharpenAA_PP"'
   End Object
   MaterialExpression=MaterialExpressionMultiply'"MaterialExpressionMultiply_1"'
   NodePosX=-416
   NodePosY=48
   NodeGuid=9333AABD40A759F935AC7B8BB97E71BC
   CustomProperties Pin (PinId=6BA877174F053E46490A20BEC8D9F9AB,PinName="A",PinType.PinCategory="optional",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_24 33A8022C48773D9E7ED2B1804359D9D9,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=B1FEBEAD4FC0ED81D615F4980327B916,PinName="B",PinType.PinCategory="optional",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_17 78EF54AE40768ACA31603A8B6A7BE292,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=4774A9F14C05755D9424A49F507F9909,PinName="Output",PinFriendlyName=NSLOCTEXT("MaterialGraphNode", "Space", " "),Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,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_12"
   Begin Object Class=/Script/Engine.MaterialExpressionSceneTexture Name="MaterialExpressionSceneTexture_0"
   End Object
   Begin Object Name="MaterialExpressionSceneTexture_0"
      SceneTextureId=PPI_PostProcessInput0
      MaterialExpressionEditorX=-1344
      MaterialExpressionEditorY=304
      MaterialExpressionGuid=2683E4664DE80A68DDCABEBA11B373AD
      Material=PreviewMaterial'"/Engine/Transient.SharpenAA_PP"'
   End Object
   MaterialExpression=MaterialExpressionSceneTexture'"MaterialExpressionSceneTexture_0"'
   NodePosX=-1344
   NodePosY=304
   NodeGuid=16B8E4EE4F3653067EED6EB7528E12B6
   CustomProperties Pin (PinId=1E711BE34561D4FEEE0649907D25A4ED,PinName="UVs",PinType.PinCategory="optional",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,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=029E0FBB459FDC19629173BCB74D9E1A,PinName="Color",Direction="EGPD_Output",PinType.PinCategory="mask",PinType.PinSubCategory="rgba",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_19 27CEF40944DFCB566985B3879DF74B9D,MaterialGraphNode_23 933D723F4347B4DF4C1AF4950A97D062,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=6B3A30A44C97D79EE6E98FA56FE88BEF,PinName="Size",Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,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=B0C5025B4C52C01B0E029EB0DA7A4C3E,PinName="InvSize",Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,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_21"
   Begin Object Class=/Script/Engine.MaterialExpressionSceneTexture Name="MaterialExpressionSceneTexture_1"
   End Object
   Begin Object Name="MaterialExpressionSceneTexture_1"
      SceneTextureId=PPI_SceneDepth
      MaterialExpressionEditorX=-1344
      MaterialExpressionEditorY=144
      MaterialExpressionGuid=2683E4664DE80A68DDCABEBA11B373AD
      Material=PreviewMaterial'"/Engine/Transient.SharpenAA_PP"'
   End Object
   MaterialExpression=MaterialExpressionSceneTexture'"MaterialExpressionSceneTexture_1"'
   NodePosX=-1344
   NodePosY=144
   NodeGuid=0D90796F40063722F1021EA1C74C4457
   CustomProperties Pin (PinId=8DF878D84AD72A95DBE5A3ADAE7F1222,PinName="UVs",PinType.PinCategory="optional",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,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=FDB86419407AB4938B9BA0A0472EF868,PinName="Color",Direction="EGPD_Output",PinType.PinCategory="mask",PinType.PinSubCategory="rgba",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_22 3D4FA16E43C1073EB17671A4AF45E59F,MaterialGraphNode_11 14B429C046A073AEE665EFB258A84CF7,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=B89AE6E94B832F8EE6B395B1FEE70BF8,PinName="Size",Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,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=3F03BBD84CE75DD2CF246AB702804CED,PinName="InvSize",Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,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_14"
   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=-1344
      MaterialExpressionEditorY=-64
      MaterialExpressionGuid=1DBC64204F255784608569B4A9C11C32
      Material=PreviewMaterial'"/Engine/Transient.SharpenAA_PP"'
      bCollapsed=True
   End Object
   MaterialExpression=MaterialExpressionCustom'"MaterialExpressionCustom_3"'
   NodePosX=-1344
   NodePosY=-64
   NodeGuid=C94E7E20442B494DFC4F5CA4D009C4AD
   CustomProperties Pin (PinId=3F1176814F08059635F0A28F2CA63E51,PinName="Output",PinFriendlyName=NSLOCTEXT("MaterialGraphNode", "Space", " "),Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_19 1E8274F9463A5445C483F89DF1E1A64D,MaterialGraphNode_22 F648948949293967719DFBB82A06C6EA,MaterialGraphNode_23 AE244C024AC55C19C56313A49C188087,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
End Object
Begin Object Class=/Script/UnrealEd.MaterialGraphNode Name="MaterialGraphNode_22"
   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_14.MaterialExpressionCustom_3"'))
      Inputs(1)=(InputName="TexelScale",Input=(Expression=MaterialExpressionCustom'"MaterialGraphNode_9.MaterialExpressionCustom_17"'))
      Inputs(2)=(InputName="Depth",Input=(Expression=MaterialExpressionSceneTexture'"MaterialGraphNode_21.MaterialExpressionSceneTexture_1"',Mask=1,MaskR=1,MaskG=1,MaskB=1,MaskA=1))
      MaterialExpressionEditorX=-848
      MaterialExpressionEditorY=-48
      MaterialExpressionGuid=EE6165774BB2AA315508A28D434EE6B4
      Material=PreviewMaterial'"/Engine/Transient.SharpenAA_PP"'
   End Object
   MaterialExpression=MaterialExpressionCustom'"MaterialExpressionCustom_4"'
   NodePosX=-848
   NodePosY=-48
   NodeGuid=A2CF26F446E77DF6450B65B0D5D19565
   CustomProperties Pin (PinId=F648948949293967719DFBB82A06C6EA,PinName="UV",PinType.PinCategory="required",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_14 3F1176814F08059635F0A28F2CA63E51,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=BE588E0E48A077DC7D51048EE3030B6B,PinName="TexelScale",PinType.PinCategory="required",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_9 99487C3F484C3EA616B6BE9E7BC2CE85,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=3D4FA16E43C1073EB17671A4AF45E59F,PinName="Depth",PinType.PinCategory="required",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_21 FDB86419407AB4938B9BA0A0472EF868,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=AA040AEA4EBF243130F7A286E14D40CC,PinName="Output",PinFriendlyName=NSLOCTEXT("MaterialGraphNode", "Space", " "),Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_17 60B5D4A74B89A512EC1666B7B346139D,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
End Object
Begin Object Class=/Script/UnrealEd.MaterialGraphNode Name="MaterialGraphNode_23"
   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, 14, false).rgb;
half3 C2 = SceneTextureLookup(UV + float2(0, -1) * TexelScale, 14, false).rgb;
half3 C3 = SceneTextureLookup(UV + float2(1, 0) * TexelScale, 14, false).rgb;
half3 C4 = SceneTextureLookup(UV + float2(0, 1) * TexelScale, 14, 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_14.MaterialExpressionCustom_3"'))
      Inputs(1)=(InputName="TexelScale",Input=(Expression=MaterialExpressionCustom'"MaterialGraphNode_9.MaterialExpressionCustom_17"'))
      Inputs(2)=(InputName="Color",Input=(Expression=MaterialExpressionSceneTexture'"MaterialGraphNode_12.MaterialExpressionSceneTexture_0"',Mask=1,MaskR=1,MaskG=1,MaskB=1,MaskA=1))
      MaterialExpressionEditorX=-848
      MaterialExpressionEditorY=160
      MaterialExpressionGuid=EE6165774BB2AA315508A28D434EE6B4
      Material=PreviewMaterial'"/Engine/Transient.SharpenAA_PP"'
   End Object
   MaterialExpression=MaterialExpressionCustom'"MaterialExpressionCustom_5"'
   NodePosX=-848
   NodePosY=160
   NodeGuid=49F7C1EC4082C5F90CDBA6BE5F9C2BC6
   CustomProperties Pin (PinId=AE244C024AC55C19C56313A49C188087,PinName="UV",PinType.PinCategory="required",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_14 3F1176814F08059635F0A28F2CA63E51,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=220FB01D42A098DDAD6B1ABA703168B8,PinName="TexelScale",PinType.PinCategory="required",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_9 99487C3F484C3EA616B6BE9E7BC2CE85,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=933D723F4347B4DF4C1AF4950A97D062,PinName="Color",PinType.PinCategory="required",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_12 029E0FBB459FDC19629173BCB74D9E1A,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=6C4CBDE141215FE35D1743998AE74B0E,PinName="Output",PinFriendlyName=NSLOCTEXT("MaterialGraphNode", "Space", " "),Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_17 B04EA0454B621B85D3AF1687C472108E,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
End Object
Begin Object Class=/Script/UnrealEd.MaterialGraphNode Name="MaterialGraphNode_17"
   Begin Object Class=/Script/Engine.MaterialExpressionMultiply Name="MaterialExpressionMultiply_0"
   End Object
   Begin Object Name="MaterialExpressionMultiply_0"
      A=(Expression=MaterialExpressionCustom'"MaterialGraphNode_22.MaterialExpressionCustom_4"')
      B=(Expression=MaterialExpressionCustom'"MaterialGraphNode_23.MaterialExpressionCustom_5"')
      ConstA=1.000000
      MaterialExpressionEditorX=-576
      MaterialExpressionEditorY=48
      MaterialExpressionGuid=11F9E406498F65354096FE8D4F3A0217
      Material=PreviewMaterial'"/Engine/Transient.SharpenAA_PP"'
   End Object
   MaterialExpression=MaterialExpressionMultiply'"MaterialExpressionMultiply_0"'
   NodePosX=-576
   NodePosY=48
   NodeGuid=E807A32A4B3EBDEEFA24EF894AEC16C6
   CustomProperties Pin (PinId=60B5D4A74B89A512EC1666B7B346139D,PinName="A",PinType.PinCategory="optional",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_22 AA040AEA4EBF243130F7A286E14D40CC,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=B04EA0454B621B85D3AF1687C472108E,PinName="B",PinType.PinCategory="optional",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_23 6C4CBDE141215FE35D1743998AE74B0E,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=78EF54AE40768ACA31603A8B6A7BE292,PinName="Output",PinFriendlyName=NSLOCTEXT("MaterialGraphNode", "Space", " "),Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_20 B1FEBEAD4FC0ED81D615F4980327B916,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
End Object
Begin Object Class=/Script/UnrealEd.MaterialGraphNode Name="MaterialGraphNode_24"
   Begin Object Class=/Script/Engine.MaterialExpressionScalarParameter Name="MaterialExpressionScalarParameter_3"
   End Object
   Begin Object Name="MaterialExpressionScalarParameter_3"
      DefaultValue=0.500000
      ParameterName="SharpenWeight"
      ExpressionGUID=B6584DF848C79111BDE8CEA9B2082A38
      MaterialExpressionEditorX=-624
      MaterialExpressionEditorY=-112
      MaterialExpressionGuid=19D9205140F703E91D51EAADB938BD72
      Material=PreviewMaterial'"/Engine/Transient.SharpenAA_PP"'
   End Object
   MaterialExpression=MaterialExpressionScalarParameter'"MaterialExpressionScalarParameter_3"'
   NodePosX=-624
   NodePosY=-112
   bCanRenameNode=True
   NodeGuid=809812754C79E34A1FF0CF956736D2F3
   CustomProperties Pin (PinId=33A8022C48773D9E7ED2B1804359D9D9,PinName="Output",PinFriendlyName=NSLOCTEXT("MaterialGraphNode", "Space", " "),Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_20 6BA877174F053E46490A20BEC8D9F9AB,),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=-1344
      MaterialExpressionEditorY=32
      MaterialExpressionGuid=99D774D54CC0E5C8D02B37991F61BC9E
      Material=PreviewMaterial'"/Engine/Transient.SharpenAA_PP"'
      bCollapsed=True
   End Object
   MaterialExpression=MaterialExpressionCustom'"MaterialExpressionCustom_17"'
   NodePosX=-1344
   NodePosY=32
   NodeGuid=D581490E444B69CFF24A38ADF67DB609
   CustomProperties Pin (PinId=99487C3F484C3EA616B6BE9E7BC2CE85,PinName="Output",PinFriendlyName=NSLOCTEXT("MaterialGraphNode", "Space", " "),Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_19 A6B852F045E0313838C6F1A1DCB865C7,MaterialGraphNode_22 BE588E0E48A077DC7D51048EE3030B6B,MaterialGraphNode_23 220FB01D42A098DDAD6B1ABA703168B8,),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_1"
   End Object
   Begin Object Name="MaterialExpressionDivide_1"
      A=(Expression=MaterialExpressionSceneTexture'"MaterialGraphNode_21.MaterialExpressionSceneTexture_1"',Mask=1,MaskR=1,MaskG=1,MaskB=1,MaskA=1)
      B=(Expression=MaterialExpressionScalarParameter'"MaterialGraphNode_18.MaterialExpressionScalarParameter_2"')
      ConstB=5000.000000
      MaterialExpressionEditorX=-800
      MaterialExpressionEditorY=336
      MaterialExpressionGuid=C37E3BF445B02C5974D57EA3772DA61B
      Material=PreviewMaterial'"/Engine/Transient.SharpenAA_PP"'
   End Object
   MaterialExpression=MaterialExpressionDivide'"MaterialExpressionDivide_1"'
   NodePosX=-800
   NodePosY=336
   NodeGuid=308A7FEE4ADBF77CE05EDF8DBA7EFE9B
   CustomProperties Pin (PinId=14B429C046A073AEE665EFB258A84CF7,PinName="A",PinType.PinCategory="optional",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_21 FDB86419407AB4938B9BA0A0472EF868,),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.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=NSLOCTEXT("MaterialGraphNode", "Space", " "),Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,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_1"
   End Object
   Begin Object Name="MaterialExpressionClamp_1"
      Input=(Expression=MaterialExpressionOneMinus'"MaterialGraphNode_16.MaterialExpressionOneMinus_1"')
      MaterialExpressionEditorX=-576
      MaterialExpressionEditorY=336
      MaterialExpressionGuid=6FF90D0644A7E453A75FDA8D68C9ACBA
      Material=PreviewMaterial'"/Engine/Transient.SharpenAA_PP"'
   End Object
   MaterialExpression=MaterialExpressionClamp'"MaterialExpressionClamp_1"'
   NodePosX=-576
   NodePosY=336
   NodeGuid=310177724EBB98D594A31A941128FC7F
   CustomProperties Pin (PinId=7D5F35454C28AFAB4A707187C71C6B32,PinName="Input",PinFriendlyName=NSLOCTEXT("MaterialGraphNode", "Space", " "),PinType.PinCategory="required",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,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.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.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=NSLOCTEXT("MaterialGraphNode", "Space", " "),Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,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_16"
   Begin Object Class=/Script/Engine.MaterialExpressionOneMinus Name="MaterialExpressionOneMinus_1"
   End Object
   Begin Object Name="MaterialExpressionOneMinus_1"
      Input=(Expression=MaterialExpressionDivide'"MaterialGraphNode_11.MaterialExpressionDivide_1"')
      MaterialExpressionEditorX=-656
      MaterialExpressionEditorY=336
      MaterialExpressionGuid=0230478341A7584BDE577E90465C4F4E
      Material=PreviewMaterial'"/Engine/Transient.SharpenAA_PP"'
   End Object
   MaterialExpression=MaterialExpressionOneMinus'"MaterialExpressionOneMinus_1"'
   NodePosX=-656
   NodePosY=336
   NodeGuid=18FD6A80487C87A618806797DD1A6D61
   CustomProperties Pin (PinId=6264B4294C89F0C16140B4B80BFB32A5,PinName="Input",PinFriendlyName=NSLOCTEXT("MaterialGraphNode", "Space", " "),PinType.PinCategory="required",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,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=NSLOCTEXT("MaterialGraphNode", "Space", " "),Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,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_2"
   End Object
   Begin Object Name="MaterialExpressionScalarParameter_2"
      DefaultValue=5000.000000
      ParameterName="DistanceFadeOff"
      ExpressionGUID=CD9859F347A689F65F34C6BEE6D5009B
      MaterialExpressionEditorX=-1008
      MaterialExpressionEditorY=464
      MaterialExpressionGuid=9F095F064FD556E5621FDE99EF46CA46
      Material=PreviewMaterial'"/Engine/Transient.SharpenAA_PP"'
   End Object
   MaterialExpression=MaterialExpressionScalarParameter'"MaterialExpressionScalarParameter_2"'
   NodePosX=-1008
   NodePosY=464
   bCanRenameNode=True
   NodeGuid=17A9E7C4469F4F9ACC364EB26C563224
   CustomProperties Pin (PinId=3C907B2F4E17772B623FA0928DFB9977,PinName="Output",PinFriendlyName=NSLOCTEXT("MaterialGraphNode", "Space", " "),Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,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
Begin Object Class=/Script/UnrealEd.MaterialGraphNode Name="MaterialGraphNode_15"
   Begin Object Class=/Script/Engine.MaterialExpressionMultiply Name="MaterialExpressionMultiply_5"
   End Object
   Begin Object Name="MaterialExpressionMultiply_5"
      A=(Expression=MaterialExpressionMultiply'"MaterialGraphNode_20.MaterialExpressionMultiply_1"')
      B=(Expression=MaterialExpressionClamp'"MaterialGraphNode_13.MaterialExpressionClamp_1"')
      MaterialExpressionEditorX=-224
      MaterialExpressionEditorY=160
      MaterialExpressionGuid=AE5CEDE5458D219B3A323DAB31146F37
      Material=PreviewMaterial'"/Engine/Transient.SharpenAA_PP"'
   End Object
   MaterialExpression=MaterialExpressionMultiply'"MaterialExpressionMultiply_5"'
   NodePosX=-224
   NodePosY=160
   NodeGuid=A30BAD1D4CF612BE890762BF98DA7674
   CustomProperties Pin (PinId=60398C164E2F92146661DF8E6CB24D0C,PinName="A",PinType.PinCategory="optional",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_20 4774A9F14C05755D9424A49F507F9909,),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.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=NSLOCTEXT("MaterialGraphNode", "Space", " "),Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_19 D33B4B8F4F843CB84D80EA9F8F711EED,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
End Object


Thank you! This fixed my weird brightness bug (that I posted earlier)!

just for future reference, you can highlight selected parts of a post and then hit the quote button to just quote that text rather than the entire wall of text :slight_smile: helps keep the forums neater!

Whoops, sorry! I didn’t think about that.

It looks broken in 4.24 with both 0 and 14. But I met some good sharpen material in the Chameleon Post Process pack. With a mask from this Depth node, it looks even better.
Some tests: Chameleon Sharpen - Imgsli

Looks like it doesn’t work with 4.24 indeed.

UE4 has changed how you access texture samples in the post process materials.

I made a new version that is relying solely on luminance. Here are some comparisons: Imgsli
PS: Remember to set the Blendable location to After tonemapping.
PS2: 0.25 seems to give a good natural sharpen result.


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="float2 SceneUV = GetSceneTextureUV(Parameters);
float2 TexelScale = View.BufferSizeAndInvSize.zw;

half3 C1 = SceneTextureLookup(SceneUV + float2(-1, 0) * TexelScale, 14, false).rgb;
half3 C2 = SceneTextureLookup(SceneUV + float2(0, -1) * TexelScale, 14, false).rgb;
half3 C3 = SceneTextureLookup(SceneUV + float2(1, 0) * TexelScale, 14, false).rgb;
half3 C4 = SceneTextureLookup(SceneUV + float2(0, 1) * TexelScale, 14, false).rgb;
half3 C5 = SceneTextureLookup(SceneUV + float2(-1, -1) * TexelScale, 14, false).rgb;
half3 C6 = SceneTextureLookup(SceneUV + float2(1, -1) * TexelScale, 14, false).rgb;
half3 C7 = SceneTextureLookup(SceneUV + float2(1, 1) * TexelScale, 14, false).rgb;
half3 C8 = SceneTextureLookup(SceneUV + float2(-1, 1) * TexelScale, 14, false).rgb;


// Luminance edge detection

half A0 = Luminance(SceneColor);
half CL1 = Luminance(C1);
half L1 = ((max(CL1, A0)) / (min(CL1, A0)) - 1);

half CL2 = Luminance(C2);
half L2 = ((max(CL2, A0)) / (min(CL2, A0)) - 1);

half CL3 = Luminance(C3);
half L3 = ((max(CL3, A0)) / (min(CL3, A0)) - 1);

half CL4 = Luminance(C4);
half L4 = ((max(CL4, A0)) / (min(CL4, A0)) - 1);

half CL5 = Luminance(C5);
half L5 = ((max(CL5, A0)) / (min(CL5, A0)) - 1);

half CL6 = Luminance(C6);
half L6 = ((max(CL6, A0)) / (min(CL6, A0)) - 1);

half CL7 = Luminance(C7);
half L7 = ((max(CL7, A0)) / (min(CL7, A0)) - 1);

half CL8 = Luminance(C8);
half L8 = ((max(CL8, A0)) / (min(CL8, A0)) - 1);

half NeighborDifference = max(max(max(L1, L2), max(L3, L4)), max(max(L5, L6), max(L7, L8)));
half SharpenMask = 1.0f - clamp(NeighborDifference, 0.0f, LuminanceWeight);
SharpenMask *= SharpenMask * SharpenMask;
//return SharpenMask;


// Sharpen

half SharpenWeight = Strength * SharpenMask;
half4 LuminanceNeightbors = half4(CL1, CL2, CL3, CL4);
half4 LuminanceNeightbors2 = half4(CL5, CL6, CL7, CL8);
half4 A0LuminanceNeightbors = abs(A0 - LuminanceNeightbors);
half4 A0LuminanceNeightbors2 = abs(A0 - LuminanceNeightbors2);
half A0Max = max(max(A0LuminanceNeightbors.r, A0LuminanceNeightbors.g), max(A0LuminanceNeightbors.b, A0LuminanceNeightbors.a));
half A0Max2 = max(max(A0LuminanceNeightbors2.r, A0LuminanceNeightbors2.g), max(A0LuminanceNeightbors2.b, A0LuminanceNeightbors2.a));
half HDREdge = max(A0Max, A0Max2);
half EdgeMask = saturate(1.0f - HDREdge);
half LerpFactor = -EdgeMask * SharpenWeight;
half3 DeltaColor = (C1 + C2 + C3 + C4 + C5 + C6 + C7 + C8) - SceneColor * 8;
SceneColor.rgb += DeltaColor * LerpFactor;
return SceneColor;"
Description="Code"
Inputs(0)=(InputName="SceneColor",Input=(Expression=MaterialExpressionSceneTexture'"MaterialGraphNode_2.MaterialExpressionSceneTexture_0"',Mask=1,MaskR=1,MaskG=1,MaskB=1,MaskA=1))
Inputs(1)=(InputName="Strength",Input=(Expression=MaterialExpressionScalarParameter'"MaterialGraphNode_1.MaterialExpressionScalarParameter_0"'))
Inputs(2)=(InputName="LuminanceWeight",Input=(Expression=MaterialExpressionScalarParameter'"MaterialGraphNode_3.MaterialExpressionScalarParameter_1"'))
MaterialExpressionEditorX=-384
MaterialExpressionGuid=32CA673F4C384537430A35BD6D79D525
Material=PreviewMaterial'"/Engine/Transient.M_Lumi_Sharpen_2"'
End Object
MaterialExpression=MaterialExpressionCustom'"MaterialExpressionCustom_0"'
NodePosX=-384
NodeGuid=2609CF904C9265E0149CA7ABB90DF3D4
CustomProperties Pin (PinId=54A4AAD042DB1D7B80850EB023451DF6,PinName="SceneColor",PinType.PinCategory="required",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_2 50D4F0744B8FCBCC139B34AE65FA7D9A,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=03563E3748438B24C9F696B70DBFB089,PinName="Strength",PinType.PinCategory="required",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_1 0AE6AB104D713A5EDAB05DAE86BE8280,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=E2596B3D4CDC3B87E54AAD824A68F50F,PinName="LuminanceWeight",PinType.PinCategory="required",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_3 C0A718BB4861BA1D12472BA3BF0612F9,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=0EF8A43149F3C43F07FB57A437A14DED,PinName="Output",PinFriendlyName=NSLOCTEXT("MaterialGraphNode", "Space", " "),Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_Root_0 53C1388A4E5F2407C8658FA9C27654BC,),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.MaterialExpressionScalarParameter Name="MaterialExpressionScalarParameter_0"
End Object
Begin Object Name="MaterialExpressionScalarParameter_0"
DefaultValue=0.250000
SliderMax=2.000000
ParameterName="Strength"
ExpressionGUID=F5F85BB14AF92F827CC8668E31FB3938
MaterialExpressionEditorX=-768
MaterialExpressionEditorY=176
MaterialExpressionGuid=4E2152CE4CBC588D96DE5CABA56973C6
Material=PreviewMaterial'"/Engine/Transient.M_Lumi_Sharpen_2"'
End Object
MaterialExpression=MaterialExpressionScalarParameter'"MaterialExpressionScalarParameter_0"'
NodePosX=-768
NodePosY=176
bCanRenameNode=True
NodeGuid=9355C11944C54286ED09019D2B5A95C9
CustomProperties Pin (PinId=0AE6AB104D713A5EDAB05DAE86BE8280,PinName="Output",PinFriendlyName=NSLOCTEXT("MaterialGraphNode", "Space", " "),Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_0 03563E3748438B24C9F696B70DBFB089,),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=-768
MaterialExpressionGuid=2683E4664DE80A68DDCABEBA11B373AD
Material=PreviewMaterial'"/Engine/Transient.M_Lumi_Sharpen_2"'
End Object
MaterialExpression=MaterialExpressionSceneTexture'"MaterialExpressionSceneTexture_0"'
NodePosX=-768
NodeGuid=BF8A68B147F36CEA1E38CA91807D871B
CustomProperties Pin (PinId=AA55FF7C4237F466FFDAD6BC27575300,PinName="UVs",PinType.PinCategory="optional",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,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=50D4F0744B8FCBCC139B34AE65FA7D9A,PinName="Color",Direction="EGPD_Output",PinType.PinCategory="mask",PinType.PinSubCategory="rgba",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_0 54A4AAD042DB1D7B80850EB023451DF6,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=67478990479AD78A1596D3B6296390DC,PinName="Size",Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,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=FA965C2045E0551F26168A9485FC27BA,PinName="InvSize",Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,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.MaterialExpressionScalarParameter Name="MaterialExpressionScalarParameter_1"
End Object
Begin Object Name="MaterialExpressionScalarParameter_1"
DefaultValue=0.500000
SliderMax=1.000000
ParameterName="LuminanceWeight"
ExpressionGUID=5B9E5D0B4BCC048A9544D8A3E28AC234
MaterialExpressionEditorX=-768
MaterialExpressionEditorY=304
MaterialExpressionGuid=4E2152CE4CBC588D96DE5CABA56973C6
Material=PreviewMaterial'"/Engine/Transient.M_Lumi_Sharpen_2"'
End Object
MaterialExpression=MaterialExpressionScalarParameter'"MaterialExpressionScalarParameter_1"'
NodePosX=-768
NodePosY=304
bCanRenameNode=True
NodeGuid=C4432D73408F78161E5215AF8E84973F
CustomProperties Pin (PinId=C0A718BB4861BA1D12472BA3BF0612F9,PinName="Output",PinFriendlyName=NSLOCTEXT("MaterialGraphNode", "Space", " "),Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_0 E2596B3D4CDC3B87E54AAD824A68F50F,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
End Object


2 Likes

Some examples with the code above:

https://i.imgsli.com/images/7e25fe83-448b-4c24-8dd7-7340c9ef2892.png

2 Likes

Any luck with the latest code above? Got some great results locally! :slight_smile:

Hello, it works excellent, I was seeing one of your works about “Anti Ghosting” any update on it?

Sweet! I was relying on this to make things less blurry while using DOF in the past and was bummed out when it didn’t work with 4.24 and 4.25, but now my project is back to no compromises!

Hi Hallatore. where do you paste this code?

I’m struggling with Media Texture… video streaming/playback on a plane seems to be badly affected with TAA as the actor’s has no velocity ( media texture ). do you have a solution on this?

**skybala, **you need just to create a new material and paste the code there :).

Hi @hallatore ,

So incredible the post process material you have created! Great results over here.

Only one thing, please: if you have a Pawn with the option Constrains Aspect Ratio checked and you press the Play button (and not executed in fullscreen), it generates something like an ‘offseted’ mask, like taking into account the very beginning of the viewport, instead of the beginning of the image itself, which is between the sides black bars (due to constrained aspect ratio).

Please, do you think you could know what’s happening?

Thank you again! This is a MUST have :slight_smile:

Hey, @hallatore, still can’t thank you enough for this, I have a small question, is there a way to make this work with a screen percentage that’s not 100? In editor at least, any value above or below creates an offset effect and breaks the sharpen on close objects, but still sharpens distant ones.

Before sharpen

After sharpen @ 100%

After sharpen @ 101% (no sharpen on the rock, new ghosting on the background trees)

Hi guys,
the only solution I found is to replace “GetSceneTextureUV(Parameters)” with “GetDefaultSceneTextureUV(Parameters,14)”

Hope this solves your aspect ratio problem.

Just tried this, and it works if real-time is off with any render resolution, so it’s a step in the right direction for my issue. But as soon as I enable real-time, the sharpening disappears. When render resolution is set to 100, it works great.

Edit: nevermind, I got it working, I’m just stupid :slight_smile: I really need to spend a few weeks digging into HLSL and custom material expressions. Thanks for the help
S marrocco.

It doesn’t work for me in 4.26.2 apparently, but maybe I did something wrong. It return white screen.

same, I wonder what that’s about