Location Mask - Affecting Multiple Materials

Hello everyone,

I am a programmer who has been getting into U4 Materials lately.

That said, I worked on making a pretty cool location mask material last week, and it is working great, but I need this material to affect every mesh on my scene, including meshes that have a different material or list of materials and I do not want to replace their original materials.

So, while I know I can create and apply a material instance to every mesh on the scene through Blueprint/C++, this would simply replace their current material or materials with the mask material, which in turn makes those meshes lose their original base color, normal maps, metallic, etc… and that won’t do.

I also know I can actually set this up if I turn the Mask material into a material function, and then go into each different material and implement it from there, but for the purposes of this question, please assume that is not an option, I want to find a dynamic solution that would let me get the results I want without having to manually add a material function to each material that has already been created.

To summarize, how could I have a Location Mask Material’s Mask affect all materials within a level without adding a material function to each one of those materials.

Any answers, help or advice would be truly appreciated.

Thank you.

Short answer: You can’t.

Long answer: You can modify the shader files and add your function to default material template, while doing respective changes on the code side to update mask parameters, but it is likely to be not worth it.