How To Change A Material Instance Parameter On A Blueprint Object?

So I want to basically push a button and have the thruster material on the back of my ship change to a bright glow.

I was able to follow the blueprint material video’s from Epic, but their method is an on or off material value change. I want to gradual change over time these values and that is why I am trying to use a matinee.

I have my material set up, set up parameters for all the parts that I want to change over time. I have created my matinee and even tested it on a static mesh (changed to a mover) and tested the functionality by playing the matinee. (So I know the matinee works and changes my material values.)

So everything works in this context but now I want to add this animated functionality to the blueprint I have for the flying template demo space ship. (I have replaced their ship with my own.)

So if I use a level blueprint I can select my matinee and then right click in blueprint and get the “Add Reference To” matinee, and then I can proceed to hook things up to triggers and play nodes. But if I try to use this same workflow for adding the matinee in the blueprint for the ship/craft then the “Add Reference To” matinee isn’t there. (Even when turning off context sensitive button.) So I’m not sure how to add a matinee in this section so I can add the button press to invoke the material change.

The other thing I am not sure about, when working with the matinee in the matinee editor, I have to select my ship/craft and then right click over an empty group and add actor. But I’m not sure how I take the static mesh that was added to the components of the blueprint and then make the matinee vector material values effect this mesh that is part of the blueprint that is being used for my pawn for the level.

So again, I have a lot of smaller pieces figured out but I’m not sure how to assemble everything to produce the final effect. (Thanks in advance for any help)

10 Likes

, thanks for the reply. I guess I am just more familiar with the older way of doing things. So I will have to look into using a timeline as you suggest. (I do know that this will work) but I am interested to know if this just isn’t possible to use a matinee to get the job done. Thanks for helping me out! :slight_smile:

, I see. Can you give me some hints for the things I need to add for the blueprint part of the timeline? I know how to get the timeline and set up a vector keyframe, but how do I tie that to the material? Thanks again for the help!

, you are awesome!!! Thanks for the help!!

You should use a Timeline instead of Matinee for this. You can set the parameter in the timeline as a curve from 0 to 1(or whatever the value you want to use in the material) then play it when the key is pressed and reverse it when the key is released.

It is possible with Matinee, but Matinee is level dependent, so you’ll have to do this for every blueprint of your game levels. With Timeline you can do it easily in your character blueprint only. So Timeline is tidier and better. :slight_smile:

First you need to create a dynamic material instance of your material in Construction Script, like so;

9467-cs.jpg

And then, head to Event Graph and get that variable you set. Drag from it and find Set Scalar Parameter Value(or Vector if that’s what your parameter is), set the parameter name and connect the nodes as you see here;

Now whenever you press the key the timeline will gradually increase the parameter value and then reverse when you release the key.

15 Likes

I was hoping that I could put this one to rest, but I am not getting the performance that I would expect. I want to drive multiple values in my material all at the same time. (Or at least appear to.) I have in my material instance an “EmissiveGlow” That controls the amount and color of glow on the craft, I have “LinesSpeed” (A 0-1 value that is being driven by the red channel of a 3 vector parameter) that changes the lerp alpha value on two different UV tiling rates. (one fast and one slow) I have “Thrust Amount” (A 0-1 value that is being driven by the red channel of a 3 vector parameter) that changes a lerp value for the glow amount on the thrusters go from the red you see in the picture to a bright white color. And then I have the “ThrustColor” that sets the color of the glow on the back of the ship from redish to the white color.

So with my current set up only the EmissiveGlow color changes (once and doesn’t reverse out on button release) and the ThrustColor is changing and that one does go back to the red color that you see in the pick after button release. So only parts seem to be working. (It feels like the pieces that are driving a 0-1 value with the 3 vector curves don’t work. This is odd because this set up works in the material instance that you see off to the left.)

For the timeline curves I am using vector curves that have r,g,b curves.

Currently I play the game to the left and view the blueprint to the right I don’t see any of the glowing arrow lines move through the blueprint to trouble shoot what might be going wrong…again any help with this would be greatly appreciated!!

, thanks again! I will give this a go. Thanks again for all the help…I really do appreciate this. So I didn’t know about the sequence node, I think I tried a multigate and that did nothing at that point. The sequence node produces a lot of ugly wires…but hey… as long as it works!!

, this worked like a charm! Thank you thank you!!! It’s working!! I figured out the left shift wasn’t working because I was using it in the level blueprint when I was trying out the matinee method and forgot to delete the left over parts. So happy this is working! Thanks again.

I do have one last question that I am not sure about…In the flying template they are using something called thrust to drive the blueprints. Now every time I add a thrust or try to use the one that is already in the scene there is no “pressed” or " released" there is only input axis thrust and axis value… would I be able to drive this set up with the “input axis thrust” somehow even thought the pressed and released are not present? It would be nice to have one universal control that was driving everything!

You need to use Sequence nodes for every input and timeline. Right now only the first function would work properly, and the following ones wouldnt reverse(even if they could play) since there is nothing telling them to reverse.

So, you should try something like this:

Also make sure Consume Input isn’t enabled for those keys. That may be why Left Shift isn’t firing.

Glad that it’s working!

On Input axis…sure you can use only that as well. All you need is Compare Float node, and compare the axis value with 1. When it is > and = to 1 that would be your pressed input, and < would be the release input.

Hope that helps!

I just wanted to say thanks again for helping me work through this problem. I did go back and clean things up a bit and used input mapping, it made things a bit easier and cleaner to work with in Blueprint. I thought I would share the process and the results. Thanks again!!

InputBinding

Hi guys! Great post. Very informative. I’m trying to change a dynamic material that is being used as a decal and for some reason I can’t get it to work. I basically have a decal, with a Scalar Parameter being fed into the emissive through a multiply. Then I made a blueprint with a decal component and pointed to my decal material. Here are my graphs…

Any ideas?

So…I guess i should be more clear. I want to use a trigger volume outside the decal blueprint. Right now you would have to walk into the decal volume for it to work. I basically want someone to walk into the trigger volume, then activate the material instance parameter in the decal blueprint…hope that makes sense…

This should work too…but isn’t…pretty simple. I just want the texture to glow once the player walks into the trigger volume. Ugh.

Doesn’t seem to be working with any parameter.

Have you tried it with a normal opaque material? Is it not working with decal material only?

Oh ok, you’ll create the dynamic mat. instance in decal BP, then communicate between the trigger BP and decal BP with a BP interface to change the parameter value.