Niagara Particles & Materials [UE4/UE5]

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello and welcome back to another particles video i'm going to give up i'm trying to think of a catchy name today we're going to be looking at the way that particles interact with materials it's like a it's like a crossover episode you know materials are kind of ironically the most important part about particles so you know particles they are moving around they're doing their stuff you know what do you do materials is kind of what takes them to the next level so we're going to jump straight in and we are going to make a new material uh this is going to be called tutorial particle [ __ ] now this tutorial particle material uh is going to be a sprite so you can see here we've got a square we're just going to say base color you are going to be a color blue blue is my favorite color then go to our tutorial material particle thing on emitter update we're going to do a spawn burst instantaneous which is going to spawn 100 particles and on particle spawn we're going to add velocity so you can see now we've got 100 particles they're all just you know spurting out in a random direction now this is where it gets quite pog in the sprite renderer section we're going to click this and we can choose what material our particles are going to be using now by default they're going to be using the default sprite material pretty obvious but we are going to search up our there it is tutorial particle [ __ ] and you can see they are just these [ __ ] blue squares that we set up in that material very amazing yeah 10 out of 10 really good job go team what are we gonna do with these well i'm glad that you asked one of the most important things when you're doing custom particle sprite thingos is they should always be circular unless you're doing something really specifically square with hard edges so what we're going to do is we're going to go to the blend mode of this material we're going to set it to mask you could set it to translucent but as you know translucent particles or just translucent materials in general uh a bit of a bit of a gpu hog i tend to just use masking and dithering so what we're going to do is get this radial gradient exponential we're going to put it into the opacity mask hit save and bam we have a a damn circle now if we go back to our thing you can see that these are all circular so let's go back into the material and we're actually going to have a look at all of the particle related nodes all of these particle nodes you'll see that they're all red input ones um all of these by my understanding relate to some custom data because particles are all instanced together they're using like custom primitive data or something all of these exist on the particle anyway and it's just binding to that kind of so if we were to go particle speed we're gonna get the speed of the particle so if we said particle speed um let's divide it by 400 400 speed equals one and zero speed equals zero we're going to saturate that then we're gonna smash that into an mf lerp put that into the base color so then we're gonna say at max speed these will be uh white or maybe we'll just say they're red just so we can get some really fat contrast and then when they slow down they're going to be blue so we hit save and we go to our tutorial material particle blah blah okay wait hold on i can i can do this i can do this i need to make them faster you can see when they start and they're going fast they're going to be red and then as they slow down to zero they're going to turn blue so this is a really simple easy thing um that you could do with particles let's say you had like some sparks and you wanted them to glow more when they moved faster so the next one we're going to look at is the particle color node you can see that this by default is just white now particle color gets set firstly in initialize particle so we can go color mode direct set and just say hey you're going to be red or something we could also do within you know a random range directly in the in the particle system we can also do things like on particle update this will be very similar to what we did before in the material but more on the particle side of things so we could get the color oh color without a u we could just say color on particle update and you can see here it's just setting it to be white on every particle update but we could say curve color from curve and you can see here the curve index is currently the normalized age so as they go from beginning being 0 to 1 being the end of their life regardless of what their lifetime is we can change the color so we could say as these particles get older uh they're gonna turn red there you go now we could do we could set the lifetime to be random range float so we could say uh between three and six seconds and they'll all age at different rates you can also add extra ones in the middle so we could say we want them to go blue from white and then turn red as they age or whatever um and keep in mind that the alpha is also affected here so if we got the opacity here and set that so that it's opaque all the way towards the very end now you can see that these aren't doing anything special but if we go back to our material we can actually access the alpha here and maybe we could multiply this by that and we'll chuck that into a dithering just because we're not using uh translucent material you can see that we have these kind of fuzzy particles now and as the alpha drops from one to zero they kind of fade out so you might be thinking hey this looks you know pretty cool um but we don't want all particles to fade out you know kind of smoothly like this so one of the most important techniques to know about particles is height lurping now i have a materials video which i'll put up in the little corner that goes over height lerp but essentially what it is is a noise texture so i'm going to get my uh baked cloud noise we are going to subtract one from the texture and then we are going to multiply this by two then if we add them together um i'll just do these like by themselves real quick so let's just say we had a parameter that's going from one to zero and we're going to put this into let's just put into the base color for now so you'll be able to see as i put this down from one down to zero it's kind of blending through this noise pattern going from purely white blending through the noise and ending up as purely black usually you'll add a contrast after this though instead of this parameter here we're going to be using the alpha from our particle color the particle color is going to go into the particle base color i guess and then before we do the contrast of this we're actually going to multiply our radial gradient exponentiation into here and that's going to go into the contrast so now this will go into the opacity mask and you'll see we have our our particle and it's round and then if we go back here you'll see that when they fade out let's make them fade out a bit a bit slower so like from halfway through their lifetime you'll see that they fade out in these kind of this kind of noisy way which looks quite appealing now you can see it's a little bit jarring because all of the textures look the exact same um as they fade out so you can see like the actual pattern itself is all in the same like format it looks a bit looks a bit silly so one thing that we are going to do is get another particle node called particle random which is just going to return a random 0 to 1 value into the particles material and we are actually just going to add that to the text coordinates you could do some whack [ __ ] um you could say particle random value multiplied by you know two prime numbers or something um that are like big like i don't know 27 and i don't [ __ ] know just just two numbers that aren't going to overlap very often and then add that to the text coords then put that into there and that'll ensure that there's like a ton of randomness in the actual uvs of the particles and you'll be able to see that all of the the noise fade outs are different from one another in you know in terms of location and whatnot so you know that is quite uh quite poggers so carrying on from having this fading out noise blah blah blah blah let's just set it back to not have any randomness one really useful particle node in the materials is particle radius and what we're gonna do is in our particle thingo we are going to on particle update uh scale sprite size and this will be scaling over the normalized age of the particle we also have to set the particle sprite attributes to have a set uniform set sprite size let's just set these to 100 by default and we are going to scale sprite size starting at one and they are going to end at uh i don't know five times their size now if we had the color like fading from the get-go [Music] you can see that as these get bigger the texture itself gets bigger as well which might not be what you want if you wanted the texture to stay the same size as the particle gets bigger then you could use particle radius we get the reciprocal of the radius we get the text coord and offset it by negative 0.5 that's gonna bring the corner of zero to like the middle of the thing so that when we scale it it's going to scale from the center of the the uv space we are going to divide this by this and then we're going to divide that by whatever number to scale the the thingamajig to scale the texture so if we now go back to our thing you can see that as these particles get bigger the size of their respective textures is staying the same size so we just did like let's do one particle so you can see this as it gets bigger the size of the texture itself isn't scaling at all uh it's staying the same size it'll be a lot more obvious actually if i i should have done this in the first place but if we just got this and plugged it into the base color and we didn't do any opacity mask then you'll be able to see here this texture stays the same size as the sprite card gets bigger very cool wow pogba's poogas we could add all this [ __ ] together we could have the you know the sprite size blah blah then we can add four we're just gonna brute force it until it works basically okay so with this set up taking our you know random texture offset thing um and our particle radius uh texture stabilizer thing put particle color back into the base color and you know we could make these look interesting we could do something like color and start them as i don't know yellow with a value of a hundred hold on wait for it and in the material we will plug the color into the emissive color as well so this is going to create a lot of bloom because of a low dynamic range rendering so you can see here it looks like a kind of explody thing you know wow good job good team wow wow [Music] so there you go there's like a little [ __ ] explosion from that simple effect now you can see how particles and materials interact with one another use luminated cast light from the emissive two that is true that is true this would work with lumen all right so this looks pretty good we've learned a lot so far we've learned about all of the well most of the particle node things if you just type in particle in your material editor you'll see a lot of particle blah blah blah blah blah particle size particle size by pixel units which is like a screen space size thingo you can get the particle's position in world space which gives you like the origin point of the the particle in world space particle direction blah blah you get it lots of particle things now the most important one which doesn't actually say particle in the name for some reason is dynamic parameter now this is an extremely powerful tool the most common way to use this node is in particle update we can go dynamic material parameters and we have the choice between these four floats to send through so i'm just going to disable the the last three and we're just going to use number zero and we can specify literally any parameter from this particle thing to get sent into the material so we can say um curve float from curve we could make the curve index um just the normalized age as usual but we can give this curve some wacky properties so we could say add a key add another key add another key and just make this curve go kind of you know wild it's violin and keep in mind we can make this go above one and below zero if we want um so it is really easy to just create you know specific curves for specific effects and so now we're getting the normalized age running it through this really wacky ass curve and we could go to our tutorial particle thingo and use this parameter in a lerp to lerp between i don't know two colors for whatever reason and now you can see in our particle thingo that these particles are alternating between blue and green based on this curve thing if we if you wanted the fade out of these to be more controlled rather than just using the you know the alpha from the color or something we could just say dynamic material parameters let's just get a nice pulse out curve let's actually use this to drive the opacity um of our particle rather than the alpha of the particle color even like a an up and down thing so you can see that it fades in gets to its full opacity halfway through and then it fades out and you know that's just a way that we could use this in a particular way to get a particular effect so that's an extremely simple way that we can use the dynamic material parameters now you can also do this on particle spawn and this will set the dynamic material parameters as like a one-off so we could get the lifetime of the particle which is like the the lifetime that's determined at the start and these particles are lasting between 5 and 10 seconds let's get this divided by 10 so that 10 seconds is one and zero seconds is zero and let's just learn between again two random colors put that into the base color and emissive so now in our material system the ones that last longer are the green ones and the red ones will always fade out before the green ones if that makes sense so we're getting the initial life span of the particle and using that to set some value in the material whether it's color whether it's opacity whether it's anything so that just goes to show that you can set a one-off material parameter with the dynamic material parameters thing so i think that kind of covers every way that materials interact with particles or how particles interact with materials obviously this is just scraping the surface but i hope that it kind of gave you all of the tools showed you all the tools at least i guess with that we conclude the video and now is the time that i remind you to like the video share it with your friends subscribe to the channel if you want to stay up to date with all the upcoming videos and stuff if you do want to support monetarily you can do through the patreon for as little as one dollar per month in the and so i guess with that we say goodbye goodbye [Music] you
Info
Channel: PrismaticaDev
Views: 25,288
Rating: undefined out of 5
Keywords: unreal engine, ue5 niagara tutorial, ue5 niagara fire, unreal engine niagara tutorial, unreal engine niagara fire, unreal engine niagara particles, ue4 particles tutorial, ue4, ue5, unreal engine particle system, unreal engine particle effects, unreal engine particles, ue5 tutorial, ue5 demo, ue5 lyra, ue5 materials, ue5 material editor, ue5 material tutorial, ue5 shaders
Id: dhjmdXdjw2E
Channel Id: undefined
Length: 20min 6sec (1206 seconds)
Published: Fri May 06 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.