Question Regarding Setting Material Parameters from Blueprint

Hi, I’m attempting to change a scalar parameter for a material instance using blueprint. Apparently, the only way to do this is to use a parameter collection. For what I’m doing, a parameter collection would actually end up resulting in more work for me because I would have to create additional materials, instead of just working from material instances. The reason for this is because I’m attempting to create a MasterMaterial, from which many material instances are derived.

Is there a way that I can change a scalar parameter for a material instance using blueprints?

If not, I respectfully request the ability to do so. :slight_smile:

-Neil (CaptainMigraine)

have a look in “content examples” project in the “blueprint_overview” map and check “bp_eventgraph”. It changes color of an instanced material in event graph on begin event with a timeline (but any event will work too)

If you’re not looking to change the value globally, but rather on each object separately, then you can use dynamic material instances I think ( I was under the impression that material parameter collections were useful for changing a value globally (i.e. across multiple materials).

Am I right in thinking you’ve got a master material which exposes some scalar parameters to material instances based on it, and it’s these parameters you want to change?

You can create as much as parameters as you want in your material and you will can change value of anyone you want like in the example i gave where only a part of the material have is colored mofified.

material instances are instances (not to be mistaken as child class), you can change/modify parameters (inlcuding texture files)), but not add or remove.

if you want to edit a parameter (say emissivity), you need to create a scalar parameter in the parent class, then the instance will be able to change the parameter.

You will need to create a ‘MaterialInstanceDynamic’ instance of your material first in your construction script (see attached image #1).

After you have set it to a variable, drag the variable onto the graph and choose get, from this pull out the blue wire and type “setscalar” and it should highlight the right one for you. The reason the node in your image won’t work is because that node is used for a MaterialParameterCollection, which isn’t what you want, you need the one for MaterialInstanceDynamic (see image #2). If you turn off “Context Sensitive” in the search box (when you right click on the graph background) and search for “setscalar” or “setvector”, the one you need is the first one in the list, there will be 2 with the exact same name when you search.

Hope that helps! :slight_smile:

Thanks everyone for the responses so far. I’m attempting to figure this out, but so far to no avail. Things look different because I’m using Unreal Tournament’s UE4, not Unreal Engine. Apologies, I should have mentioned this ahead of time.

This is what my Dynamic Material Instance looks like:

And this is what my Set Scalar Parameter looks like:

Because of this, I’m unable to fully follow some of the recommendations listed above.

I have not had a chance to try this yet, I will try to figure this out now.

Figured it out!