Material Custom node not work after package to PS4

I write a postprocess shader to blur the near scene, this works fine in the editor, but not work after package to ps4.
Here is my material and Custom HLSL code. Can someone tell me where is the problem? Thanks ;D

And here is the code in custom node:

float4 res = (0.0f, 0.0f, 0.0f, 0.0f);


float2 invSize = View.ViewSizeAndInvSize.zw;


float2 uv = (0.0f, 0.0f);
uv = ViewportUVToSceneTextureUV(ViewportUV, 14);

int TexIndex = 14;
float weights[] =
{
  0.01f , 0.02f , 0.04f , 0.02f , 0.01f,
  0.02f  , 0.04f  , 0.08f  , 0.04f  , 0.02f  ,
  0.04f  , 0.08f , 0.16f  , 0.08f  , 0.04f  ,
  0.02f  , 0.04f  , 0.08f  , 0.04f  , 0.02f  ,
  0.01f  , 0.02f  , 0.04f  , 0.02f  , 0.01f
};

float offsets[] = { -2.0f * BlurIntensity, -1.0f * BlurIntensity, 0.0f, 1.0f * BlurIntensity, 2.0f * BlurIntensity };

uv *= (0.5f,0.5f);
for (int i = 0; i < 5; ++i)
{
	float v = uv.y + offsets[i] * invSize.y;
	int temp = i * 5;
	for (int j = 0; j < 5; ++j)
	{
		float u = uv.x + offsets[j] * invSize.x;
		float2 uvOffset = (u, v);
		float2 uvShifted = uv + uvOffset;
		float weight = weights[temp + j];
		float4 tex = SceneTextureLookup(uvShifted, TexIndex, false);
		res += tex * weight;
	}
}

return res;
1 Like

or can someone tell me how to debug the Shader Compiler?

Iā€™m facing the same issue. Have you solved the problem ?

Yes, I have solved this problem. When writing HLSL code, your syntax needs to be very standardized, especially after floating point values, you must add f, for example float a = 0.0f; float4 b = float4(0.0f,0.0f,0.0f,1.0f), otherwise the GLSL compiler will not be able to correctly recognize your HLSL code.

1 Like