Download

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?