Changing material parameter for material instance directly on the mesh in the editor

I know there are trick to do that, but it could be nice to affect the material parameter directly on the mesh it is on in the editor mode instead of having to create a blueprint for the object or having to change the value via other trick such as levekl blueprint. I don’t know if I am the only one it annoy or to be frank the only one complaining about it but I tought it was worth mentionning

Thats what Material Instances are for. You create a Material Instance of your Material and apply it to your mesh.

And a Material Instance allows to select a preview mesh; so you may not even need to assign anything at all.

But if you want to assign it to many mesh wirth different parameter for instance, if you have a basic material made for light but you want it to vary on color and on emissent, youll have to either create many instance of the material or change these parameter via bluerprint or other neither of these solution are as effective as they could be

True, but what you are suggesting is EXTREMELY inefficient. You WANT as many things using the same material as possible, it’s one of the main ways of improving performance in any game. If you want per-instance dynamic material instances you want to create a Blueprint encapsulating that functionality with exposed parameters.

I agree that it would be a solution and I mentionned from the start that there are solution to this issue.

First I am not sur you undestand my point, I dont suggest to create multiple material, I am saying that is a solution but I know it is a bad one, I am saying that accessing the parameter WITHOUT the need to create a blueprint would be nice

This is actually EXTREMELY wrong. Changing the material parameters doesn’t mean you are changing the shader (which is the costly thing). In the same way each instance has it’s own transformation, it can have other custom parameters passed to the shader. Actually this is something pretty common… For example to change texture array index, shift uvs, change tiling… I’m digging into UE for a couple of months now, and can’t believe this stuff is not there…

I was under the impression that with each modified material instance UE4 instantiates a new shader with the given parameters. Is this not the case?

Yes, this is the case. For each Static Switch, your Material has in it, a new version of the Material Instance with that code enabled will be generated and added to the shader cache when code behind the switch is activated. This is all done behind the scenes but it is something you do need to be mindful of as this can quickly become a bottleneck for your project.

No. Only if an instance uses different shader, which is the case, if you change static bool parameter or static switch parameter or overrides. In all other cases, it will be the very same shader.

Initial feature request from OP of this topic is already in the engine since 4.23 or 4.24 btw.

So which feature is this? Cant seem to find it in the release notes.

1 Like