Runtime Swapping Layered Materials

Imagine a mesh, one material, masked for regions. Say I want to apply loopable materials to each region.

The obvious candidate: Material Layers!

These would be perfect, EXCEPT I need the material assigned to each region to change at runtime. And there doesn’t seem to be a mechanism to swap them.

Alternate approaches:
‘landscape style’ blending
Every possible “material” is jammed through a blending node based on some masks. But now EVERY possible texture exists in the shader at once!

‘Just tons of parameters’
Use a fleet of texture parameters with dynamic material instances to swap the “materials” by masked region at runtime. This works, but it’s super gross and robs us of making small material adjustments in the editor.

Maybe I’m just missing something to manipulate Layer Parameters on a mesh at runtime. But if I’m not, how would others approach this dilemma?

Hopefully you manage to see this… Did you ever find the solution to this? It’s exactly what I need too since I’m building something like Halo Infinite’s coating system. Each coating (a preset file storing data such as detail maps, min/max values, intensity, colour, camoflague, etc) is stored as a Material Layer Instance file, which I need to be able to swap out in Blueprints using some sort of “Material Function Material Layer Instance” variable setup. Problem is, that variable does not exist… The only possible workaround that I can think of is terrible, because it involves this :

  • For every coating variation (e.g let’s say I have 5 different reusable LayerInstance presets), I would need to make a new Material Instance for each mesh that supports it. So if I have 10x helmet meshes in my project and each helmet can use the same 5x coatings, I need to make a total of 50 material instances and then use Blueprints to swap out the Material Instance assigned to the meshes. Rather than the much more ideal method that I want to do, which only requires me to have 1x material instance per mesh and the coating is hot-swapped as it’s a MaterialLayerInstance.