Compile error in DeferredDecal.usf

This being an experimental feature, I don’t know if Epic intends on preserving it. However, it seems that volumetric decals are currently unmaintained: DeferredDecal.usf fails to compile due to FGBufferData Data variable not being fully initialized.

Replacing line:
https://github.com/EpicGames/UnrealEngine/blob/dff3c48be101bb9f84633a733ef79c91c38d9542/Engine/Shaders/DeferredDecal.usf#L369
with FGBufferData Data = (FGBufferData)0; solves the compile error, and the SDF does show up. However, I don’t think it is being lit correctly.

Here’s a basic sample material setup that causes the error with a DeferredDecal → Volumetric Distance Function material. Errors show up when you try to save the material.

Begin Object Class=MaterialGraphNode Name="MaterialGraphNode_0"
   Begin Object Class=EdGraphPin Name="EdGraphPin_4414"
   End Object
   Begin Object Class=MaterialExpressionLightVector Name="MaterialExpressionLightVector_8"
   End Object
   Begin Object Name="EdGraphPin_4414"
      PinName="Output"
      PinFriendlyName=" "
      Direction=EGPD_Output
      LinkedTo(0)=EdGraphPin'MaterialGraphNode_1.EdGraphPin_4416'
   End Object
   Begin Object Name="MaterialExpressionLightVector_8"
      MaterialExpressionEditorX=-608
      MaterialExpressionEditorY=16
      MaterialExpressionGuid=3CFA132449C302EB3BDD0986BFF1DC89
      Material=PreviewMaterial'/Engine/Transient.NewMaterial'
   End Object
   MaterialExpression=MaterialExpressionLightVector'MaterialExpressionLightVector_8'
   Pins(0)=EdGraphPin'EdGraphPin_4414'
   NodePosX=-608
   NodePosY=16
   NodeGuid=EBF746234BAD67BFF8B046BEC87854B3
End Object
Begin Object Class=MaterialGraphNode Name="MaterialGraphNode_1"
   Begin Object Class=EdGraphPin Name="EdGraphPin_4419"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_4418"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_4417"
   End Object
   Begin Object Class=EdGraphPin Name="EdGraphPin_4416"
   End Object
   Begin Object Class=MaterialExpressionMaterialFunctionCall Name="MaterialExpressionMaterialFunctionCall_8"
   End Object
   Begin Object Name="EdGraphPin_4419"
      PinName="Result"
      Direction=EGPD_Output
   End Object
   Begin Object Name="EdGraphPin_4418"
      PinName="Radius"
      PinType=(PinCategory="required")
      LinkedTo(0)=EdGraphPin'MaterialGraphNode_3.EdGraphPin_4426'
   End Object
   Begin Object Name="EdGraphPin_4417"
      PinName="Center"
      PinType=(PinCategory="required")
      LinkedTo(0)=EdGraphPin'MaterialGraphNode_2.EdGraphPin_4424'
   End Object
   Begin Object Name="EdGraphPin_4416"
      PinName="UVs"
      PinType=(PinCategory="required")
      LinkedTo(0)=EdGraphPin'MaterialGraphNode_0.EdGraphPin_4414'
   End Object
   Begin Object Name="MaterialExpressionMaterialFunctionCall_8"
      MaterialFunction=MaterialFunction'/Engine/Functions/DistanceFields/Shapes/DistanceField_Sphere.DistanceField_Sphere'
      FunctionInputs(0)=(ExpressionInputId=F8B8E4294601B71325484D8C3615068D,Input=(Expression=MaterialExpressionLightVector'MaterialGraphNode_0.MaterialExpressionLightVector_8',InputName="Coordinates"))
      FunctionInputs(1)=(ExpressionInputId=33A0DD1E4F75D65C1606A0881D5D0838,Input=(Expression=MaterialExpressionConstant3Vector'MaterialGraphNode_2.MaterialExpressionConstant3Vector_14',InputName="Center"))
      FunctionInputs(2)=(ExpressionInputId=F6097B644DE4EB2586DB51AF6933D082,Input=(Expression=MaterialExpressionConstant'MaterialGraphNode_3.MaterialExpressionConstant_8',InputName="Radius"))
      FunctionOutputs(0)=(ExpressionOutputId=E2B2DD6546CAA7F2657C82B21793D079,Output=(OutputName="Result"))
      MaterialExpressionEditorX=-432
      MaterialExpressionEditorY=80
      MaterialExpressionGuid=0BD2F3E34C1057F55CE757A3CAD62479
      Material=PreviewMaterial'/Engine/Transient.NewMaterial'
      Outputs(0)=(OutputName="Result")
   End Object
   MaterialExpression=MaterialExpressionMaterialFunctionCall'MaterialExpressionMaterialFunctionCall_8'
   Pins(0)=EdGraphPin'EdGraphPin_4416'
   Pins(1)=EdGraphPin'EdGraphPin_4417'
   Pins(2)=EdGraphPin'EdGraphPin_4418'
   Pins(3)=EdGraphPin'EdGraphPin_4419'
   NodePosX=-432
   NodePosY=80
   NodeGuid=55823A3340059E27C8AEECA82D554210
