Natural Depth through translucent Material

Hi. This is my first post in this Forum, so tell me if I post something wrong or anything.

I was annoyed by the way depth is done in games. It’s always like a view plane moving forwad trough geometry. I think it’s the cheapest way to produce depth in game engines, but it always leads to the effect of being able to see more through fog at the edges of the screen because the view plane is the furthest away from the actual camera position at these screenpositions.

Well, I tried and errored my way through to a way to get a correct or natural looking depth in Translucent materials. This way I was able to build myself a water plane that doesn’t change fog distance on the screen edges.

NatualDepthMaterial.zip

To further illustrate the problem, here are some images:

Just the natural depth setup for a quick material Copy/Paste:


Begin Object Class=/Script/UnrealEd.MaterialGraphNode Name="MaterialGraphNode_11"
   Begin Object Class=/Script/Engine.MaterialExpressionDistance Name="MaterialExpressionDistance_7"
   End Object
   Begin Object Name="MaterialExpressionDistance_7"
      A=(Expression=MaterialExpressionWorldPosition'"MaterialGraphNode_12.MaterialExpressionWorldPosition_5"')
      B=(Expression=MaterialExpressionAdd'"MaterialGraphNode_17.MaterialExpressionAdd_38"')
      MaterialExpressionEditorX=-1584
      MaterialExpressionEditorY=304
      MaterialExpressionGuid=DB4FCC244ED3B2CEE0A826AD48205C3A
      Material=PreviewMaterial'"/Engine/Transient.PreviewMaterial_0"'
      Desc="Correct Depth behind surface"
      bCommentBubbleVisible=True
   End Object
   MaterialExpression=MaterialExpressionDistance'"MaterialExpressionDistance_7"'
   NodePosX=-1584
   NodePosY=304
   bCommentBubbleVisible=True
   NodeComment="Correct Depth behind surface"
   NodeGuid=CAC18FB74D8833782590D6B7653C76EE
   CustomProperties Pin (PinId=E1D2B630438E5C398001F6B3C5EB82A0,PinName="A",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_12 47714C574E570A04735513B244EE25DF,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=781712944DC4B2148C7696B893D560E3,PinName="B",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_17 F2112FD94DDBBB7C43CD0A8AD4571440,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=02606E0F44EBA0709CAD588A4E9AE786,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_44 7737123F40E24C15DCEF5FB1306430BB,MaterialGraphNode_47 CFE6C36142225F5CE800DBA8E5B364D4,MaterialGraphNode_49 15CAC6704997A9C6ED074E8D2F765204,MaterialGraphNode_54 0D929D6E426E5FEE68D37AAF48B30826,),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.MaterialExpressionWorldPosition Name="MaterialExpressionWorldPosition_5"
   End Object
   Begin Object Name="MaterialExpressionWorldPosition_5"
      MaterialExpressionEditorX=-1808
      MaterialExpressionEditorY=208
      MaterialExpressionGuid=FB2A819845FD3527BE4337B6E90DA8DC
      Material=PreviewMaterial'"/Engine/Transient.PreviewMaterial_0"'
   End Object
   MaterialExpression=MaterialExpressionWorldPosition'"MaterialExpressionWorldPosition_5"'
   NodePosX=-1808
   NodePosY=208
   NodeGuid=46D086874AB3B7E4241350BFC7E0138F
   CustomProperties Pin (PinId=47714C574E570A04735513B244EE25DF,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 E1D2B630438E5C398001F6B3C5EB82A0,),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.MaterialExpressionSceneDepth Name="MaterialExpressionSceneDepth_12"
   End Object
   Begin Object Name="MaterialExpressionSceneDepth_12"
      MaterialExpressionEditorX=-2672
      MaterialExpressionEditorY=96
      MaterialExpressionGuid=2BB654AF4BA8AC56B0A341AAE1D9B706
      Material=PreviewMaterial'"/Engine/Transient.PreviewMaterial_0"'
      Desc="Depth to surfaces behind own surface"
      bCommentBubbleVisible=True
   End Object
   MaterialExpression=MaterialExpressionSceneDepth'"MaterialExpressionSceneDepth_12"'
   NodePosX=-2672
   NodePosY=96
   bCommentBubbleVisible=True
   NodeComment="Depth to surfaces behind own surface"
   NodeGuid=4E5994DB429B1AD879E633BBE6AF0851
   CustomProperties Pin (PinId=8A7938AD4D299ABDEE30D2A0B87143D4,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=2A1EA1DB49A2AF764F07098B8411D192,PinName="Output",PinFriendlyName=" ",Direction="EGPD_Output",PinType.PinCategory="mask",PinType.PinSubCategory="red",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_14 D6F6CC654365871D9DD7AC838B0CB8EF,),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.MaterialExpressionDivide Name="MaterialExpressionDivide_33"
   End Object
   Begin Object Name="MaterialExpressionDivide_33"
      A=(Expression=MaterialExpressionSceneDepth'"MaterialGraphNode_13.MaterialExpressionSceneDepth_12"',Mask=1,MaskR=1)
      B=(Expression=MaterialExpressionPixelDepth'"MaterialGraphNode_15.MaterialExpressionPixelDepth_1"',Mask=1,MaskR=1)
      MaterialExpressionEditorX=-2448
      MaterialExpressionEditorY=128
      MaterialExpressionGuid=138F09DA44EDC41B5B420392092DEFFF
      Material=PreviewMaterial'"/Engine/Transient.PreviewMaterial_0"'
      Desc="by surface distorted scenedepth behind the surface"
      bCommentBubbleVisible=True
   End Object
   MaterialExpression=MaterialExpressionDivide'"MaterialExpressionDivide_33"'
   NodePosX=-2448
   NodePosY=128
   bCommentBubbleVisible=True
   NodeComment="by surface distorted scenedepth behind the surface"
   NodeGuid=6B6F2ACA478B9D2689A1BDA68661A51F
   CustomProperties Pin (PinId=D6F6CC654365871D9DD7AC838B0CB8EF,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_13 2A1EA1DB49A2AF764F07098B8411D192,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=BFFF4C04486A7AA41FD1A29437B2C61E,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_15 9D3EB73246F3F1BAA72F0685304CC990,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=570B2F484967DB5C3CB0699DF366B5F9,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 B24FDE0F4FCBD59AFC070CB056C42B3E,),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.MaterialExpressionPixelDepth Name="MaterialExpressionPixelDepth_1"
   End Object
   Begin Object Name="MaterialExpressionPixelDepth_1"
      MaterialExpressionEditorX=-2672
      MaterialExpressionEditorY=192
      MaterialExpressionGuid=69C542EE450EF702622AC1AF51D9397F
      Material=PreviewMaterial'"/Engine/Transient.PreviewMaterial_0"'
      Desc="Depth to own surface"
      bCommentBubbleVisible=True
   End Object
   MaterialExpression=MaterialExpressionPixelDepth'"MaterialExpressionPixelDepth_1"'
   NodePosX=-2672
   NodePosY=192
   bCommentBubbleVisible=True
   NodeComment="Depth to own surface"
   NodeGuid=1F1009754BA94015085A399D26E99B26
   CustomProperties Pin (PinId=9D3EB73246F3F1BAA72F0685304CC990,PinName="Output",PinFriendlyName=" ",Direction="EGPD_Output",PinType.PinCategory="mask",PinType.PinSubCategory="red",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsArray=False,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,LinkedTo=(MaterialGraphNode_14 BFFF4C04486A7AA41FD1A29437B2C61E,),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.MaterialExpressionMultiply Name="MaterialExpressionMultiply_33"
   End Object
   Begin Object Name="MaterialExpressionMultiply_33"
      A=(Expression=MaterialExpressionDivide'"MaterialGraphNode_14.MaterialExpressionDivide_33"')
      B=(Expression=MaterialExpressionTransformPosition'"MaterialGraphNode_40.MaterialExpressionTransformPosition_0"')
      MaterialExpressionEditorX=-2112
      MaterialExpressionEditorY=208
      MaterialExpressionGuid=6DC218E1408141B1D4AD68B810EBBFE2
      Material=PreviewMaterial'"/Engine/Transient.PreviewMaterial_0"'
      Desc="Position of surfaces behind - relative to camera"
      bCommentBubbleVisible=True
   End Object
   MaterialExpression=MaterialExpressionMultiply'"MaterialExpressionMultiply_33"'
   NodePosX=-2112
   NodePosY=208
   bCommentBubbleVisible=True
   NodeComment="Position of surfaces behind - relative to camera"
   NodeGuid=4E98235C40FAD85C2B5DDFB04883EDBD
   CustomProperties Pin (PinId=B24FDE0F4FCBD59AFC070CB056C42B3E,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_14 570B2F484967DB5C3CB0699DF366B5F9,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=BCB2E17545F1A82B6533B79B82EEBE70,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_40 1FBA83C94F67F15C706405A050F2024D,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=A1EB75904474D458F373BB833EF117F5,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_17 17562EBE4D658EB2F0E5C9B9A243C457,),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.MaterialExpressionAdd Name="MaterialExpressionAdd_38"
   End Object
   Begin Object Name="MaterialExpressionAdd_38"
      A=(Expression=MaterialExpressionMultiply'"MaterialGraphNode_16.MaterialExpressionMultiply_33"')
      B=(Expression=MaterialExpressionCameraPositionWS'"MaterialGraphNode_18.MaterialExpressionCameraPositionWS_5"')
      MaterialExpressionEditorX=-1982
      MaterialExpressionEditorY=322
      MaterialExpressionGuid=2B9A30074BC9EE67AD6613AB28F89797
      Material=PreviewMaterial'"/Engine/Transient.PreviewMaterial_0"'
      Desc="Worldposition behind own surface"
      bCommentBubbleVisible=True
   End Object
   MaterialExpression=MaterialExpressionAdd'"MaterialExpressionAdd_38"'
   NodePosX=-1982
   NodePosY=322
   bCommentBubbleVisible=True
   NodeComment="Worldposition behind own surface"
   NodeGuid=A2F879BA4DA54658D0A93AAA0531BAD5
   CustomProperties Pin (PinId=17562EBE4D658EB2F0E5C9B9A243C457,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_16 A1EB75904474D458F373BB833EF117F5,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=46CC90A94C1694FA60348A93614D29D3,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 2C54C8644C30A460F18F4FADAB128C03,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=F2112FD94DDBBB7C43CD0A8AD4571440,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 781712944DC4B2148C7696B893D560E3,),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.MaterialExpressionCameraPositionWS Name="MaterialExpressionCameraPositionWS_5"
   End Object
   Begin Object Name="MaterialExpressionCameraPositionWS_5"
      MaterialExpressionEditorX=-2160
      MaterialExpressionEditorY=416
      MaterialExpressionGuid=E72D8B294CC20023ACBB928FDB36699C
      Material=PreviewMaterial'"/Engine/Transient.PreviewMaterial_0"'
   End Object
   MaterialExpression=MaterialExpressionCameraPositionWS'"MaterialExpressionCameraPositionWS_5"'
   NodePosX=-2160
   NodePosY=416
   NodeGuid=C4B7BD854C28A8DA9979C1822B6A93AD
   CustomProperties Pin (PinId=2C54C8644C30A460F18F4FADAB128C03,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_17 46CC90A94C1694FA60348A93614D29D3,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
End Object
Begin Object Class=/Script/UnrealEd.MaterialGraphNode Name="MaterialGraphNode_19"
   Begin Object Class=/Script/Engine.MaterialExpressionWorldPosition Name="MaterialExpressionWorldPosition_7"
   End Object
   Begin Object Name="MaterialExpressionWorldPosition_7"
      MaterialExpressionEditorX=-2670
      MaterialExpressionEditorY=306
      MaterialExpressionGuid=FD2E4F334946B7420B9E46B3E274F1B4
      Material=PreviewMaterial'"/Engine/Transient.PreviewMaterial_0"'
      Desc="world position of own surface"
      bCommentBubbleVisible=True
   End Object
   MaterialExpression=MaterialExpressionWorldPosition'"MaterialExpressionWorldPosition_7"'
   NodePosX=-2670
   NodePosY=306
   bCommentBubbleVisible=True
   NodeComment="world position of own surface"
   NodeGuid=B15143F74C1BE623F4F9B9914244613C
   CustomProperties Pin (PinId=3ABC97F84F2600671C08F28F678A788D,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_40 1E5FDEE248B78A57B4E6E6AA96DDF606,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
End Object
Begin Object Class=/Script/UnrealEd.MaterialGraphNode Name="MaterialGraphNode_40"
   Begin Object Class=/Script/Engine.MaterialExpressionTransformPosition Name="MaterialExpressionTransformPosition_0"
   End Object
   Begin Object Name="MaterialExpressionTransformPosition_0"
      Input=(Expression=MaterialExpressionWorldPosition'"MaterialGraphNode_19.MaterialExpressionWorldPosition_7"')
      TransformSourceType=TRANSFORMPOSSOURCE_World
      TransformType=TRANSFORMPOSSOURCE_TranslatedWorld
      MaterialExpressionEditorX=-2480
      MaterialExpressionEditorY=304
      MaterialExpressionGuid=E5A4AA9946F6293CD336F99713A1DA58
      Material=PreviewMaterial'"/Engine/Transient.PreviewMaterial_0"'
   End Object
   MaterialExpression=MaterialExpressionTransformPosition'"MaterialExpressionTransformPosition_0"'
   NodePosX=-2480
   NodePosY=304
   NodeGuid=C13A26B541BA27F5415C119C459D4897
   CustomProperties Pin (PinId=1E5FDEE248B78A57B4E6E6AA96DDF606,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_19 3ABC97F84F2600671C08F28F678A788D,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
   CustomProperties Pin (PinId=1FBA83C94F67F15C706405A050F2024D,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 BCB2E17545F1A82B6533B79B82EEBE70,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
End Object
Begin Object Class=/Script/UnrealEd.MaterialGraphNode Name="MaterialGraphNode_41"
   Begin Object Class=/Script/Engine.MaterialExpressionMaterialFunctionCall Name="MaterialExpressionMaterialFunctionCall_2"
   End Object
   Begin Object Name="MaterialExpressionMaterialFunctionCall_2"
      MaterialFunction=MaterialFunction'"/Engine/Functions/Engine_MaterialFunctions02/UVs/WorldPositionBehindTranslucency.WorldPositionBehindTranslucency"'
      FunctionInputs(0)=(ExpressionInputId=9C34D4E5463EAC4062E14FBEEA947626,Input=(OutputIndex=-1,InputName="Exclude WPO Offsets"))
      FunctionOutputs(0)=(ExpressionOutputId=49E1A3CF47C0B4A1BFE84ABF854CF41C,Output=(OutputName="Result"))
      MaterialExpressionEditorX=-2672
      MaterialExpressionEditorY=400
      MaterialExpressionGuid=2C32A5674EF3C79AE3BAA38305B0795C
      Material=PreviewMaterial'"/Engine/Transient.PreviewMaterial_0"'
      Outputs(0)=(OutputName="Result")
   End Object
   MaterialExpression=MaterialExpressionMaterialFunctionCall'"MaterialExpressionMaterialFunctionCall_2"'
   NodePosX=-2672
   NodePosY=400
   NodeGuid=55ACBF88448C626F2EF9C6962339C3F2
   CustomProperties Pin (PinId=01C5DF2D4E8AB9B4832A72967AB72D01,PinName="Exclude WPO Offsets (MA)",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=E16815F741C6F9B97BF4ED8D706F4D47,PinName="Result",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_Comment Name="MaterialGraphNode_Comment_0"
   Begin Object Class=/Script/Engine.MaterialExpressionComment Name="MaterialExpressionComment_1"
   End Object
   Begin Object Name="MaterialExpressionComment_1"
      SizeX=1328
      SizeY=592
      Text="Fog"
      MaterialExpressionEditorX=-2752
      MaterialExpressionEditorY=-64
      MaterialExpressionGuid=6999A2DB438C0FE09FA1B38E69B69790
      Material=PreviewMaterial'"/Engine/Transient.PreviewMaterial_0"'
   End Object
   MaterialExpressionComment=MaterialExpressionComment'"MaterialExpressionComment_1"'
   CommentDepth=-2
   NodePosX=-2752
   NodePosY=-64
   NodeWidth=1328
   NodeHeight=592
   NodeComment="Fog"
   NodeGuid=6E49D10A4C404773140EC8B2DD1CC9E1
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=861
      SizeY=506
      Text="WorldPos Behind own surface"
      MaterialExpressionEditorX=-2720
      MaterialExpressionGuid=94AC3BAC4B91E3CF08A0E2B0C6A13383
      Material=PreviewMaterial'"/Engine/Transient.PreviewMaterial_0"'
   End Object
   MaterialExpressionComment=MaterialExpressionComment'"MaterialExpressionComment_0"'
   NodePosX=-2720
   NodeWidth=861
   NodeHeight=506
   NodeComment="WorldPos Behind own surface"
   NodeGuid=6D0884D34DE696FE39A2B397EE311DE5
End Object


2 Likes

Interesting approach, thank you for sharing this!