Custom Material Node, Can't understand error

I’m having a problem Understanding the Error from the Material Log:

[SM5] /Engine/Generated/Material.ush(3279,102-120): error X3508: ‘CalcPixelMaterialInputs’: output parameter ‘PixelMaterialInputs’ not completely initialized

Here is the HLSL code used:

static float4 cb12[8] =
{
float4(0.0, 0.0, 0.0, 0.0),
float4(0.0, 0.0, 0.0, 0.0),
float4(0.0, 0.0, 0.0, 0.0),
float4(0.0, 0.0, 0.0, 0.0),
float4(0.0, 0.0, 0.0, 0.0),
float4(0.0, 0.0, 0.0, 0.0),
float4(0.0, 0.0, 0.0, 0.0),
float4(0.0, 0.0, 0.0, 0.0),
};
static float4 cb0[50] =
{
float4(1, 1, 0, 0),
float4(5, 5, 0, 0),
float4(1, 1, 1, 1),
float4(-0.2, 1.2, 0, 0),
float4(0.009273379, 0.011629739, 0.012722896, 1),
float4(0.021911986, 0.028676976, 0.032695785, 0),
float4(1, -3, 0, 0),
float4(0.22479045, 0.28765103, 0.33778036, 1),
float4(-0.062802985, -0.056357056, -0.040977508, 0),
float4(0.49804688, -0.25, 0.60595196, 0),
float4(2, 2, 0, 0),
float4(-0.028735632, 1.0057471, 0, 0),
float4(1.9921875, -1, 0.39999998, 0),
float4(1.9921875, -1, 0.39999998, 0),
float4(1.9921875, -1, 0.39999998, 0),
float4(0, 0, 13.477952, 0),
float4(0.0034337554, 0, 0.008264297, 1),
float4(-0.0025271554, 0, -0.0058114994, 0),
float4(0.0123174, 0, 0.03332461, 1),
float4(0.7, 0, 0, 0),
float4(0.8, -0.6, 0, 0),
float4(0.4, 0, 0, 0),
float4(0, 0.8, 0, 0),
float4(0.2, -0.2, 0, 0),
float4(0.2, 0, 0, 0),
float4(0, 1, 0, 0),
float4(1, 0, 0, 0),
float4(0.2, 0, 0, 0),
float4(-1.25, 1.25, 0, 0),
float4(0.1, 0, 0, 0),
float4(0.5, 0, 0, 0),
float4(-0.2, 100.2, 0, 0),
float4(0.03, 0, 0, 0),
float4(2, 0, 0, 0),
float4(2, 0, 0, 0),
float4(0.88, 0, 0, 0),
float4(0.77, 0, 0, 0),
float4(0.66, 0, 0, 0),
float4(0.55, 0, 0, 0),
float4(0.44, 0, 0, 0),
float4(0.33, 0, 0, 0),
float4(0.22, 0, 0, 0),
float4(0, 0, 0, 0),
float4(0, 1, 0, 0),
float4(6, -5, 0, 0),
float4(0, 1, 0, 0),
float4(1, -1, 0, 0),
float4(0.2, 0, 0, 0),
float4(-1, 3, 0, 0),
float4(0.5, 0, 0, 0),
};
static float4 v0 = {1, 1, 1, 1};

static float4 v1 = {1, 1, 1, 1};

static float4 v2 = {1, 1, 1, 1};

static float4 v3 = {1, 1, 1, 1};

static float4 v4 = {1, 1, 1, 1};

static float4 v5 = {1, 1, 1, 1};

static float4 v6 = {1, 1, 1, 1};

static uint v7 = 1;

