Nanite and tessellation in UE5 - Smooth displacement on landscapes

How to enable Nanite tessellation

  1. Open <project_folder>/Config/DefaultEngine.ini
  2. Add the following under [/Script/Engine.RendererSettings]
    • r.Nanite.AllowTessellation=1
    • r.Nanite.Tessellation=1

Landscape example

  1. On your landscape in editor, check Enable Nanite (Note: If you do major changes you need to hit Rebuild next to this checkbox from time to time)
  2. In your landscape material, check Enable tessellation
  3. In your landscape material, hook up the Displacement node to your displacement texture sample.


Remove tessellation artifacts/Smooth the displacement

Note: This will hopefully be fixed/improved in a later version of UE5.

If you have enabled displacement you can often see artifacts when close to the material. To avoid this we can smooth out the displacement sampling.

Before:

After:

  • Make a material function called MF_BlurTextureSample
  • Make sure Expose to library is checked
  • Paste the following code
Begin Object Class=/Script/UnrealEd.MaterialGraphNode Name="MaterialGraphNode_0" ExportPath="/Script/UnrealEd.MaterialGraphNode'/Engine/Transient.Material_1:MaterialGraph_0.MaterialGraphNode_0'"
   Begin Object Class=/Script/Engine.MaterialExpressionFunctionOutput Name="MaterialExpressionFunctionOutput_0" ExportPath="/Script/Engine.MaterialExpressionFunctionOutput'/Engine/Transient.Material_1:MaterialGraph_0.MaterialGraphNode_0.MaterialExpressionFunctionOutput_0'"
   End Object
   Begin Object Name="MaterialExpressionFunctionOutput_0" ExportPath="/Script/Engine.MaterialExpressionFunctionOutput'/Engine/Transient.Material_1:MaterialGraph_0.MaterialGraphNode_0.MaterialExpressionFunctionOutput_0'"
      A=(Expression="/Script/Engine.MaterialExpressionMaterialFunctionCall'MaterialGraphNode_1.MaterialExpressionMaterialFunctionCall_3'")
      bLastPreviewed=True
      Id=25E119A14E6FE050199C4C8E5E0CEC72
      MaterialExpressionEditorX=192
      MaterialExpressionEditorY=96
      MaterialExpressionGuid=4537657A4D9FEFD0D5F13ABE7AFDC679
      Material="/Script/Engine.Material'/Engine/Transient.Material_1'"
   End Object
   MaterialExpression="/Script/Engine.MaterialExpressionFunctionOutput'MaterialExpressionFunctionOutput_0'"
   NodePosX=192
   NodePosY=96
   NodeGuid=896885A74C3AC50D0D68E4AC5C3F0B3F
   CustomProperties Pin (PinId=F22FF35B4F0EE5AD39590D92137472AE,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,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,LinkedTo=(MaterialGraphNode_1 B637D33F403360A51A0292B4833F1332,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=FA45B8CC4E7E728DDAF11D9FD7B60C4A,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,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=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_1" ExportPath="/Script/UnrealEd.MaterialGraphNode'/Engine/Transient.Material_1:MaterialGraph_0.MaterialGraphNode_1'"
   Begin Object Class=/Script/Engine.MaterialExpressionMaterialFunctionCall Name="MaterialExpressionMaterialFunctionCall_3" ExportPath="/Script/Engine.MaterialExpressionMaterialFunctionCall'/Engine/Transient.Material_1:MaterialGraph_0.MaterialGraphNode_1.MaterialExpressionMaterialFunctionCall_3'"
   End Object
   Begin Object Name="MaterialExpressionMaterialFunctionCall_3" ExportPath="/Script/Engine.MaterialExpressionMaterialFunctionCall'/Engine/Transient.Material_1:MaterialGraph_0.MaterialGraphNode_1.MaterialExpressionMaterialFunctionCall_3'"
      MaterialFunction="/Script/Engine.MaterialFunction'/Engine/Functions/Engine_MaterialFunctions01/Texturing/SpiralBlur-Texture.SpiralBlur-Texture'"
      FunctionInputs(0)=(ExpressionInputId=4BF03A9043B9EDCA764E998BB287F5B3,Input=(Expression="/Script/Engine.MaterialExpressionFunctionInput'MaterialGraphNode_6.MaterialExpressionFunctionInput_2'",InputName="TextureObject"))
      FunctionInputs(1)=(ExpressionInputId=7A92718048B8283B141C7E995006F0F9,Input=(Expression="/Script/Engine.MaterialExpressionFunctionInput'MaterialGraphNode_5.MaterialExpressionFunctionInput_1'",InputName="UV"))
      FunctionInputs(2)=(ExpressionInputId=7CC6063741354B194A27C5BFBF5AEFC6,Input=(Expression="/Script/Engine.MaterialExpressionDivide'MaterialGraphNode_2.MaterialExpressionDivide_1'",InputName="Distance"))
      FunctionInputs(3)=(ExpressionInputId=999268474CE8F923FC5CA297555C451B,Input=(Expression="/Script/Engine.MaterialExpressionConstant'MaterialGraphNode_7.MaterialExpressionConstant_0'",InputName="Distance Steps"))
      FunctionInputs(4)=(ExpressionInputId=2D450737453F92D15333EDA2A8A9C9FB,Input=(InputName="Radial Steps"))
      FunctionInputs(5)=(ExpressionInputId=E0C339BD412802ACF8D1CFA66E382F99,Input=(InputName="Radial Offset"))
      FunctionInputs(6)=(ExpressionInputId=729AEDD6469F6A91D595A0B2471F510C,Input=(InputName="Kernel Power"))
      FunctionOutputs(0)=(ExpressionOutputId=F121DEB046D973F044644E80BD424FF0,Output=(OutputName="Result"))
      MaterialExpressionEditorX=-160
      MaterialExpressionEditorY=96
      MaterialExpressionGuid=56618507435CD5A0D659889DCB460583
      Material="/Script/Engine.Material'/Engine/Transient.Material_1'"
      Outputs(0)=(OutputName="Result")
   End Object
   MaterialExpression="/Script/Engine.MaterialExpressionMaterialFunctionCall'MaterialExpressionMaterialFunctionCall_3'"
   NodePosX=-160
   NodePosY=96
   NodeGuid=90124DE045E0969C852E6099EE95E70F
   CustomProperties Pin (PinId=126C00E24FF48B060DF9DD998D8CEF1C,PinName="TextureObject (T2d)",PinType.PinCategory="required",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,LinkedTo=(MaterialGraphNode_6 F8E488CD4C399ED294DC25A582E0B622,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=F3F8B0E042B1909F47D8C499BA4A535E,PinName="UV (V2)",PinType.PinCategory="optional",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,LinkedTo=(MaterialGraphNode_5 170459BF408F1683A04DF1933D49F416,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=2A3549EC48792933C5AABCA1839ECEF9,PinName="Distance (S)",PinType.PinCategory="optional",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,LinkedTo=(MaterialGraphNode_2 7A3678754E99C6B259901887EFD23EA6,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=0729A4E14E031A30CFFEDFB8376072DE,PinName="Distance Steps (S)",PinType.PinCategory="optional",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,LinkedTo=(MaterialGraphNode_7 6F4DD50D4B2ABAC84C515AB6F5618D54,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=8B33B1BD4015C24DA2EF6A8474987AE6,PinName="Radial Steps (S)",PinType.PinCategory="optional",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=C07C53134320D71B0C84F5BB6AAB26AF,PinName="Radial Offset (S)",PinType.PinCategory="optional",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=9E50080E4CCFD9F9FBCC9AA8E1646194,PinName="Kernel Power (S)",PinType.PinCategory="optional",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=B637D33F403360A51A0292B4833F1332,PinName="Result",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,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,LinkedTo=(MaterialGraphNode_0 F22FF35B4F0EE5AD39590D92137472AE,),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" ExportPath="/Script/UnrealEd.MaterialGraphNode'/Engine/Transient.Material_1:MaterialGraph_0.MaterialGraphNode_2'"
   Begin Object Class=/Script/Engine.MaterialExpressionDivide Name="MaterialExpressionDivide_1" ExportPath="/Script/Engine.MaterialExpressionDivide'/Engine/Transient.Material_1:MaterialGraph_0.MaterialGraphNode_2.MaterialExpressionDivide_1'"
   End Object
   Begin Object Name="MaterialExpressionDivide_1" ExportPath="/Script/Engine.MaterialExpressionDivide'/Engine/Transient.Material_1:MaterialGraph_0.MaterialGraphNode_2.MaterialExpressionDivide_1'"
      B=(Expression="/Script/Engine.MaterialExpressionMaterialFunctionCall'MaterialGraphNode_4.MaterialExpressionMaterialFunctionCall_5'")
      ConstA=4.000000
      MaterialExpressionEditorX=-352
      MaterialExpressionEditorY=496
      MaterialExpressionGuid=D704CEC944030D0F207C48BEF0952CE2
      Material="/Script/Engine.Material'/Engine/Transient.Material_1'"
   End Object
   MaterialExpression="/Script/Engine.MaterialExpressionDivide'MaterialExpressionDivide_1'"
   NodePosX=-352
   NodePosY=496
   NodeGuid=0B275C4A4FE840604D7CE9B0404B832A
   CustomProperties Pin (PinId=7191C78C4FEFE82E6B007CAE6E2048A8,PinName="A",PinType.PinCategory="optional",PinType.PinSubCategory="red",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="4.0",PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=CA09F96B4B71FAC1A49B72A1F4A61AAD,PinName="B",PinType.PinCategory="optional",PinType.PinSubCategory="red",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="2.0",LinkedTo=(MaterialGraphNode_4 79DC0FF345695C453B229196089A5777,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=7A3678754E99C6B259901887EFD23EA6,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,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,LinkedTo=(MaterialGraphNode_1 2A3549EC48792933C5AABCA1839ECEF9,),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" ExportPath="/Script/UnrealEd.MaterialGraphNode'/Engine/Transient.Material_1:MaterialGraph_0.MaterialGraphNode_3'"
   Begin Object Class=/Script/Engine.MaterialExpressionTextureProperty Name="MaterialExpressionTextureProperty_0" ExportPath="/Script/Engine.MaterialExpressionTextureProperty'/Engine/Transient.Material_1:MaterialGraph_0.MaterialGraphNode_3.MaterialExpressionTextureProperty_0'"
   End Object
   Begin Object Name="MaterialExpressionTextureProperty_0" ExportPath="/Script/Engine.MaterialExpressionTextureProperty'/Engine/Transient.Material_1:MaterialGraph_0.MaterialGraphNode_3.MaterialExpressionTextureProperty_0'"
      TextureObject=(Expression="/Script/Engine.MaterialExpressionFunctionInput'MaterialGraphNode_6.MaterialExpressionFunctionInput_2'")
      MaterialExpressionEditorX=-848
      MaterialExpressionEditorY=480
      MaterialExpressionGuid=CBD61AC54EC4D7DDC4A4B49794735FDF
      Material="/Script/Engine.Material'/Engine/Transient.Material_1'"
   End Object
   MaterialExpression="/Script/Engine.MaterialExpressionTextureProperty'MaterialExpressionTextureProperty_0'"
   NodePosX=-848
   NodePosY=480
   AdvancedPinDisplay=Hidden
   NodeGuid=708867A14B4BEC6BFC23019A96E01785
   CustomProperties Pin (PinId=0A5DF0614E68F3C6C61C2E8BCED5EA9D,PinName="Tex",PinType.PinCategory="optional",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,LinkedTo=(MaterialGraphNode_6 F8E488CD4C399ED294DC25A582E0B622,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=5F3A257A49E1FC4F14459F819D0DECCF,PinName="Texture Property",PinType.PinCategory="optional",PinType.PinSubCategory="byte",PinType.PinSubCategoryObject="/Script/CoreUObject.Enum'/Script/Engine.EMaterialExposedTextureProperty'",PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="Texture Size",PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=True,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=True,bOrphanedPin=False,)
   CustomProperties Pin (PinId=47A00A4B4C3FB46C5C2EBDA133A2B2D3,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,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,LinkedTo=(MaterialGraphNode_4 A07A32C34F1A1112792A6CA850EDA74B,),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" ExportPath="/Script/UnrealEd.MaterialGraphNode'/Engine/Transient.Material_1:MaterialGraph_0.MaterialGraphNode_4'"
   Begin Object Class=/Script/Engine.MaterialExpressionMaterialFunctionCall Name="MaterialExpressionMaterialFunctionCall_5" ExportPath="/Script/Engine.MaterialExpressionMaterialFunctionCall'/Engine/Transient.Material_1:MaterialGraph_0.MaterialGraphNode_4.MaterialExpressionMaterialFunctionCall_5'"
   End Object
   Begin Object Name="MaterialExpressionMaterialFunctionCall_5" ExportPath="/Script/Engine.MaterialExpressionMaterialFunctionCall'/Engine/Transient.Material_1:MaterialGraph_0.MaterialGraphNode_4.MaterialExpressionMaterialFunctionCall_5'"
      MaterialFunction="/Script/Engine.MaterialFunction'/Engine/Functions/Engine_MaterialFunctions02/Utility/BreakOutFloat2Components.BreakOutFloat2Components'"
      FunctionInputs(0)=(ExpressionInputId=0FC5C56B4335798F20CB928CF1C87421,Input=(Expression="/Script/Engine.MaterialExpressionTextureProperty'MaterialGraphNode_3.MaterialExpressionTextureProperty_0'",InputName="Float2"))
      FunctionOutputs(0)=(ExpressionOutputId=6BC893C247FCFC567178CE944E213385,Output=(OutputName="R"))
      FunctionOutputs(1)=(ExpressionOutputId=9720C81E449DF8E5514FCB8A80FD5FA3,Output=(OutputName="G"))
      MaterialExpressionEditorX=-624
      MaterialExpressionEditorY=496
      MaterialExpressionGuid=3C5CF6D548F39322E1379AB686FA4E97
      Material="/Script/Engine.Material'/Engine/Transient.Material_1'"
      Outputs(0)=(OutputName="R")
      Outputs(1)=(OutputName="G")
   End Object
   MaterialExpression="/Script/Engine.MaterialExpressionMaterialFunctionCall'MaterialExpressionMaterialFunctionCall_5'"
   NodePosX=-624
   NodePosY=496
   NodeGuid=3D2EAA7F4457DD4759F9F98C9001D558
   CustomProperties Pin (PinId=A07A32C34F1A1112792A6CA850EDA74B,PinName="Float2 (V2)",PinType.PinCategory="optional",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,LinkedTo=(MaterialGraphNode_3 47A00A4B4C3FB46C5C2EBDA133A2B2D3,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=79DC0FF345695C453B229196089A5777,PinName="R",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,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,LinkedTo=(MaterialGraphNode_2 CA09F96B4B71FAC1A49B72A1F4A61AAD,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=C5227D064371AF7CCABB10A348319521,PinName="G",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,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=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_5" ExportPath="/Script/UnrealEd.MaterialGraphNode'/Engine/Transient.Material_1:MaterialGraph_0.MaterialGraphNode_5'"
   Begin Object Class=/Script/Engine.MaterialExpressionFunctionInput Name="MaterialExpressionFunctionInput_1" ExportPath="/Script/Engine.MaterialExpressionFunctionInput'/Engine/Transient.Material_1:MaterialGraph_0.MaterialGraphNode_5.MaterialExpressionFunctionInput_1'"
   End Object
   Begin Object Name="MaterialExpressionFunctionInput_1" ExportPath="/Script/Engine.MaterialExpressionFunctionInput'/Engine/Transient.Material_1:MaterialGraph_0.MaterialGraphNode_5.MaterialExpressionFunctionInput_1'"
      Preview=(Mask=1,MaskR=1,MaskG=1)
      InputName="UV"
      Id=B16FCFFD46DD428ECB769C9538509571
      InputType=FunctionInput_Vector2
      MaterialExpressionEditorX=-1280
      MaterialExpressionEditorY=128
      MaterialExpressionGuid=D6EEB2EA4F774881C2FE9F8DCDE64786
      Material="/Script/Engine.Material'/Engine/Transient.Material_1'"
   End Object
   MaterialExpression="/Script/Engine.MaterialExpressionFunctionInput'MaterialExpressionFunctionInput_1'"
   NodePosX=-1280
   NodePosY=128
   NodeGuid=F72932AF4F9279DEA6088F89FB0CEEEA
   CustomProperties Pin (PinId=359DDC0242FCDF51175E5881487236D0,PinName="Preview",PinType.PinCategory="optional",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=170459BF408F1683A04DF1933D49F416,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,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,LinkedTo=(MaterialGraphNode_1 F3F8B0E042B1909F47D8C499BA4A535E,MaterialGraphNode_8 070495E04E378F97477B2BBE97EA0141,),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" ExportPath="/Script/UnrealEd.MaterialGraphNode'/Engine/Transient.Material_1:MaterialGraph_0.MaterialGraphNode_6'"
   Begin Object Class=/Script/Engine.MaterialExpressionFunctionInput Name="MaterialExpressionFunctionInput_2" ExportPath="/Script/Engine.MaterialExpressionFunctionInput'/Engine/Transient.Material_1:MaterialGraph_0.MaterialGraphNode_6.MaterialExpressionFunctionInput_2'"
   End Object
   Begin Object Name="MaterialExpressionFunctionInput_2" ExportPath="/Script/Engine.MaterialExpressionFunctionInput'/Engine/Transient.Material_1:MaterialGraph_0.MaterialGraphNode_6.MaterialExpressionFunctionInput_2'"
      InputName="Texture"
      Id=F786D3994C2792A0C2AF09BF3F87BF35
      InputType=FunctionInput_Texture2D
      MaterialExpressionEditorX=-1280
      MaterialExpressionEditorY=320
      MaterialExpressionGuid=3604476347C5546D44080688693AFE0F
      Material="/Script/Engine.Material'/Engine/Transient.Material_1'"
   End Object
   MaterialExpression="/Script/Engine.MaterialExpressionFunctionInput'MaterialExpressionFunctionInput_2'"
   NodePosX=-1280
   NodePosY=320
   NodeGuid=C43FEEA84B2D7CEADF99B994F4A74704
   CustomProperties Pin (PinId=41EF77004F1304B466AE4E827C869518,PinName="Preview",PinType.PinCategory="optional",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=F8E488CD4C399ED294DC25A582E0B622,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,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,LinkedTo=(MaterialGraphNode_1 126C00E24FF48B060DF9DD998D8CEF1C,MaterialGraphNode_3 0A5DF0614E68F3C6C61C2E8BCED5EA9D,MaterialGraphNode_8 BD1F5E6A45F1B56FFB0E93A46231613B,),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" ExportPath="/Script/UnrealEd.MaterialGraphNode'/Engine/Transient.Material_1:MaterialGraph_0.MaterialGraphNode_7'"
   Begin Object Class=/Script/Engine.MaterialExpressionConstant Name="MaterialExpressionConstant_0" ExportPath="/Script/Engine.MaterialExpressionConstant'/Engine/Transient.Material_1:MaterialGraph_0.MaterialGraphNode_7.MaterialExpressionConstant_0'"
   End Object
   Begin Object Name="MaterialExpressionConstant_0" ExportPath="/Script/Engine.MaterialExpressionConstant'/Engine/Transient.Material_1:MaterialGraph_0.MaterialGraphNode_7.MaterialExpressionConstant_0'"
      R=2.000000
      MaterialExpressionEditorX=-464
      MaterialExpressionEditorY=288
      MaterialExpressionGuid=7A92E11248E6BDA271DB34AFB9EAC673
      Material="/Script/Engine.Material'/Engine/Transient.Material_1'"
   End Object
   MaterialExpression="/Script/Engine.MaterialExpressionConstant'MaterialExpressionConstant_0'"
   NodePosX=-464
   NodePosY=288
   NodeGuid=6AC07E2B4BD7C4C1C3F9419BE05D0550
   CustomProperties Pin (PinId=54EC476F41A1C7CCE90E31B92375A120,PinName="Value",PinType.PinCategory="optional",PinType.PinSubCategory="red",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="2.0",PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=True,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=6F4DD50D4B2ABAC84C515AB6F5618D54,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,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,LinkedTo=(MaterialGraphNode_1 0729A4E14E031A30CFFEDFB8376072DE,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
End Object


The function takes a TexureObject and not a TextureSample. As long as a TextureObject parameter has the same name as the TextureSample then this works fine.


5 Likes

Hello !

Thanks for sharing this, im having a few issues with this since, probably because im new to UE.

I am experiencing some issues trying to get this to work.


Error: [SM6] /Engine/Generated/Material.ush:3337:8: error: use of undeclared identifier 'Begin'
    return Begin Object Class=/Script/UnrealEd.MaterialGraphNode Name="MaterialGraphNode_0" ExportPath="/Script/UnrealEd.MaterialGraphNode'/Engine/Transient.Material_1:MaterialGraph_0.MaterialGraphNode_0'"
           ^
MaterialEditorStats: Error: [SM6] /Engine/Generated/Material.ush:3337:14: error: unknown type name 'Object'
    return Begin Object Class=/Script/UnrealEd.MaterialGraphNode Name="MaterialGraphNode_0" ExportPath="/Script/UnrealEd.MaterialGraphNode'/Engine/Transient.Material_1:MaterialGraph_0.MaterialGraphNode_0'"

After editing the customcode, giving it 2 input parameters (object and begin) and also hooking up a textureobject and coord it still gives me an error. Could you/someone maybe please give a detailed explanation on how to make this work :slight_smile: (especially the custom material function call, a screenshot is welcome)

I would really appreciate the extra explanation as a newcomer!

Thanks in advance and have a nice day.

You can copy & paste the code above directly into you material. It should spawn some nodes.
Then just hook UV and Tex up.

1 Like

Thanks it worked ! It looks so much better.

Cheers!