UE5 Materials Tip - How To Create U & V tiling parameters for Material Instancing

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everybody today we're going to talk about materials and specifically talking about how to split out the u and v channels so that you can modify them separately in a material instance but as we cover that you'll maybe learn some other tips and tricks regarding materials as well so here I have just the standard minimal default starter content scene and that's fine for what we're going to look at this can apply to many other situations as well so go for the concept here not the exact example so I'm going to apply maybe this rough Cobblestone here to the surface and maybe you think that looks fine maybe you want to adjust the tiling or maybe you're applying this to a piece of geometry that if we select this guy here and scale it a bunch it looks stretched and weird right so you might have depending on what geometry you're using the UV layout might makes for some strange looking tiling so let's talk about how we can modify this so that you can adjust the u and v separately now uh let's stretch this crazy out that way so we need to stretch it only in One Direction ideally so I'm going to open up the material here and if we look in this particular material you gotta go fishing around for a little bit let's see where is this uh wow that feeds a lot of different aspects so this node here in any of your materials you're likely going to have a texture coordinate node that can modify the U and the V tiling which is okay for a start but gets to be a little bit inconvenient when you're going to be doing material instance uses as well which we're going to set up in a second so you could technically and it would work fine at a small scale if I move this around a little bit so we can see the surface here let's see is this U or V let's try making this 10 times in u and saving to see how that looks on our surface here now again this isn't the ideal way to do it which is why we're going to go over a better way to do it but I'm just setting up the issue here for us and all right so it wasn't the U axes that I want to change let's say we'll try it over here and again the the pain of this will be resolved with what we're going to set up in a second I just want to again lay the foundation here what we're trying to get done so here we've modified it all right it's a little bit too much but you get the idea right so you can modify them separately but notice how we're having to save the material each time here to see how it works and then what if we had this applied to different floor surfaces and we needed each one to potentially have a different setting okay so now this isn't looking too far off the original situation but again uh this is kind of inconvenient having to come in here in this node and again we want this scalable this so that we can do it for other properties as well so let's first talk about setting that up so if we have a parent material here I'm going to right click and make a material instance and I'll leave it named as it is it's the same thing with inst at the end actually you know what I'm going to do is what most people do I'm going to get rid of the inst at the end and throw a mi at the front you'll recognize this from the qixel materials you might be downloading in the future as well they use the Mi naming convention and when you rename it it's going to drop down to the bottom in this case because Mi comes after all these m underscores so I'm going to open this and when you're using an instance you'll have an opportunity to override parameters in here however you don't see any parameters for adjusting u and v separately so let's talk about how to get a u and v in here let's go back to our material here so in this value here we have the U and the V and what we can't do is as we've seen on other nodes you can't right click and turn it into a parameter in this particular node so we got to get a little tricky here to be able to split these out separately so that we can modify them so what we're going to do is we're going to hold down one and click and one and click again these are our two values that we're going to multiply that u and v by here so I'm going to name this one actually I need to right click and convert this to a parameter as well as this one convert that to a parameter that'll allow us access to overwrite it in the material instance again you'll see what that is in a minute let's just call this one you tile and we'll call this one V tile you can kind of call it whatever you want just something you would recognize in the material instance all right so here's our values and let's just default each of those to one so our initial difference we won't notice we still want to keep this original texture coordinate and let's set this back to one its default value there but we want to be able to modify these two values by these two parameters as a multiply so hold M and click to get a multiply node and if you hold Ctrl you can control drag that entire chunk there and plug it in to the multiply and then we have our original texture coordinate u and v values going in here now here comes the sneaky part of how do we multiply we have two values in here u and v tiling and we want to multiply those two values by these two independent values but you see there's only one input here so we need to combine these two together using an append Vector node so grabbing a pin vector and what this does let's put this into a this into B this makes a two Vector value coming out of this end and when you have a two Vector value multiplying times a two Vector value which is the texture coordinate if you read this pop-up it tells you the multiplication happens per channel so that each the first multiplies the first the second multiplies the second so this is exactly what we need by making it a pin so that we can make a vector to multiply by a vector and plug that in here and now this is set up so that you have these two independent parameters that you can use to modify this set of parameters that's stuck inside this node here so I'm going to save and again this is on the parent material and as soon as that saves the way the instance works it inherits the changes of the parent so now you'll see that you have access here to modify that u and v tile separately so one thing we need to do as well is apply this instance to our little plane out here and you didn't see anything change really because we're not overriding any value so it's doing the same thing as the parent at the moment but you'll notice down here at the Mi is the new material that's been assigned so now I can come up here if I want to modify the U I can do that and what's nice is you get instant updated here as well and I can turn that back off if I want so if you turn this on that enables whatever value you have here if you have it off then it just accepts whatever the parent is pushing into that so in this case I actually want to modify the V to tighten that up a little bit so now you have control over these two different values of your u and v so that you can modify per use of your material and one other advantage of having these pulled out separately is offhand I don't see where you would use it in this exact example but if you have some cinematics and you're using a level sequence you can animate those values once you've promoted them in an instance so let me show you what I mean let's just make a mess in the materials here and add a level sequence terrible organization skills but it's just for an example so if I add this plane into my level sequence and maybe I want to animate these u and v values here inside my level sequence for whatever reason just showing something you can do you would go and add your static mesh component into your level sequence and then you want to add the element zeros or material that we're using and then once you have access here to the material because it's instance you have access to those particular parameters that you promoted so you can modify them here inside a level sequence so say adding the v-tiling uh the current value is five and whatever it was before you know something like one then you hit play and then you're modifying your texture over time again in this exact case whatever I don't think you would need that but just so you can see when you promote variables in your materials you can access them here in the level sequence let's take a look at how quixel handles materials and this kind of thing and you'll see that they've already have most of these set into their material instances so if we go to the bridge go to surfaces and let's for example get some bark Birch I'm just clicking on whatever's here and I gotta sign in really quick and then let's download and add it to our project and here we have this material just came in so if I double click to take a look at it notice it's Mi it's a material instance so I'm going to double click and if we open this up we've got tiling settings here and they've already split out the tiling into X and Y so you can turn that on they use X and Y I used u and v but same idea so then you can come in here and do the multiplier and do the same thing using the instances that quicksil has set up for you so that's the idea of what we did by ourselves because you're not always going to use a pre-setup material instance from qixel you may be building your own so it's handy to know how to set that up maybe you're creating your own simpler material and you just want to come in here create a material and you want to use the textures that they provided here let's just dock this over out here minimize this here's our level right so here's here's a handy little trick that you may or may not be aware of so here on our materials tab I want those three Textures in here so I'm going to come over here and select those three textures I'm going to drag them up onto this tab let it sit for a second and then drag it down here so that's extra little bonus tip for you today let's see this is our color into the base color and our normal into the normal and if you grab these from quixel you'll see the back of the name here tells you o r d so O is for your occlusion that's your red Channel the r is for roughness your green going to roughness and then if you're using displacement you can use the the other channel as well to see what those look like individually if you double click the texture there you can see that is your aiming occlusion that is your roughness and that is your displacement so that's just the three channels of the texture that you get and I'm using those there and again if you were setting all of this up from scratch and you want to modify the tiling you want to hold down U and click to get a texture coordinate node all right so you would run these into your three different inputs here and again we're just looking at the same thing as we saw earlier you can modify it once here but if you're going to be using this and using instancing and want to control your u and v separately again just really quick hold one and click hold one and click take those and convert to parameters give them a name run those into a pin Vector so that you create a two channel Vector out of those two individual values and then hold M to get a multiply node in this case again control click and drag to pull out all those little sprouts and run that into a run that into B and now you've set up again you got to name these and save and all that kind of stuff and now you're set up for a to be able to modify these values in an instance however you might say what happened here that's just because these default values are defaulting to zero so if you come in here and set them to one it'll look a little bit better all right that was how you would grab some quixel textures and make your own simpler material if you don't want to deal with their super complex one but you know theirs is pretty nice so you may want to just stick with theirs all right that's it for today tomorrow's Christmas wanted to sneak in one more video so enjoy this a little gift from me to you for Christmas merry Christmas everybody see you next year
Info
Channel: 3D Education with JC
Views: 9,040
Rating: undefined out of 5
Keywords:
Id: SKBHoENjG68
Channel Id: undefined
Length: 13min 48sec (828 seconds)
Published: Sat Dec 24 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.