Change Multiple Materials with a Single Parameter in Sequencer using an MPC #UE5

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey everybody i want to show you how to use a material parameter collection it came up in reference to how to make a bunch of things disappear at one time but it's actually useful for way more cases than that so let me jump right in if you go to your materials folder this is just the demo starter content scene in the materials folder are all my materials i don't have to put this asset here but it makes sense for me so i'm going to right click go to materials and choose material parameter collection and then i'll call it my mpc and i'm going to double click it a material parameter collection is just a collection of material parameters as the name implies so let's look here we have either scalar single values or vector multiple values that we can use here so i'm going to click on plus to add a scalar value for this first example we'll talk about the question that came up which is how to fade off multiple objects but you can use this for anything in your material so i'm going to hit plus i'm going to open up my first index here and i'll give it a name we'll call this fade and i'll set the default value to 1 because it's going to be my opacity of my object and we'll just default it to one to begin with and that's really all we'll do for now we'll come back here later and show how you can even change colors of multiple things at one time so but for now let's just hit save and close this so that's my first entry in this table of values the mpc now let's go to for example the chair first and open up its material and let's set this up to be able to fade off the chair similar to how we faded the character in the earlier video first we need to open up this opacity mask field so i'm going to go and change my blend mode to masked and if you recall in the other video we needed a dither temporal this little trick to do what we needed in that case and the input for this rather than have a value that we just manually have to modify we're going to grab the value from the mpc and that's the beauty of this system so i'm going to right click and i'm going to type call for a collection parameter so this means you're going to get your value from that collection and you have to tell this node what collection you want because i had it already selected it grabbed my mpc but you can also change it here or if it comes in and there's nothing here because you didn't have it pre-selected just click on the drop down and grab your material parameter collection then you also need to tell it what parameter out of that mpc do you want to use here and i want to use the only one i have currently which is fade and i'm going to wire that into my dither its default value is one so my opacity at this point should be one i'm going to save that so my chair material opacity is going to be driven by this value in my mpc we'll see in a minute how to use it but let's also set up the table to use the same parameter this is the beauty of it you can use that parameter in multiple materials and control it in one place so i'm going to open up the table do the same thing set this to masked add a dither node connect that to my opacity mask then go get my material parameter collection input so i'm going to right click do a collect another collection parameter input it defaulted to my mpc because it's selected in my content browser i'm going to connect this to here and i'm going to tell it it's airing because i haven't told it what parameter i want to use out of it yet i want to use the fade parameter and now the table is set up if i go back to my level here and i want to as the original request was fade off multiple objects in one simple method i'm going to make a new level sequence at the content level just quickly not going to be too organized here just for speed double-click so here is my level sequence where i want to control that now in the previous video i grabbed the individual character and brought in a reference to the material directly for that character and then faded a parameter that i set up but now with the mpc what i can do is i'm going to bring my sequencer here for a second so i can go into my materials grab my mpc and the mpc is what we're actually animating and that will push the changes into each place where the values are being used so bring this back down here so the mpc i want to go grab a parameter from the npc so i click here and i only have one again it's the fade and now here is my fade at a value of one i'll go out a few frames keyframe this to zero and my objects disappear because they're wired into that dither node all right so now i can fade off multiple things at one time now that is just one use of the mpc let's take a look at what if we want to use a vector or a color which is actually a good thing to talk about because there are some tricks related to that we need to be aware of so i'm going to go back to the materials going to open up my mpc and i'm going to go to the vector parameter and add a parameter here i'll just call this my color and you get four values here now this is important to notice there's four values and we may not need four in our material so we'll address that when we get there so let's set a default value here this will be the default when we use it let's just keep it easy and just make the color red and we'll keep an alpha of 1 and let's go ahead and save that so we just have a generic my color that we chose here in the mpc and i'm going to close that and go into my chair this is the orange of the chair now i don't want to use that orange i want my mpc i want to be able to keyframe this value so what i'm going to do is i'm going to right click add a collection parameter here and i want to set my mpc to grab my color we had set the default as red now we'll get a little bit of an error here but we can work around that let's connect this to our input instead of the orange and you'll see there's an error and the error is i have a float 3 and a float 4. so this has four parameters this only has three parameters so what we can do in this case is we can just kick out that alpha channel by using a node that you'll probably need to write down because it's easy to forget what it's called and the node you want to add is called component mask and it defaults to just letting the first two parameters go through so we're still going to get an error right because if we select this it's showing the r can go through the green can go through but the blue is blocked so i'm going to add that now just the rgb are being passed through and going into your b input instead of the orange so now when i save this and go back to my level and i turn my opacity back on in my sequencer here now the color of the chairs is red now that can be animated here as well because i'm using the mpc in my sequencer so i'm going to add another parameter of my color in here so here's my color here's fade and let's ditch the fade for now because we're just focusing on the one object and so my color is keyed here at red and let's just go to frame 30 and we'll change the color here and then maybe go a little bit more add another value there and this is just a matter of changing colors so now we've animated by animating the mpc's value it's pushing into the other values and i can modify that and again the beauty here is what if i want this table to also change colors and to match the chair i can use that same mpc value should be pretty straightforward here this is the orange of the table again tab collection parameter go get it my color we need the component mask to enable the blue as well kick out the orange save that and now your table is also using the same color parameter so you can probably find multiple uses of the mpc it's really just a table of values that you're using to push into as many different materials you want and you can control them all in your sequencer by just animating whichever value you want to change hope that all makes sense hope you find some good use cases for this and see in the next video
Info
Channel: 3D Education with JC
Views: 4,130
Rating: undefined out of 5
Keywords:
Id: RxAeySwzusU
Channel Id: undefined
Length: 9min 45sec (585 seconds)
Published: Sun Aug 14 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.