Create your USF. Inside of the material editor, place a custom node and within it, add the following code:
#include “/Project/YOURSHADERHERE.ush”
return 0;
You’ll need to create node inputs for all the various inputs to your struct
Within the shader file, you’ll need a basic setup like this:
#pragma once
struct SomeKindOfEffectWithLotsOfFunctions
{
float3 TestFunction(float3 A, float3 B, float3 C)
{
//more math stuff here
return A+B+C;
}
};
SomeKindOfEffectWithLotsOfFunctions material;
return material.TestFunction(Alpha,Beta,Charley); //these are named after your pin names on the custom node, but need to line up with the function input order
Realistically, you’ll have a ton of other functions within the struct. Just make sure to define them before the main function that gives the final output.