Sending an array (of structs) to a usf shader

I’m trying to send an array of positions (and other info) to a usf pixel shader.
I know I can send float, FMatrix, FVector stuff to the shader via the following macros:

BEGIN_UNIFORM_BUFFER_STRUCT(FMyPixelShaderVarParams

DECLARE_UNIFORM_BUFFER_STRUCT_MEMBER

DECLARE_UNIFORM_BUFFER_STRUCT_MEMBER_ARRAY

  • Can I send an array of floats to this FMyPixelShaderVarParams struct? - Yes, by using DECLARE_UNIFORM_BUFFER_STRUCT_MEMBER_ARRAY(float, varName, [10])

  • Can I send a custom struct inside this FMyPixelShaderVarParams struct? - NO? What exactly makes FVector struct eligible and mine not?

  • Can I send an array of structs inside FMyPixelShaderVarParams? - Same

Hi, I’m trying to figure how to send 4x4 Matrix from C++ to usf shader. Any idea how can I achieve this?

uniform buffer may can help you,but i also don’t konw how to send uniform buffer corectly.this is my questionhttps://answers.unrealengine.com/questions/783475/%E5%A6%82%E4%BD%95%E7%BB%99shader%E4%B8%8A%E4%BC%A0uniformbuffer.html

However,when i finish

BEGIN_UNIFORM_BUFFER_STRUCT(FMyUniformStructData, )
DECLARE_UNIFORM_BUFFER_STRUCT_MEMBER(FVector4, ColorOne)
DECLARE_UNIFORM_BUFFER_STRUCT_MEMBER(FVector4, ColorTwo)
DECLARE_UNIFORM_BUFFER_STRUCT_MEMBER(FVector4, ColorThree)
DECLARE_UNIFORM_BUFFER_STRUCT_MEMBER(FVector4, ColorFour)
DECLARE_UNIFORM_BUFFER_STRUCT_MEMBER(uint32, ColorIndex)
END_UNIFORM_BUFFER_STRUCT(FMyUniformStructData)

IMPLEMENT_UNIFORM_BUFFER_STRUCT(FMyUniformStructData, TEXT(“FMyUniform”));

the code won’t work! HLSL compiling failed.

4.20: Update to
#define UNIFORM_MEMBER_ARRAY_EX(MemberType,MemberName,ArrayDecl,Precision)
#define UNIFORM_MEMBER_ARRAY(MemberType,MemberName,ArrayDecl)
#define UNIFORM_MEMBER(MemberType,MemberName)
#define UNIFORM_MEMBER_EX(MemberType,MemberName,Precision)
#define UNIFORM_MEMBER_SRV(ShaderType,MemberName)
//#define DECLARE_UNIFORM_BUFFER_STRUCT_MEMBER_UAV(ShaderType,MemberName)
#define UNIFORM_MEMBER_SAMPLER(ShaderType,MemberName)
#define UNIFORM_MEMBER_TEXTURE(ShaderType,MemberName)
#define UNIFORM_MEMBER_STRUCT(StructType,MemberName)

AOS seems still not available for uniform buffer, I tried to create a SHADER_PARAMETER_STRUCT and reference it in a GLOBAL_SHADER_PARAMETER_STRUCT, but got crash on CreateHLSLUniformBufferStructMembersDeclaration

Hi.
I need to do something similar but I dont have much experience on coding usf files, I have coded on custom nodes(btw its a pain) and I am also starting with c++ but still not much.
I just have some doubts.

Firstly I supose that this uniform arrays/buffers can only be set up on usf files or can also be on the normal bluprint editor?

Do i need to do mayor changes to the unreal shaders to implement them, or is it just a normal usf file that can be called on a material?

(Not necesary but…) do you have some basic steps or small guide on how to set up this?(c++ or preferedly bluprint if it can be done)

Some forums say to set up a render target and loop on it in material but that doesnt feel right and more like a workaround for this uniform buffers, so I wanted to know more about them.
Thanks in advanced