Dynamic Parameter Collection for Dynamic Materials

Hi,

I was wondering if there’s a way to Create Dynamic Parameter Collections for Dynamic Materials.

1.Create a Number of Master Materials that uses a Parameter Collection. Each Material uses a subset of values contained in the Paramter Collection.

2.Create Dynamic Materials of that Master Materials on runtime.

3.Create a Dynamic Parameter Collection for the set of dynamic Materials created in 2.

4.Modify the Parameter Collection on runtime.

Is there a way to do this?

Thanks,

March 2021 EDIT:

Maybe with an example everything is much clearer:
I have 2 characters with 5 materials and each material can use a subset of values of a Material Collection.
If I set a value in a material collection, both characters will have the same value. I want to have material collections that I can assign dynamically to each Material Instance.

collections usually used instead of dynamic material instances, not with them.

And you need to modify only parameters in collection

Yes, I know the “normal” behaviour. But it’s not difficult to imagine the functionality that I’m asking from the C++ perspective. There must be a way.

I browsed the entire documentation and it’s not there but as many times, there must be a way not specified in the documentation.

Thanks.

I know it’s kinda late, but there’s a node called set scalar parameter value, and you can set the collection, and the parameter name to change.

The problem is that the collection is unique. You can’t have multiple instances of the same collection.

Imagine I have 2 characters with 5 materials instances each. Each material use up to 2 collections.
The way is currently working is that if I set a value for the collection both characters will have the same values.

I want to be able to create dynamic material collections so each character will have an “Instance” of that collection.

The way to do it that way, would be to make a Material Instance, and then make a dynamic material instance (DMI), set your meshes materials to the DMI you just made. When you make the DMI make sure to make a variable for it, and set it to that. Then you can get the reference to the DMI and set the values through there, using set scalar, vector, etc.

Thanks for your response. Yes, I know “the way”. It would be very cool to have dynamic collections.

1 Like

I honestly understand you and it seems people don’t.
What you are asking for is a powerful feature and i wish they could have added it. Currently there doesn’t seem to be a way to support it without tinkering with C++. Even with C++ , i currently don’t see a way to do it.

For people wondering what he means:

He is Using Parameter Collection in his material. That part is covered.
The goal / question is how can we make this “ParameterCollection” a DYNAMIC PARAMETER/NODE?

Meaning, it would be nice to be able to change which “ParameterCollection” our Material uses at runtime.

2 Likes

I did it in c++ I am honestly very busy, give me some time and I’ll find it for you.

1 Like

Very curious to see how you did it… That’s if you were not using source build. Preferably, the code shouldn’t require changing the base source (epic launcher version). But curious. Please do when you find time…

Yes, I investigated how Paremeter Collections were created and I couldn’t find a way to “reuse” the same system without modifying the engine. So I ended up having a simple “Materials Manager Component” that as long as some Material had the actual parameter, I would keep a reference to easily update it.

Not the cleanest solution but it did the job, specially when the Engine used to crash when attempting to set a parameter not present in the Material instance (that is no longer happening, but I am almost sure it was the case when I developed this)

I uploaded the code in this Google Drive Folder:

https://drive.google.com/drive/folders/1B6WGzcPsSFmaIB9ufKqLlZbHt-xnS6Os?usp=sharing

1 Like

Interesting approach , will take a look later…

Maybe i am being stupid, but just wondering how to use the MaterialsManager?

I second MPC Instances. For me I want to have different wind speeds for trees in different areas all based on the same material using the same MPC variable. It interesting to note the Niagara has Parameter Collection Instances that does this. You can have different fires using the same NPC but with different Instances.