End Object
Begin Object Class=MaterialGraphNode Name="MaterialGraphNode_2"
   Begin Object Class=EdGraphPin Name="EdGraphPin_4424"
   End Object
   Begin Object Class=MaterialExpressionConstant3Vector Name="MaterialExpressionConstant3Vector_14"
   End Object
   Begin Object Name="EdGraphPin_4424"
      PinName="Output"
      PinFriendlyName=" "
      Direction=EGPD_Output
      LinkedTo(0)=EdGraphPin'MaterialGraphNode_1.EdGraphPin_4417'
   End Object
   Begin Object Name="MaterialExpressionConstant3Vector_14"
      Constant=(R=0.500000,G=0.500000,B=0.500000,A=0.000000)
      MaterialExpressionEditorX=-624
      MaterialExpressionEditorY=96
      MaterialExpressionGuid=EB3B5BEC43713416E20DE0B6FE8E2789
      Material=PreviewMaterial'/Engine/Transient.NewMaterial'
   End Object
   MaterialExpression=MaterialExpressionConstant3Vector'MaterialExpressionConstant3Vector_14'
   Pins(0)=EdGraphPin'EdGraphPin_4424'
   NodePosX=-624
   NodePosY=96
   NodeGuid=8EE838FC41E539C5D22F01AE776C6F2B
End Object
Begin Object Class=MaterialGraphNode Name="MaterialGraphNode_3"
   Begin Object Class=EdGraphPin Name="EdGraphPin_4426"
   End Object
   Begin Object Class=MaterialExpressionConstant Name="MaterialExpressionConstant_8"
   End Object
   Begin Object Name="EdGraphPin_4426"
      PinName="Output"
      PinFriendlyName=" "
      Direction=EGPD_Output
      LinkedTo(0)=EdGraphPin'MaterialGraphNode_1.EdGraphPin_4418'
   End Object
   Begin Object Name="MaterialExpressionConstant_8"
      R=0.500000
      MaterialExpressionEditorX=-544
      MaterialExpressionEditorY=240
      MaterialExpressionGuid=8949044C42289414BA01CC938309A037
      Material=PreviewMaterial'/Engine/Transient.NewMaterial'
   End Object
   MaterialExpression=MaterialExpressionConstant'MaterialExpressionConstant_8'
   Pins(0)=EdGraphPin'EdGraphPin_4426'
   NodePosX=-544
   NodePosY=240
   NodeGuid=77D141D547A1196BE019E08146379436
End Object

Hey num3ric-

Can you provide what the exact compile error is that you’re receiving? Can you also explain the setup you’re using? I used the setup you provided and plugged the DistanceField_Sphere node into base color, however I’m not sure what you are doing from here. Please be as descriptive in your reproduction steps as possible.

Here’s a screen capture of the exact material setup and errors (which show up when you save it):

https://dl.dropboxusercontent.com/u/29102565/ue4/volumetricdecalerror.png

Then I’m applying this material to a deferred decal actor in the scene.

This is based on this reference fyi: Experimentation: Volumetric Decals - Rendering - Unreal Engine Forums

You need to create an Add node and add the Light Vector with a Vector3 node. Then plug the output of your Add node into Coordinates (V3) input. Let me know if this resolves the issue or if you need further assistance.

Cheers,

Adding the LightVector with any Vector3? That does not solve the issue no. The uninitialized data error in DeferredDecal.usf remains.

Only with the code fix I mentioned above are signed distance fields rendered.

Please take this code fix you have provided and submit a pull request to have this code changed. Reports like this where users have the code that fixes an issue can be submitted via a Pull Request on GitHub. This makes it easier on us as when getting a fix in place as it skips the entire bug reporting process and the necessity for engineers to get a fix.

Let me know if you have further questions or need additional assistance.

Cheers,