Material Parameters Array

I have a material that lights up around a parameterized location. I plan to update the parameters based on object locations in the world using Blueprints.

I’d like to know if there’s a smart way to add an array of parameters so that multiple portions of the material light up when they get close to the parameters in the array. I’d like the number of parameters to be virtually unlimited.

Here’s what I have so far. The location is set to the player spawn location.


No ideas on this one?

Hello micahpharoh,

In the future please refrain from bumping threads as we are diligently working to resolve issues as they are reported.

I believe what you are trying to achieve is a material that lights up at a certain place on your floor. Intuitively you would like to add this light to a coordinate where your character comes in contact with or comes close to.

I think you would benefit from looking into Material Parameter Collections. In a nutshell, MaterailParameterCollections are assets that store parameters which can be referenced by a material. This allows for global data to be used for many Materials at once and then brought into level.

Using Material Parameter Collections in Unreal Engine | Unreal Engine 5.1 Documentation

This documentation explains how to set up a Collection, how they are used, how to set them up in a blueprint, and then examples of the parameters in a test level. What you will need to do is set up a detection system for your player, and whatever object you have the material assigned to. From there you would need to add a default state of unlit until your character comes in contact with that area. This can be done through a trigger event.

You’ve got the right idea, but what I’m trying to do is add new points dynamically during play. Each point would flow through the equation above with the results of each being added together (and clamped) before being used.

I know that I could achieve it by having a set number of parameters but I was hoping there was a better way to achieve it.


, I set up the Parameter Collection and converted the above material to a material function. Then I added as many functions to my material as I needed. In blueprint I created an array of names and update each parameter in the collection whenever I need to. I’d still like to know if there’s a way add new parameters at runtime but this seems to work fine so far, though on a limited scale.


You might be able to do this by setting up a single parameter in an MPC. Then, in Blueprints have an array of vectors which are supposed to feed into that MPC value then call a for each loop on the array and create a new Dynamic Material Instance for the new member of that array.

Definitely will take a hit on the performance with this but it should work.

Let me know if it does.

, Sorry I took so long to get back to you. I don’t think MPC will work for what I’m trying to achieve. Each time an event occurs I want to paint a new point on the material. I was hoping to come up with a scalable solution, but having a set number of points (parameters) that I can reassign will work, though it’s a lot less flexible.

There is a way to do this, for a fixed but large number of points. It involves creating two CanvasRenderTarget2Ds to update and store your world locations as pixel values, one is a previous iteration of the other(see my post here). Then you can access the latest render target as a texture object parameter, in order to use it as a lookup table in your material. You can loop over the pixels of the render target from a for loop in a custom node, calling it with Texture2DSample( “Texture object input name”, TexSampler, “UV of pixel index”). Unfortunately, you cannot use gradient instructions in loops with a variable number of iterations, so you’d have to pick a maximum number(might as well be the number of pixels in your render target, your performance may not be bad, but it will always be worst case). Make the default pixel value a world location that isn’t near any of the surfaces in your level.

Might be easier to just do this with decals.