Download

Creating all permutations of a master material.

I have a master material, with about 10 static switches to change the behaviour of the material.
I want to auto generate a new material for each possible permutation of static switch settings, and put these materials into an array that can be accessed in-game.
Anyone know if this is possible?

The reason i need this this, Is I want to give the player control over the static switches in-game.

I have considered using editor utilities to do this, however I don’t see a way to set material instance static switch parameters with these.

Switches are not meant to be changed in runtime. They are meant for developers. It compiles any material instances with these settings before packaging.

If you want switching for the player, use lerps with a param for the alpha. This does make the shader more expensive because the calculations are present but not visible.

I’m sure there are more optimal methods, but not without digging deep into the engine.