How to pass dynamic array parameters (Float or Vector) to materials?

Hello,
I am trying to pass an array of 30 vectors updated each frame to my unreal materials to be used in a custom HLSL node.
I would like to be able to access all these vectors in my material. I think a good similar example of already used similar case in the engine would be the “PhysicsFieldTargets” parameter of the view uniform buffer for instance.
Is there any way to do this?

What I tried: I tried to find some info on this forum but the threads I found were pretty old. I also know there is a technique with “hacking” the parameter collection usage to do this but I would like something more robust.

Material Parameter Collections aren’t a “hack” solution for this, it’s the primary way you’re intended to pass global scalars and vectors into materials. I don’t see why this wouldn’t work fine for what you described.

Hi, thanks for the reply! I probably didn’t make myself clear sorry. I am aware Material Parameter Collections are the standard way to pass global scalars and vectors, however they are not a simple way to pass arrays of global scalars and vectors. Sure, with the standard way you can in theory pass a lot of values and consider it is “an array” but for each value you need one node in your Material graph

So let say I need to update an array of 50 global vectors each frame, I need to have this huge part of my material graph (or material function) dedicated to just having my 50 parameters: so probably there will be 50 collection parameter nodes, each representing a specific Vector in my Material Parameter Collection. Then to iterate over this array you most likely need some HLSL node as there aren’t any support for array logic in Unreal’s material. This would make you want to make a custom HLSL node with 50 inputs and connect each collection parameter node into these inputs.

This is very long to make and mostly unsustainable.

The hack I am talking about is a way to avoid this unsustainable material graph part, I found it here: Using Arrays in Materials - Development / Rendering - Epic Developer Community Forums (unrealengine.com)
It is mostly working, it is using the direct definition of how the parameter collection layout is made in HLSL so that you can iterate over part of it directly. It still is a “hack” though because the index of the parameter collection you are using can change according to the graph the material is being compiled against possibly making suddenly your custom hlsl node impossible to compile in certain contexts…

What I am searching would be either something like what “PhysicsFieldTargets” is doing in the Engine’s source (like maybe if we could add parameters to the View Uniform Buffer maybe without needing to modify the source?) or simply some “Material::SetVectorArray” like Unity is providing for instance?