#define cmp -
struct shader {
FMaterialAttributes main(
float4 t8,
float4 t7,
float4 t6,
float4 t5,
float4 t4,
float4 t3,
float4 t2,
float4 t1,
float4 t0,
float2 tx,
float3 viewDir,
float3 vc,
float vcw)
{
FMaterialAttributes output;
float4 o0,o1,o2;
float4 v0 = {0,0,1,1};
float4 v1 = {1,0,0,1};
float4 v2 = {0,1,0,1};
float4 v3 = {tx.xy, 1,1};
float4 v4 = {viewDir.xyz,1};
float4 v5 = {vc.xyz, vcw};
v7.x = v7.x;
float4 r0,r1,r2,r3,r4,r5,r6,r7,r8,r9;
uint4 bitmask, uiDest;
float4 fDest;

r0.xyz = cb12[7].xyz + -v4.xyz;
r0.w = dot(r0.xyz, r0.xyz);
r1.x = sqrt(r0.w);
r1.yz = v3.xy * cb0[0].xy + cb0[0].zw;
r2.xy = v3.xy * cb0[1].xy + cb0[1].zw;
r1.w = Material_Texture2D_0.SampleLevel(Material_Texture2D_0Sampler, v3.xy, 0).y;
r2.zw = Material_Texture2D_1.SampleLevel(Material_Texture2D_0Sampler, r1.yz, 0).xy;
r3.xy = Material_Texture2D_2.SampleLevel(Material_Texture2D_0Sampler, r2.xy, 0).xy;
r4.xyz = Material_Texture2D_3.SampleLevel(Material_Texture2D_0Sampler, v3.xy, 0).xyz;
r3.z = 1 + -v5.x;
r1.x = saturate(r1.x * cb0[11].x + cb0[11].y);
r2.z = saturate(cb0[45].y * r2.z + cb0[45].x);
r3.x = saturate(cb0[46].y * r3.x + cb0[46].x);
r3.x = r3.x + -r2.z;
r2.z = cb0[47].x * r3.x + r2.z;
r3.x = saturate(cb0[48].y * r1.w + cb0[48].x);
r3.x = r3.x + -r2.z;
r2.z = cb0[49].x * r3.x + r2.z;
r2.z = cb0[44].y * r2.z;
r2.z = saturate(v5.w * cb0[44].x + r2.z);
r3.x = cmp(0 < r2.z);
if (r3.x != 0) {
r0.w = rsqrt(r0.w);
r0.xyz = r0.xyz * r0.www;
r5.z = dot(r0.xyz, v0.xyz);
r5.x = dot(r0.xyz, v1.xyz);
r5.y = dot(r0.xyz, v2.xyz);
r0.xy = cb0[9].xy * r3.zz;
r0.xy = r4.xy * r0.xx + r0.yy;
r0.z = saturate(cb0[9].z + r4.z);
r6.xy = v3.xy * cb0[10].xy + cb0[10].zw;
r6.xyz = Material_Texture2D_4.SampleLevel(Material_Texture2D_0Sampler, r6.xy, 0).xyz;
r7.xy = cb0[12].xy * r1.xx;
r6.xy = r6.xy * r7.xx + r7.yy;
r0.w = saturate(cb0[12].z + r6.z);
r0.xy = r6.xy + r0.xy;
r0.z = min(r0.z, r0.w);
r0.w = saturate(r1.w);
r6.xyz = cb0[17].xyz * r0.www + cb0[16].xyz;
r7.xyz = cb0[18].xyz + -r6.xyz;
r6.xyz = v5.xxx * r7.xyz + r6.xyz;
r0.w = saturate(cb0[20].y * r1.w + cb0[20].x);
r3.w = saturate(cb0[22].y * v5.x + cb0[22].x);
r4.w = cb0[21].x + -r0.w;
r0.w = saturate(r3.w * r4.w + r0.w);
r7.y = saturate(cb0[23].y * r1.w + cb0[23].x);
r3.w = saturate(cb0[25].y * v5.x + cb0[25].x);
r4.w = cb0[24].x + -r1.w;
r3.w = r3.w * r4.w + r1.w;
r4.w = cb0[26].x * r3.w;
r5.w = r5.z * r5.z;
r5.w = saturate(r5.w * cb0[28].x + cb0[28].y);
r6.w = r3.w * cb0[27].x + -r4.w;
r4.w = r5.w * r6.w + r4.w;
r8.x = v3.x + r4.w;
r8.y = r3.w * cb0[26].x + v3.y;
r3.w = dot(r5.xyz, r5.xyz);
r3.w = rsqrt(r3.w);
r5.xyz = r5.xyz * r3.www;
r1.w = -cb0[30].x + r1.w;
r1.w = cb0[29].x * r1.w;
r5.xy = r5.xy * r1.ww;
r5.xy = r5.xy / r5.zz;
r5.xy = r8.xy + r5.xy;
r5.xyz = Material_Texture2D_7.SampleLevel(Material_Texture2D_0Sampler, r5.xy, 0).xyz;
r1.w = max(r5.y, r5.z);
r7.x = max(r5.x, r1.w);
r8.xyz = r6.xyz + r5.xyz;
r1.w = max(r8.y, r8.z);
r1.w = max(r8.x, r1.w);
r1.w = saturate(-1 + r1.w);
r1.w = 1 + -r1.w;
r5.xyz = r6.xyz * r1.www + r5.xyz;
r1.w = max(r5.y, r5.z);
r1.w = max(r5.x, r1.w);
r1.w = max(1, r1.w);
r5.xyz = r5.xyz / r1.www;
r6.x = min(r0.w, r0.z);
r6.y = cb0[19].x;
r6.z = 1;
r0.z = -1;
} else {
r5.xyz = float3(0,0,0);
r6.xyz = float3(0,0,0);
r7.xy = float2(0,0);
r0.xyz = float3(0,0,0);
}
r0.w = cmp(r2.z < 1);
if (r0.w != 0) {
r0.w = saturate(cb0[3].y * r2.w + cb0[3].x);
r8.xyz = cb0[5].xyz * r0.www + cb0[4].xyz;
r0.w = saturate(cb0[6].y * r3.y + cb0[6].x);
r9.xyz = cb0[8].xyz * r0.www + cb0[7].xyz;
r8.xyz = r9.xyz * r8.xyz;
r9.xz = cb0[2].xz;
r9.y = r8.y;
r9.xyz = cb0[2].xyz * r9.xyz;
r1.yzw = Material_Texture2D_5.SampleLevel(Material_Texture2D_0Sampler, r1.yz, 0).xyz;
r1.yz = r1.yz * cb0[13].xx + cb0[13].yy;
r0.w = saturate(cb0[13].z + r1.w);
r2.xyw = Material_Texture2D_6.SampleLevel(Material_Texture2D_0Sampler, r2.xy, 0).xyz;
r1.xw = cb0[14].xy * r1.xx;
r1.xw = r2.xy * r1.xx + r1.ww;
r2.x = saturate(cb0[14].z + r2.w);
r1.xy = r1.yz + r1.xw;
r1.zw = cb0[15].xy * r3.zz;
r1.zw = r4.xy * r1.zz + r1.ww;
r2.y = saturate(cb0[15].z + r4.z);
r1.xy = r1.xy + r1.zw;
r1.z = min(r2.x, r2.y);
r0.w = min(r1.z, r0.w);
r8.w = cb0[2].y;
r2.xyw = r9.xyz * r8.xwz;
r1.z = saturate(cb0[31].y * r9.y + cb0[31].x);
r1.w = cmp(0 < cb0[32].x);
if (r1.w != 0) {
r4.x = dot(cb0[42].xyz, v1.xyz);
r4.y = dot(cb0[42].xyz, v2.xyz);
r3.yz = cb0[32].xx * r4.xy;
r1.w = Material_Texture2D_8.SampleLevel(Material_Texture2D_0Sampler, v3.xy, 0).x;
r4.xy = r3.yz * cb0[35].xx + v3.xy;
r3.w = Material_Texture2D_8.SampleLevel(Material_Texture2D_0Sampler, r4.xy, 0).x;
r3.w = r3.w + -r1.w;
r3.w = -cb0[35].x + r3.w;
r3.w = r3.w / cb0[35].x;
r4.xy = r3.yz * cb0[36].xx + v3.xy;
r4.x = Material_Texture2D_8.SampleLevel(Material_Texture2D_0Sampler, r4.xy, 0).x;
r4.x = r4.x + -r1.w;
r4.x = -cb0[36].x + r4.x;
r4.x = r4.x / cb0[36].x;
r4.yz = r3.yz * cb0[37].xx + v3.xy;
r4.y = Material_Texture2D_8.SampleLevel(Material_Texture2D_0Sampler, r4.yz, 0).x;
r4.y = r4.y + -r1.w;
r4.y = -cb0[37].x + r4.y;
r4.y = r4.y / cb0[37].x;
r4.zw = r3.yz * cb0[38].xx + v3.xy;
r4.z = Material_Texture2D_8.SampleLevel(Material_Texture2D_0Sampler, r4.zw, 0).x;
r4.z = r4.z + -r1.w;
r4.z = -cb0[38].x + r4.z;
r4.z = r4.z / cb0[38].x;
r7.zw = r3.yz * cb0[39].xx + v3.xy;
r4.w = Material_Texture2D_8.SampleLevel(Material_Texture2D_0Sampler, r7.zw, 0).x;
r4.w = r4.w + -r1.w;
r4.w = -cb0[39].x + r4.w;
r4.w = r4.w / cb0[39].x;
r7.zw = r3.yz * cb0[40].xx + v3.xy;
r5.w = Material_Texture2D_8.SampleLevel(Material_Texture2D_0Sampler, r7.zw, 0).x;
r5.w = r5.w + -r1.w;
r5.w = -cb0[40].x + r5.w;
r5.w = r5.w / cb0[40].x;
r3.yz = r3.yz * cb0[41].xx + v3.xy;
r3.y = Material_Texture2D_8.SampleLevel(Material_Texture2D_0Sampler, r3.yz, 0).x;
r1.w = r3.y + -r1.w;
r1.w = -cb0[41].x + r1.w;
r1.w = r1.w / cb0[41].x;
r3.y = max(r4.x, r3.w);
r3.y = max(r3.y, r4.y);
r3.y = max(r3.y, r4.z);
r3.y = max(r3.y, r4.w);
r3.y = max(r3.y, r5.w);
r1.w = max(r3.y, r1.w);
r1.w = cb0[33].x * r1.w + cb0[34].x;
r1.w = exp2(-r1.w);
r1.w = min(1, r1.w);
} else {
r1.w = 1;
}
r4.y = cb0[43].y * r1.w + cb0[43].x;
r4.x = min(r1.z, r0.w);
} else {
r1.xy = float2(0,0);
r2.xyw = float3(0,0,0);
r4.xy = float2(0,0);
}
r3.yzw = r5.xyz + -r2.xyw;
o0.xyz = r2.zzz * r3.yzw + r2.xyw;
r0.xy = -r1.xy + r0.xy;
r0.xy = r2.zz * r0.xy + r1.xy;
r0.w = dot(r0.xy, r0.xy);
r0.w = 1 + -r0.w;
r0.w = max(0, r0.w);
r0.w = sqrt(r0.w);
r4.z = 0;
r1.xyz = r6.xyz + -r4.xzy;
r1.xyz = r2.zzz * r1.zxy + r4.yxz;
r1.w = r7.y * r2.z;
o0.w = r3.x ? r0.z : 0;
{ output.OpacityMask = 1 - o0.w; return output; }
r2.xyw = v2.xyz * r0.yyy;
r0.xyz = v1.xyz * r0.xxx + r2.xyw;
r0.xyz = v0.xyz * r0.www + r0.xyz;
r0.w = dot(r0.xyz, r0.xyz);
r0.w = rsqrt(r0.w);
r0.xyz = r0.xyz * r0.www;
r0.w = r1.y * 0.125 + 0.375;
o1.xyz = saturate(r0.xyz * r0.www + float3(0.5,0.5,0.5));
r0.x = r2.z * r7.x + 0.0078125;
r0.x = log2(r0.x);
r0.x = saturate(r0.x * 0.0769230798 + 0.538461566);
r1.x = saturate(r1.x);
r0.x = r1.x + r0.x;
o2.y = 0.5 * r0.x;
o2.z = 0.800000012 * r1.w;
o1.w = 0;
o2.x = r1.z;
o2.w = v0.w;

    ///RT0
    output.BaseColor = o0.xyz; // Albedo
    
    ///RT1

    // Normal
    float3 biased_normal = o1.xyz - float3(0.5, 0.5, 0.5);
    float normal_length = length(biased_normal);
    float3 normal_in_world_space = biased_normal / normal_length;
    
    output.Normal = normal_in_world_space.xyz;

    // Roughness
    float smoothness = saturate(8 * (normal_length - 0.375)); 
    output.Roughness = 1 - smoothness;

    ///RT2
    output.Metallic = saturate(o2.x);
    output.EmissiveColor = clamp((o2.y - 0.5) * 2 * 5 * output.BaseColor, 0, 100);  // the *5 is a scale to make it look good
    output.AmbientOcclusion = saturate(o2.y * 2); // Texture AO

    output.OpacityMask = 1;

    return output;

}
};
shader s;
return s.main(t8,t7,t6,t5,t4,t3,t2,t1,t0,tx,viewDir,vc,vcw);

Any help would be awesome thank you!

I figured it out there was a line of code that need to be removed:

{ output.OpacityMask = 1 - o0.w; return output; }

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.