[Linux] Unable to define functions inside custom node

Hello UE4 community

I was trying the Volumetrics plugin to use the volumetric clouds in UE4.25 and I ran into a bug.
First when placing the clouds blueprint : Blueprint’/Volumetrics/Content/Sky/Blueprints/BP_Volumetric_Cloud_Layer.BP_Volumetric_Cloud_Layer’ I didn’t see a thing so I opened the material and I found this error :

/Plugin/Volumetrics/Private/VolumetricCloudFunctions.ush(68): error: syntax error, unexpected ‘(’, expecting ‘,’ or ';

I went to the source code and opened the file searching for the error to correct but it was just the declaration of the function that causes the problem.

So I created a simple custom node with this code inside :


struct StructExample
{
float A;
float B;

float Mult( float a, float b){
return a*b;
}
};

StructExample S;
float num = S.Mult(A, B);

return num;


And i receive the same error :

LogShaderCompilers: Display: /Engine/Generated/Material.ush(1858): error: syntax error, unexpected ‘(’, expecting ‘,’ or ';'

MaterialEditorStats: Error: [SM5] /Engine/Generated/Material.ush(1858): error: syntax error, unexpected ‘(’, expecting ‘,’ or ';'

Is there a possible way to create a custom node with functions and structs inside on Linux or I should separate the .ush file into multiple custom nodes ?

Any help would be greatly appreciated.

Best regards

Hi,

i encounter the same problem on UE4 4.22.1, by creating a custom node in a new material, replacing code by yours, and then attached the output to any input of the material (base color or anything).

and i receive the exact same error message.

after looking at HLSL code it compiles to this :


// Uniform material expressions.
MaterialFloat CustomExpression0(FMaterialPixelParameters Parameters)
{
struct StructExample
{
float A;
float B;

float Mult( float a, float b){
return a*b;
}
};

StructExample S;
float num = S.Mult(A, B);

return num;
}

which means on Linux this problem already existed in this version of UE4 since the same code works on Windows ? (i’m using Ubuntu 18.04.05 LTS)

Also i compile UE4 from source, if it could help.

Best regards.