Download

Material Function - Adding a prefix/suffix to variables inside the material function.

While I have seen the request a few times on answerhub, I couldn’t find one trough the forum its search function.

I was wondering if at some point it would be possible to supply a prefix option to variables inside material functions?
(Prefix used as an example, I’d be happy with anything that allows better re-use of the same function within the same material)
It is mainly a workflow thing, and while it does not take too much time to either duplicate mat functions and editing their variables (either in ue4 or trough notepad) it would be rather helpful to just click on a material function, add a prefix in its detail tab and have those applied to the variables inside.

Though, --with my limited knowledge-- I bet there is something under the hood of material functions that would hinder a suggestion like this?

Nonetheless, putting it out there!

There is already something like this, in the settings of any material function, there is a checkbox called “Prefix Prameter Names”, but it does not appear to do anything when checked.

I have loads of reusable functions that have some parameters inside them and being able to do what Luos suggests, to add prefixes not from inside the function but from “one level above”, the material containing the function, would make MFs so much more usefull.

Right now I can´t use more then one instance of my MFs in one Mat, since they all share the same parameters unless I overwrite them by passing on inputs from the outside.

It would be great if I could just drag 3 instances of the same MF, for example one for sampling basecolor with parameterised TextureSamplers and prefix each like snow_, dirt_, rock_ and that then would give me the parameters snow_baseColor, dirt_baseColor and rock_baseColor in the material instance.

In addition, this would stop the need for passing on parameters to the parent material/function by adding an overwrite input to the function for each parameter that one might want to control independent form potential duplicate MFs in the parent material.