Feature Request: Converting Material Function Calls To Parameters for Material Instances Controlled Via C++

Dear Friends at Epic,

I am just beginning to dive into material layers here, so please let me know if there’s an easy way to do what I’m envisioning

#What I’m Envisioning

I’ve always wanted a way to truly and easily blend between two materials during game time, controlled by setting values on a material instance

Currently I imagine I can set up a material layer and make the alpha material parameter

buuuut

Would it be hard to actually make the input of the material blend node, a material function call, into a material parameter?


#Material Function Call Parameter

Since I am designing an in-game editor, the ability to allow the user to choose from among several material functions would actually be done best by having a “material function call parameter


#Regarding Variable Types and Quantity of Material Function Parameters

Perhaps there could be a TArray of FStrings for each Material Function Parameter, and you could retrieve from UMaterialInstanceDynamic a list of the input names, and supply the FString version of things like FLinearColor, float, int etc to set the inputs

This would all be a way to handle not knowing what the type of the material function inputs might be in advance, but there’s probably a better way :slight_smile:

What do you think?

:slight_smile:

Thanks!

Rama

PS: Specifically I’d like this to be added all the way down to UMaterialInstanceDynamic for control by C++ during game time

Unfortunately setting an entire material function as a parameter isn’t practical. To do so would require recompiling shaders at the time you set the parameter. That’s not possible on some platforms or in some cases (cooked/shipped games, console, mobile) and in most it’s not desirable as you’d either hitch during compilation or have to deal with an asynchronous compile.

Ahhh okay, well thanks for responding Nick!

Have fun today :slight_smile:

Rama