Description

A licensee is seeing an issue with a couple of post process materials after enabling ray tracing. While the materials presenting the issue fail to compile for different reasons, they both refernce that the offending variable is within an enclosing function. Perhaps that commonality is the root of the issue. 

Errors from M_PlanetaryAtmosphere_PP_lut_00:

[SM5] D3DCompileToDxil failed
[SM5] /Engine/Generated/Material.ush(2112:45): error: reference to local variable 'integralLUTSampler' declared in enclosing function 'CustomExpression3'
	            Fxh.x = integralLUT.SampleLevel(integralLUTSampler, float2(r/rangeRM.x, v), 0).x;
	                                            ^
[SM5] /Engine/Generated/Material.ush:2043:216: note: 'integralLUTSampler' declared here
	float3  CustomExpression3(FMaterialPixelParameters Parameters, float3  Dcam, float3  Oview, float  hv2, float3  camPos, float2  tvrPx, float3  DRpx, float4  viewDots, float3  RR2,Texture2D integralLUT, SamplerState integralLUTSampler , float4  tvShd, float3  LightIo, float4  RMphase, float3  bRs, float3  bMe, float3  Mbse, float3  SceneColor, float3  BaseColor, float4  pxPos, float2  SSWP, float4  attenHardnessSWA, float4  minAttenuation, float4  tvLimitsH0, float4  tvLimitCoefs, float4  MultiScattered, float2  rangeRM, float4  RoDensityRM, float  MapGLB)
	                                                                                                                                                                                                                       ^
[SM5] /Engine/Generated/Material.ush(2118:45): error: reference to local variable 'integralLUTSampler' declared in enclosing function 'CustomExpression3'
	            Fxh.y = integralLUT.SampleLevel(integralLUTSampler, float2(r/rangeRM.y, v), 0).y;
	                                            ^

Errors from M_PlanetaryAtmosphere_PP_prec_09:

[SM5] /Engine/Generated/Material.ush(2011:60): error: default argument references local variable 'samplesNum' of enclosing function
	    float2 IntegrateFromNegInfToPosInf(float h2, int num = samplesNum)
	                                                           ^~~~~~~~~~
[SM5] /Engine/Generated/Material.ush(2031:76): error: default argument references local variable 'samplesNum' of enclosing function
	    float2 IntegrateOneSidedFromAtoB(float a, float b, float h2, int num = samplesNum)
	                                                                           ^~~~~~~~~~
[SM5] /Engine/Generated/Material.ush(2084:68): error: default argument references local variable 'samplesNum' of enclosing function
	    float2 IntegrateFromAtoB(float a, float b, float h2, int num = samplesNum)
	                                                                   ^~~~~~~~~~
[SM5] /Engine/Generated/Material.ush(2169:67): error: default argument references local variable 'samplesNum' of enclosing function
	    float2 IntegrateFromNegInfToNegX(float x, float h2, int num = samplesNum)
	                                                                  ^~~~~~~~~~
[SM5] /Engine/Generated/Material.ush(2190:61): error: default argument references local variable 'samplesNum' of enclosing function
	    float2 IntegrateFromNegInf(float x, float h2, int num = samplesNum)
	                                                            ^~~~~~~~~~
[SM5] /Engine/Generated/Material.ush(2256:114): error: default argument references local variable 'samplesNum' of enclosing function
	    float2 EffectiveDensity(float a, float b, float3 Dcam, float3 Oview, float dotDlDv, float dotDlDo, int num = samplesNum)
	                                                                                                                 ^~~~~~~~~~
[SM5] /Engine/Generated/Material.ush(2291:78): error: default argument references local variable 'samplesNum' of enclosing function
	    float2 EffectiveDensityRadial(float a, float b, float dotDlDv, int num = samplesNum)
	                                                                             ^~~~~~~~~~
[SM5] /Engine/Generated/Material.ush(2416:58): error: too few arguments to function call, expected 3, have 2
	    float2 Ip = denI.IntegrateFromNegInf(pxPos.x, pxPos.y);
	                ~~~~~~~~~~~~~~~~~~~~~~~~                 ^
[SM5] /Engine/Generated/Material.ush:2190:5: note: 'IntegrateFromNegInf' declared here
	    float2 IntegrateFromNegInf(float x, float h2, int num = samplesNum)
	    ^
[SM5] /Engine/Generated/Material.ush(2459:53): error: too few arguments to function call, expected 4, have 3
	RMIdensity = denI.IntegrateFromAtoB(tvpx, tvCam, hv2);
	             ~~~~~~~~~~~~~~~~~~~~~~                 ^
[SM5] /Engine/Generated/Material.ush:2084:5: note: 'IntegrateFromAtoB' declared here
	    float2 IntegrateFromAtoB(float a, float b, float h2, int num = samplesNum)
	    ^
[SM5] /Engine/Generated/Material.ush(2460:88): error: too few arguments to function call, expected 7, have 6
	RMIeff = denI.EffectiveDensity(max(tvA, tvpx), tvB, Dcam, Oview, viewDots.x, viewDots.y);
	         ~~~~~~~~~~~~~~~~~~~~~                                                         ^
[SM5] /Engine/Generated/Material.ush:2256:5: note: 'EffectiveDensity' declared here
	    float2 EffectiveDensity(float a, float b, float3 Dcam, float3 Oview, float dotDlDv, float dotDlDo, int num = samplesNum)
	    ^
[SM5] /Engine/Generated/Material.ush(2475:64): error: too few arguments to function call, expected 4, have 3
	        Isegmented[0] = denI.IntegrateFromAtoB(tvpx, tvCam, hv2);
	                        ~~~~~~~~~~~~~~~~~~~~~~                 ^
[SM5] /Engine/Generated/Material.ush(2492:71): error: too few arguments to function call, expected 4, have 3
	            Isegmented[1] = denI.IntegrateFromAtoB(tvShd.y, tvCam, hv2);
	                            ~~~~~~~~~~~~~~~~~~~~~~                    ^
[SM5] /Engine/Generated/Material.ush(2496:73): error: too few arguments to function call, expected 4, have 3
	        Isegmented[0] = denI.IntegrateFromAtoB(midLims.x, midLims.y, hv2);
	                        ~~~~~~~~~~~~~~~~~~~~~~                          ^
[SM5] D3DCompileToDxil failed

Steps to Reproduce
  1. Open the attached sample project
  2. Enable Ray Tracing in the project settings 
  3. Open the material "M_PlanetaryAtmosphere_PP_lut_00" or  "M_PlanetaryAtmosphere_PP_prec_09"
    • Located in /Game/PPmaterials/Materials

Result:
Observe that the material fails to compile when ray tracing is enabled 

Have Comments or More Details?

There's no existing public thread on this issue, so head over toAnswerHub just mention UE-87365 in the post.

6
Login to Vote

By Design
ComponentRendering - RHI
Affects Versions4.24.1
Target Fix4.25
CreatedJan 23, 2020
ResolvedMar 5, 2020
UpdatedMar 13, 2020