UE5 Tutorial: Create a Moving Material with Random Speeds on Multiple Objects. #unrealengine

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey everybody I'm going to show you how to set something up like this this is a request I had from someone I was helping about making a bunch of columns with falling LED lights and how to set that up in a material so let's dig in we're going to just do this in the third person template so when you start up choose games third person and hop in here and just grab yourself some cylinders or a cylinder for starters and we're going to go ahead and make it tall and skinny if you want to turn off snapping you can do that over here like that then you have a nice and smooth so once you build your first cylinder here I'm just going to alt drag to make a couple more so this will be the the pattern we're going to use for our falling LED material so let's go ahead and make a folder for our own materials here and let's create a material let's start first with the making of the LED band so there is actually you may not know this but there is a generate band node it's one of the more obscure kind of nodes and you have a width so let's go ahead and put in a variable for that so hold one and click to put a single value here and we're gonna right click make it a parameter so we can adjust it from a material instance and we'll just call it oh I guess we'll call it band with and we'll go ahead and plug that into our base color just so we can see that it's working we got a lot of work to do but this will get us started oh we also need a value here so let's put in 0.1 all right so there's a band you can also switch your piece of geometry over to a cylinder conveniently to see our band showing up here we have some other parameters here but we're not going to mess up those at the moment we just want to keep setting this up also for this material the person wanted it to be glass with an LED going down so kind of like a light bulb so what we need to do is for this material we need to change the blend mode to be translucent and we're also going to come down here switch this to surface translucency volume all right next uh we want because this is a transparent object we want this part where the light is not to be clear so we can actually take the same output for now we may need to change it later depending on what we're doing but we can plug that into the opacity where it's white it'll be solid where it's black it'll be transparent and here comes there it is right there now one thing that seems to be new in five two actually is if I come in here to the material you'll see there's a refraction here for something to look like glass it should have some amount of index of refraction but right now that is disabled so again I think this is new in five two I don't remember this in previous versions that you have to enable it so let's just do a search for refraction the method is none let's switch that over to using index of refraction so that's something you know scientific you can look up index of refraction table if you want glass technically now it kind of depends on what you want it to look like in the end but 1.5 is roughly the index of a refraction for glass so I'm going to hold one and click get another value here to plug into that and changing this into a parameter clearing the filter and let's go in here let's give the name ior for index of refraction in case you want to change it out in the material notice when I add that and zero does something as well but if we want to keep it roughly in the realm of physics we'll put in 1.5 and we get a cylinder you can kind of see it starting to look glassish it's going to look better on the narrow one again it's relative to what you want it to look like you can change it to be a different value to again just what you want to look like so we have transparency and we have a little bit of index of refractions so let's next look into the idea of the moving light so for the moving light this generate band has input coordinates where you can modify your UVS so let's hold down U and click to get texture coordinates and on its own it won't really do anything if we need it to move we need a Panner node so hold P click and let's plug your UV your textual coordinates into the coordinate of the Panner the output of that into your input coordinates of the generate band and here's your speed values for X and Y we really just need it to go in the y direction if that's the look in this particular case we need so let's put in let's try one and see what happens and we get some direction going to it if this is supposed to be a falling speed you can just negate that if you want make it minus one it'll go the other way all right so we're coming along let's save this and see what we get so far all right I'm going to go ahead and dock it next to my map here here's the material and I'm going to shift select all of these and I'll go ahead and make an instance which is decent practice so right click create a material instance I haven't named these you know if you can name it whatever you want that's fine and let's go ahead and put the material instance into the material slot for all of these and we get are you know glass with an LED band moving down it for starters so now the request was to make these variable so we want some random speeds on these and not to look uniform so let's head back to the material and for that what we need is to vary remember that the speed is coming from this parameter here in our paner node so what we want to do is use another node called random per instance random and what this will do this generates a value between 0 and 1. for instances now unfortunately there's two uses of the word instance there's the material instance which is what we applied back here to our material to our surface that's not the instance that's not the per instance which is what this node is useful for this is per geometry instance so we'll talk about that in a minute when we get back to the geometry but it generates a value between 0 and 1. so we want to vary this parameter here this y speed between a value of 0 and 1. so let's go ahead and do a multiply now it gets a little tricky because we really only want to multiply the Y value so let's go ahead and split out set this up properly or proper is subjective right this is something that will get the job done so I'm going to add single coordinate single coordinate this is going to be my X and Y speed so I'm going to convert this to a parameter for my speed and I need a append node to put these two together so a pen Vector this will put the X speed and the Y speed values that I'm using here I'm going to start with the default value of -1 and this would go into my speed input to take those two values here and here actually if I want to be really specific let's just be proper here and put a y there so your y speed and it's going to go at that particular speed now this random value we want it to randomize the Y so what we're going to do is make a little space here now for those of you who don't like math you're a little out of luck because we got to do a little bit of math here so here this again it's going to Output a value from 0 to 1. so let's go ahead and hit a multiply node here and we're going to take this value of -1 and this will multiply it by a value between 0 and 1. so our overall Randomness at the moment is going to be between 0 and minus 1. the zero we probably don't want a speed of zero right so that's kind of like eh not quite ideal of what we want how about between -1 and minus 2. so let's go ahead and give a little offset to that so let's set up a add node so hold a and click I know a little more math but you can handle it so we're going to run this in to here let's make another variable and this is going to be our offset our speed offset so right click convert to parameter I know it's it's not that much math speed offset so and what I want to do here is at this node remember it's from 0 to -1 I want to push it from -1 to minus 2. so what I'm going to do is come here and for this speed offset I'm going to put in a minus 1. and then so now taking this into here instead that will adjust the speed of our painter to be I'll come back to this per instance to be varying between -1 and minus 2. all right so save now it's random but if we come back and look at our results here we don't really see anything specifically random that's because the same material is being applied on five unique independent cylinders so what we need to do is make an instance setup of these cylinders so these five individual cylinders are going to be instances and you'll do that by selecting them all go to actor merge batch you'll see it hides all of those cylinders and this one is active and you like where did they go it's causing them to recompile but now we're getting some variation in our output okay now if we want to make some changes let's go ahead and open up the instance and in the instance we have set the ability to change the width of the LED strip the index of refraction our speed offset and our actual speed so we have our varying speed here now if you go back into your original material let's say you want you know for this span of UVS you want more of the band you want it that skinny but you want more of them so what you could do again these are just kind of playing with settings in the UVS and the materials is you could scale your texture coordinates with the tiling here so you could do it by hand by adjusting it here or you could also set up some parameters for that so let's go ahead and set up two we'll go ahead and convert to parameter convert to parameter we'll call this one V tile and you can guess what this one will be called the utile and we'll start with one and one well actually I'll double it while we're here so this is just doubling the UV scaling onto the geometry actually I just need a tiling and why don't I because we're only going in One Direction in this particular example so again I need a a pinned vector to put those two values together so that we can then use those in conjunction with the texture coordinate node we'll use a multiply take whatever that is and then we'll multiply the the one and one that's coming out of here technically we're going to leave that set to one because we're going to multiply by these values here and use those into our Panner so now you'll see the bands are closer together for the extreme if I set that up to five we have a bunch of little bands together so it's just something that you could have creative control over totally up to you now if you want to get crazy tricky you could use a for instance random driving a random value for the tiling of each individual column as well so that's you know it's really up to you whatever you want to mix and match but let's take a look what happens when we do a five times on our v-tiling we should have just a lot more going through there and you can see they have varying speeds and that was the result that the person I was helping was looking for so that's really all I wanted to show you here again just in review the things we're looking at primarily were this per instance random and that was for each geometry instance not Material instance and we use the generate band to get the band going in the first place and you can explore these other settings here if you want then we also have using an append node to put two values together to get it into a a two Vector value so the using it a pen note is pretty handy you could one other thing we could do you could start putting some value into the emissive if you want you could take that same White Band and you can add a molt so you can take that take that into the emissive we could set up a variable here I'll just do this you already know how to do that so I'll just do it directly in here but you could set up a variable to make it something you could control from the instance as well all right so that is today's little trickery for playing around with an LED falling cylinder thingy
Info
Channel: 3D Education with JC
Views: 1,674
Rating: undefined out of 5
Keywords:
Id: SdDbT7VFAIc
Channel Id: undefined
Length: 14min 28sec (868 seconds)
Published: Sat Apr 22 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.