Independent material instance with Blueprint

Is there a way of controlling parameters on a material instance independently.
Right now I have a static mesh with multiple materials and a blueprint I need to be able to change the colour on one of the materials independently on specific meshes without it effecting the rest right now I am struggling to find out how to do this.
I considered using vertex colour but it seems like you can’t paint on a blueprint but I would require a solution via material property anyway for something else I need to do with this mesh.

Any thoughts or suggestions would be greatly appreciated

cheers

Hi Beelzeboss,

Check out the section of Instanced Materials | Unreal Engine Documentation where it talks about dynamic material instances. You can create one and then call SetScalarParameter, SetVectorParameter, etc… on it to adjust exposed parameters on your particular dynamic instance.

Cheers,
Michael Noland

I am using this but the problem I am having is that when I change the colour on one of the meshes it will apply it across all of them. The only way I see around it right now it to create multiple version of the mesh for each required colour and an instance for each one but ideally I would like to work off just the one blueprint

Hi Beezleboss,

To make sure I’m understanding you correctly, do you have 1. ‘One mesh with multiple sections, each with a different material’, 2. ‘Multiple meshes inside of one blueprint, all using the same material’, or 3. ‘One mesh in a blueprint, but lots of different instances of that blueprint’?

For 1. and 2., if you want to set the color differently for several different pieces (either in the same mesh, or in separate meshes) you would create one dynamic material instance per section or per mesh, and set the parameter differently on each instance. For 3, you should only need one, and however you set the color will only affect the mesh in that instance, not the others.

Cheers,
Michael Noland

I have a single mesh which uses multiple materials

Right now I just need to be able to change the colour value on one of those materials in the editor

I have a Blueprint containing just one static mesh the blueprint is being duplicated in the editor

I have this working now I started over I must have used the wrong node somewhere thanks for the help guys

bool that determines the amount of Element Index’s? or?

@Beelzeboss I wonder if you set up your Blueprint the same way I did? f5444b18cd1972ae32296b55f848fadae9bd7e32.jpeg This works great if ALL the Blueprinted meshes will have 2 materials. T_T

How did you set yours up? I’m getting the error "BP_blahblah More overridden materials (2) on static mesh component than are referenced (1) in source mesh “SM_CubeRounded”.

I think the best way to solve this would be to have a bool that determines the amount of Element Index’s a Mesh has before executing the next set material. :confused:How to do that…?

Ah. well this makes the process add another step for the level designer but it does get rid of that error at least. 70cf0eaf101187520590c27e36a24e80ec54835a.jpeg