Declare where to set parameters

Hey!

I’m actually working with materials in C++. I just set up this:

UMaterialInstanceDynamic* material = CreateAndSetMaterialInstanceDynamic(0);

then I declaired it like that:

material->SetTextureParameterValue("DIFFUSE", texture);

So. Here comes my question:
How can I decided where and how to use that texture?

For example, use it as base color or stuff like that.

I hope there is help out there… Thanks!

Hello .black,

Can I assume that you mean using it in the Material Editor? In this case, you’re not creating a new parameter to be used. I believe the SetTextureParameterValue is meant to set the parameters on the Texture that is being applied to the MaterialInstanceDynamic. I don’t have much experience with using this particular function but I’ll be looking into it to find out more.

Edit: I found out more about this. It turns out that this doesn’t actually create a parameter, but you can link them via the name. If you open the material in the Material Editor, then hold T and Left-click in the Material Graph you’ll get a new node called Texture Sample. Right-click the top of this node and then select “Convert to Parameter”. After this, in the Details panel, change the “Parameter Name” to match your code. In this case it would be DIFFUSE. From that point on, anytime you call that function in code, it’ll edit this parameter.

Hope this helps!