In our game, we have a material effect that needs to get blended into all of the materials on a character, as well as any props they might have attached to them. It is also generally a swap from an Opaque material to a Masked material. It’s a sort of dissolve effect and is how the characters appear/disappear. The issue is that the dissolve material is fairly expensive and so we wouldn’t want it blended all the time with a dynamic material parameter, nor would we want to have all of our Opaque materials have to be set to Masked all the time just to be able to use this effect. There will be many characters on the screen and only one of them, if any, will have this effect animating.
Ideally, we could include this effect as a material function in all of our materials, but have the blending/evaluation switched off with a static bool, and then procedurally generate the additional material instances ahead of time that have the bool turned on and are Masked rather than Opaque. At runtime, we would just do a material swap between the two and then animate a dynamic parameter for blending.
Is this the right approach? Is it possible? Does anyone have any experience with trying to blend to a single material but from lots of different material variants? What are the best practices here?