Intro to Unreal's Niagara System

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello and welcome to the first in a series of tutorial videos that I'm going to be making about Unreal Engine 4 and its new nyog redditor if you're unfamiliar with Niagara it's unreal zoo particle system that they're making replace the current particle system cascade it's still in beta so there's not a lot of information out there about it so I'm taking the time to learn it and I figured if I'm taking the time to learn all these things through trial and error I might as well share some of those learnings with other people so that's what these videos are gonna be this first video is going to be pretty high-level just what is Niagara what are the different parts of it how it works how it functions how you change things and how you go about making really basic particle systems so if you're already kind of familiar with Niagara this might not be the video for you it's gonna be a little long because I'm gonna get in a really deep detail on each of the parts and how they work however if you know you've used cascade before and you just want to see what Niagara is like this is a good opportunity or if you just have never touched a particle system in your life this should be a good video for you to start off with I'll be making more videos after this one that will be increasing in complexity so if this one isn't for you but you're interested in the idea of learning how to do things in Niagara stick around I will be making more interesting videos in the future as well so just to start off here we're gonna jump into the editor and I have a project made up here and the very first thing we're going to need to do since Niagara is in beta still is to enable the niagara plugin so we go up here to edit and we click plugins and then we scroll down to FX and then we click enabled right here and it's going to ask you if you want to use this because it's unstable and it could be removed without notice I doubt they're gonna completely remove the plug-in anytime in the future but it is a little unstable it does crash sometimes but it's not terrible just make sure that you're saving things regularly but this is not too big of a deal so just click yes there's also Niagara extras which just cool stuff that epic did with that that they didn't think was core functionality so it's not included in the core tool we're not going to use that right now I haven't really looked into it too much so we're just gonna stick with just basic Niagra and we have to click restart now down here so it's gonna take a minute and then we'll be back in a second to dive in and we're back so it pops back up with this window but we should be able to access Niagara now so what we're gonna do is we're gonna come down here to the content browser click this to show the hierarchy we're gonna create a folder in here called particle systems and we're gonna create a folder and that called water drops because of the very basic particle system that I'm going to be working on this video is just a water drop effect like water accumulating on a surface and then dropping down to the floor we're gonna open that and then right-click on the content browser and what you're gonna be able to see here which you would not have been able to see before we enable the plug-in is there is FX down here and advanced assets and if you go to that you can see there are a whole bunch of Niagara options so there are scripts and modules that you can make that really extend the functionality of Niagara and make it a super powerful tool we are not gonna get to happier than that we might take a look at what a module looks like but we're not actually gonna be writing any in this video because it is very basic the two most important things for this video are the niagara emitter and the niagara system and we're gonna start off with the emitter because that is basically like the building block of a particle system so the first thing when you click emitter you see is it's asking you what you want to do so you can create a new emitter from a template you can copy and emitter that you've already made and then make changes to that or you can create in it a completely empty one what we're gonna do is we're gonna start off with one of these templates because they'll have a lot of the things that we need to use so the very the the most useful one I found is this fountain one it's a very typical sprite based particle manner so you click on that you click ok we're gonna have to rename this I always like to name things with abbreviations of the their type in front so we're gonna go PE n which stands for particle limit or nya aina Agra and we're gonna call it water drops the reason why this abbreviation so long is because they're also the particle systems and you want to be able to make sure that you can differentiate between the two and a list and you can just type in PS N or P and and be able to to pull up all your emitters or systems so you know what things are so we're gonna double click to open that and that opened in a separate window for some reason we're gonna drag it over so here is the Niagra editor first thing you'll probably notice that will catch your eye is the pre viewer window so there's a preview we're seen in here you can change a bunch of things you can look at FPS things like that I don't actually know where that's displaying right now but you can you can change some of these things you can change perspective you can change what the lighting mode is or the view mode so you can do optimization view modes like shader complexity all kinds of super useful things usually you're just gonna do it in lit just to be able to see what you're working on you can share the grid as well if you want to see where you're your origin that's gonna be and also something I find super useful is to go up here to window and open up the preview scene settings which is already open in this window over here so it's just below the emitter tab and you can come in here and you can change a bunch of things and what I usually like to do is in this editor window tick off show environment so I can see the particles and actually see what they look like what they're doing because if you have small particles or particles that are fading out it can be pretty difficult to see in that preview scene so I usually just like to shut it off and then when I actually preview things that just drop them into the level editor over here and look at them there to see what they look like in the actual environment so that's the basic functionality here you can left click and rotate right click and drag now and then middle-click to just kind of pan around that's the the viewport and then down below the viewport we have the timeline which is new to Niagara this is not something that was in cascade basically all the emitters that you're gonna have in a particle system will be down here and it will show what their durations are which is green part it's looping into this yellow part and you can sort of define you know placement on the timeline and all that kind of stuff and it's super easy to actually visualize in a simple way what you're when you're different emitters are coming in and when they're fading out etc etc so that's super useful and then also when you're using multiple emitters in a particle system this is where you're going to be adding them you can't do it in an emitter but when you're in a particle system you can add emitters down here or remove them also there are curves here so if you're editing curves over here you can bring them down here if you want to visualize them against other curves etc etc also new to Niagara is this nice little parameters tab right here which is super useful so I don't have this you have to make sure this is selected and it'll populate all of these things if you don't actually select an emitter down here on the timeline then you won't be able to edit it so make sure this is selected and then go to this parameters tab and you can see we have everything from high level engine parameters to if you if you're using a system which we're not here this is just in the better then they'll have system parameters in here you'll have emitter level parameters which which basically pertain to the thing that's emitting the particles and then you have particle level parameters which pertain to the individual particles sort over their lifetime and there are all kinds of things like age velocity spawn rate loop count now all kinds of things that are super useful in here so each of these things has their own namespace such as like particles dot what the parameter is or emitter dot what the parameter is there are other namespaces like user which is things that you can create which will then be thing that you can use via blueprint to communicate with the particle system and inform and drive various things the particle systems doing then you also have other things that aren't displayed here like there's a temp namespace which is just something that's a temporary variable that will basically be around for one execution of the stack over here and then disappear and it'll be made again next time it's just not stored in memory consistently and there may be other namespaces that I'm just not familiar with but those are those are the big ones so then we're gonna step over into the stack here which is the the bread-and-butter of Niagara this is where all the work is done and the lion's share of the work is done and this is where you're gonna be spending a lot of your time so we're gonna go and right click up here on the header and go go collapse to headers which is gonna collapse this whole thing so we can look at high-level and see what's in it so the first thing to look at here is the emitter box which is orange and this contains everything that pertains to the emitter so you know in emitter properties we have things like whether or not it's a CPU or GPU sim we can set if it's local space we can set the bounds very high level of men are things here then we step down so this those are all things that are happening at the spawn if the emitters they only happen when the emitter is first created then we go down to emitter update and these are things that happen over the life of the emitter so the life cycle such as loop count whether you're delaying things how long loops are going to be and then spawn information is the other big important one so how many particles are responding are we spawning over life if you look up to the right here you can see there's a little plus mark and you can use this to add modules so then you can go down a spawning you can also see we can spawn bursts of particles or we can spawn per unit which is if your emitter is moving it spawns a certain amount of particles for every unit that it moves then you can dictate all that so these are the thing that really like drive the very very base level functionality of the emitter super important you're gonna be tinkering with specifically the spawn stuff quite a bit some life cycle stuff especially when you're making more complex effects and you want to have a certain emitter delayed and then come in at a certain point to you know like an explosion throwing rocks out you don't with the rocks to come out immediately you want them after the explosion goes off so there's that kind of stuff the other things since we're looking at this right side right now as you can delete spawn rate for instance or anything anything that has a little little trash can next to it you can delete it I'm gonna undelete that but you can do that you can you can check this and what checking this does is it basically turns off this module for the entirety of the emitter so not only does it turn it off in the editor here but it won't function in your game as well so you can really easily debug things using this but make sure that if it's something that you want your emitter that you turn it back on so next we have particle spawn so just like with some inner spawn these are things that happen at the very beginning of a particles life cycle so we have things like set variables in here very basic you set lifetimes of particles if you change you know if you change us to point five and point six for instance they're not gonna last as long you can change it to a very long lifetime and you have a lot of variability you can do a lot of things with that one of the again one of the core like functionalities that you're driving in your particle systems is going to be based on this lifetime because also a lot of other effects are calculated over the particles lifetime so that's something that you're going to be tweaking quite a bit then below that one of the standard things and this one is particles mass so you can set the mass of particles and this is kind of different to the methodology of cascade because they're trying to drive these particle systems largely as systems so a lot of the templates that they have are based on calculating size by mass and calculating you know velocities and such by mass you don't have to do that in fact there are a lot of really neat workarounds that you can do to just kind of do things that were you know essentially done in cascade where you're just assigning variables that really don't have a meaning in terms of physics but allow you to easily like prototype out a visual effect on the other side if you want to draw on it on the other hand if you want to drive like a really realistic particle system for your game like you're making a modern military shooter and you want you know explosions to send off chunks realistically you can do that in here now and instead of just kind of having to fudge the numbers you can actually figure out what the numbers should be and put those in we're not going to be focusing too much on the realism side of things I'm gonna be focusing a little bit more on the hacky ways to fudge the numbers because I'm just concerned about how something looks and I'm making things that are a little bit more cartoony and you know visually interesting in my eyes so but that's just something you can do and you can keep in mind we also have particles of sprite rotation set in here so this is just determining the initial rotation of these particles but of course they're circles so it doesn't really matter you can also add other things in here so you can add you click on this little drop-down arrow up here and you go to add variable and you can add any of these variables that already exists so you can initialize them here there's all kinds of stuff in here that's super useful but what's even more useful is that you can go down and create a new variable and you can create any of these and any of these different types of variable types and there's quite a lot you can do here it's super powerful so you can create a variable for whatever you want and we'll probably be doing a little bit of that just to drive some more simple behaviors that aren't like physics based so that's something that is very incredibly powerful so if we just click for instance a float you can see it just drops in a new float right here and you can double click on it you can change the name just whatever speed even there's already a velocity in here but so it starts off is a constant because I told it to be afloat you can actually come over here to this little drop-down error and you can do the same thing for any of these little variables or input boxes anywhere in the editor and you can you can set how that is defined so if you go to dynamic inputs you can set any of these different things one of the most common ones that you're gonna be using is uniform ranged floats as opposed to just being a constant you set a minimum and a maximum and the Niagra is just going to pick a random value in between those and assign that to that per particle another interesting thing that you can do is you can also for each of these say you did arrange flow you can then go down to this arrow and then you can add another thing see you could you could make your maximum another range flow I'm not sure why you'd want to do that but you could drive your maximum by a curve for instance flowed from curve and you can do that over the particles life and you can see here that this curve is indexed by the particles normalized age you can also change that you go to link inputs and you can change it to any any variable that is the correct type so any float for this instance for uh for a curve index here I mean this this example of index is a little bit different because it typically tries to do time related things but like for instance if you're gonna set a particle mass and link that to something else you can usually well maybe not in here but you can you can usually if you set them down here you can set them to anything that was up here for instance so if we go to we go to color color will go to drag force and then will go to link inputs and then you can see it's not just the age anymore but it's also got things like time mass the speed variable that we created all kinds of useful things so there there's a lot of functionality in this in this you know defining how you how you set inputs and then also nesting different types of definitions in they're super useful another thing to look at in here so we we're going to reset that and reset that so this will just reset it back to a constant another super useful thing that you can use to define is expressions so you can go down here and do make new expression and basically what this does is it gives you a line to write in some HLSL code to define something so you can pretty much do anything you want in here I'm not super familiar with HLSL yet but you can you can do a lot of simple math expressions like you could basically say like particles mass times particles lifetime for instance or you do that for basically anything else and then that will define that that variable there now like we noticed before I don't think you can actually access these because I haven't been defined yet in here but I think if you went to say here and we looked at link inputs yeah so everything that we defined above here is now available in here so for instance we could we could set this this value whatever this is actually doing to be equal to lifetime times mass or speed times sprite rotation or whatever we want to do so there's a there is a lot of flexibility in there and we'll do a small amount of that in here hopefully more in future videos we'll use that because it's just super useful it's a shortcut to not having to define your own module of course you know you you have now written some code in there and it's not the most user-friendly thing and so if you're handing off your particle system to somebody else it's not gonna be as easy for them to pick up and change things so just keep that in mind so we'll skip out of the variable here we can look at some of the other things there's calculate size by mass there's add velocity there's location here so we're setting initial things here and spawn these are not things that will change over the particle slice is basically saying that these particles are going to have this initial velocity these particles are going to spawn within this sphere radius and so those are things that you can change pretty easily by going up here and just picking a different thing like velocities they're a bunch of different kinds of velocities you can do in location there's a bunch of different locations you can do and we're actually gonna do some different ones for this once we get through going through the stack here so as we're stepping down through the stack we're going from first executed thing typically towards you know what the final execution is gonna be so this is literally like stepping through an execution stack so we're spawning particles and then we're going to update the particles over their life so there are a couple modules in here that are pretty typical that you're usually not going to mess with unless you're really doing something advanced like particle update age which is basically saying you know the particle spawned every tick or frame whatever the particle assistants bringing update of that we're gonna update the age we also have saw forces in velocity which is another typical thing that unless you're doing like a stationary particle system you're gonna have this year you're gonna want to leave it here and then you're probably not going to mess with it too much it's something that's there unless really doing some power user stuff but we're not going to do that here we're just gonna leave that as is and something to note with this is that anything that changes the velocity or the forces associated with the particle system has to be above this so this can then use those inputs to calculate the forces of velocity so if we for instance grab this drag grab this gravity force sorry tongue twister and drag it down below sources and velocity a force of velocity I didn't there it is okay so then you open this you look at it it says it suddenly has unmet dependencies because this is not supposed to be after forces and velocity so it's pretty smart it'll it'll have this little button that says fix issue and that should push it back up I've as you noticed like I clicked it and it moved it back up and it's not yelling at me anymore but then you can look in the particle system and gravity is not working so maybe if we turn it off and on again ya see now it's now it's working again so so just be aware of where you're locating your modules because certain modules depend on other modules and if you're you know if you're updating a variable for instance and you're setting it here and then doing something else to it down here the thing that's lower down is gonna take precedence and be the thing that is written out at the end so keep all that in mind is pretty important where you're you're locating things with respect to each other if they're working on the same variables so then after particle update are actually let's look through here we can see that you know there's a lot of similar stuff in here some of these things some of these modules are gonna be the same modules that existed in particle spawn not all of them some of them change because some things just don't make sense at all in particle spawn and do make sense in particle update because you know you don't want something that changes a variable over life and particle spawn it just doesn't make sense so same deal you can go through here there's a lot of stuff you can search at the top or whatever you want it's still in its beta stages so some of the things that you might expect to see there that were in cascade aren't necessarily in here but you can work through those things on your own through defining variables through making expressions and then you can also if like once you really get into Niagara there are things called modules which all these are modules but you can actually like right click on this and opus open focus it and basically what it does is it takes you to the script for this thing so this is a blueprint like scripting system that defines what module does defines its inputs we're not gonna really get into the nitty-gritty of this but I just wanted to show you that this exists and this is a super powerful thing that makes snagger you know a very powerful tool set and then once you learn to do these things you'll be able to do crazy things with particle systems you can you know you can make changes to existing modules or what what is probably more recommended it's not that you you know change what's there but you take this and you save it as something different and as soon as you save this as its own thing that you made changes to then it'll show back up in you know your module list when you go to add something so really cool stuff we're not gonna do any of that in this video but eventually we'll get around to that one I have a better handle on it now now that we're done with particle update will step into the event handler down here so this is pretty cool and we won't use this in this video but we'll use this in the next video when we're really tightening up this particle system that we're going to make here and so basically what you can do here is you can add an event and or you can add a handler for an event and you can say if another event is if another particle emitter is broadcasting an event I can add that in here and then tell this to either do something to every particle in my system or do something to particles that I'm going to spawn as a result of that event and then you can go in to here and on modules such as receive for instance death event and so if whatever you've registered here is sending a death of him then you can receive that death event and the payload that it sends and it will then be so this particular module will then write those payload attributes to this particle particle system and then you can do things such as inherit location hair velocity so if we go up here and look at part of a particle update we can also go to events and say generate death event and so this is what is sending out this death event here so we can actually even tell this particle system to receive its own death event and so on though you can see it's doing some crazy stuff here but on basically when a particle dies it's telling every single particle to go where that particle was if we go here and just spawn particles now when every particle dies we're spawning more particles which gets a little bit crazy pretty quickly we're not gonna do that so we're gonna we're actually gonna trash this receive death event so it stops doing that but so if we go up to death event here we can see that there are some some variables that we're going to be sending every time a particle dies so it's sending position velocity particle ID it's sending around float sending particle age and then what this is doing down here when we have that receive event is we're actually overwriting what the receiver particle has for location and velocity with what the dying particle had so super useful we're gonna use that next video it'll be great for now we're just gonna close out of those two because we don't want them in this particle system yet and we're gonna go down to the very last section which is the render section and so the render section is where it takes all the variables that we have been working on and it finds them to specific things like position color velocity so you you can see these things are bound very simply right now to what you would expect position is bound a particle position colors particle color we can actually change these to a number of different things that fit into that same parameter type so for instance since the position is a Veck three you can do scale velocity color I think is effect four since it's got alpha so if there's only that there but you can create effect four so you can change a bunch of things in here and this is super powerful we're not gonna change the bindings in this video but just know that is something you can do and it is pretty cool that you can do it so every single thing you can see where all the variables are going if you right-click up at the actually sorry if you go to this little eye icon and click show outputs you can then actually go into each of these modules and see what the variables are that it's outputting and so these are physics forces and then this is taking physics forces to output things like velocity and position so you can actually follow the entire chain of execution here to see what is actually happening in your particle system and you can have control over every step of it so that's pretty cool pretty powerful also very easy to break things so just keep in mind when you change things like this you can easily completely change the behavior particle system so other things in the render that it's doing after it's taking all these things in you can change sort order you can do sub movies in here you can change sort and facing modes which is pretty useful for sprites then you can also change the default material so this is a sprite renderer you're rendering a little circle here with like a radial gradient fall off or something like that it's making kind of have opacity towards the edges it's just facing the camera and that's that's a circles always face the camera it's pretty simple you can also come up here and add different things so you can add so you can add all these different types you can add a light you can add mesh you know a ribbon or spray so these are all different types of things that you can render based on the same particles so if we do know yeah if we do a ribbon for instance you'll see that it's actually taking the same variables and it's just rendering the ribbons based on those variables so we don't have a a material attached to CIB you can see all these gray lines that are just all over the place attaching different particles because ribbons are strung together and it's trying to strain together all these different particle locations but so it's really cool because you can do all the calculations once and then you can draw multiple things based on those calculations super useful can be super efficient if you do it well so that is the gist of Niagara itself it's got a lot to it there's a lot of different things you can do with it we're just gonna do a very simple particle system here just to to kind of get our feet wet just to show you what you can accomplish in here in a couple minutes so we're gonna start off we're gonna delete a bunch of stuff that we do not need so I'm not going to calculate size by mass I mean you could do that for this kind of water drop particle system that I'm gonna make here if you want to do something super realistic you could do that all the masses included although you know forces driven by the masses and stuff like that but we're not gonna do that right now we're gonna keep the mass just because all that stuff is is expecting it right now and I don't wanna go that deep into it but we're gonna get rid of the size by mass and we're just gonna size things ourselves we're also going to close that we're also going to delete the velocity we don't want to give it an initial velocity since we're having water accumulate on the surface and drop down we want to act on it over time with an acceleration so we're gonna get rid of this velocity we're also going to get rid of the sphere location because we're not actually kind of looks like a neat little a neat little water faucet spout right there but that's not what we want so we're gonna we're gonna get rid of the sphere location and we're gonna add a box location minute but I'm gonna keep going down here and deleting things that we don't need so we're actually might seem counterintuitive but we're actually going to delete the drag and gravity forces because we want to do it our own way we are gonna have an acceleration due to gravity but we don't want that acting immediately because we want the water to accumulate on the surface before dropping so we're gonna get rid of that like I said leave update age and saw force and velocity because those are pretty crucial to the functions of this but we're actually going to drag this put up here because instead of changing color over life we just want one static color that these particles are gonna have because they're just little water drops so we've done all that now and let's just start off by changing the color so we're gonna reset this curve here to a constant like I said we wanted a constant and we're gonna go 0 1 and 0.97 and that will be our color you can see this this material is additive so it's just spawning all these water drops on top of each other and they are getting super bright as it spawns a bunch of them I mean it's spawning like a hundred every time so so that's a lot of particles just sitting on top of each other so what we're gonna do to fix that is go to this plus up here go to location and we're gonna go to box location so these aren't going to spawn and same exact place we're gonna change the size to two hundred two hundred and zero because we want it to be a surface we don't want all the particles spawning at different heights we want them spawning on a surface so you can see they're just kind of spawning on the plane right now so we're also going to change the lifetime here so we're going to change this to five oh not fifty one five and ten these you know last awhile we're also gonna want to knock the spawn rate down because this is a crazy amount so we're just gonna go like five right now just so you can constantly see something spawning here so we're not gonna we're gonna continue changing these things around and change the mass we're fine with that it's not that big of a deal or nothing get rid of this particle speed thing I made that was just for the tutorial um let's see what do we want to do actually you know and I might I might just make the mass a constant and make that a constant one we're gonna we're gonna reset this to a constant as well I don't want these to have a random rotation we'll just actually we'll go to zero go with zero on them so they all just kind of have the same it's not a big deal we want to also add a sprite size because you can see these are all just you know same size circles and that's not super interesting so if you click on if you click on this little arrow and you get add variable and then we go to sprite size particle sprite size and we're probably just going to make this a single vector or sorry a single constant that we want to get because these are these are sprites and so they're only defined Lex and Y and if you make those different then it's gonna stretch the sprite so we're just gonna go vector 2d from float here by going to this arrow and typing in vector 2d and it gives us that so basically what that's saying is now it's gonna drive both the X and the y from this value that we put in here so that's super useful but what we're also going to do and another reason why that was useful is we can now just make a uniform range float as opposed to a uniform range vector so we can just put a couple numbers in here super easy we're gonna go from 2 minimum to four maximum so you can see now they're spawning with different sizes they kind of look like little orbs of water right now maybe not totally realistic we're going for more of a cartoony look here anyway but they are a little perfectly shaped but will will kind of work on some of that later so actually we want to want to change the spawn rate also to a range because we don't want it to look like it's just constantly spawning the same amount of stuff so we're gonna go from 0 to 5 just to kind of give it a little bit of a random more realistic nature so you can see now they're just kind of popping in whenever some times more pop in some times less but it kind of feels a little bit more realistic than just a constant rate so now we've done all that we also we're also gonna wanted to step in to update down here now I think we've pretty much knocked out most of the things that we want to add the initial time here so now we want to get to where we're updating the particles so we want to update the sprite size over life because you can see they just kind of pop in that's super unrealistic it doesn't doesn't look good it just they just kind of pop into existence and we don't want that so we're gonna go spray size a scale so we want to scale the sprite size and this is doing this every frame so essentially what this is doing is right now it's one it's just telling every frame the sprite to say to multiply its initial size by the scale factor and since it's 1 it's just the same thing in fact it's not the initial size that's doing its it's the actual size itself so what Magra does is it stores an initial size and it stores the the actual size that will be fed into the render so I think if you look here yeah you can see there's in particle attributes there's sprite size and then there's initial dot sprite size and so basically what this is saying is this is the the initialized value that it had when it spawned and then this is what it currently is so what the scale is doing is its multiplying the current value by one so for instance if we change this to 0.9 these should just kind of get smaller over life actually might have it backwards there it looks like this is just doing the yeah it's the initial sprite sighs sorry about that so it is doing the initial sprite size if we wanted to we could say it would just do the current sprite size by doing an expression in here but we're we're not going to do that what we actually want to do is act on that initial sprite size because that's the the easiest way to get a constant over time effect that we like so what we're gonna do here is we're going to do a vector Toodee from a curve this time so essentially once again what we're doing is we are taking this curve here and we're using it over the particles life to drive what the scale is going to be and for some reason yeah there you can see it now they're actually fading out slowly over time what we're gonna want to do is we're gonna want to do this so from zero to one you can see it already starts to zero to one and it's gonna let you individually edit the x and the y values what we're gonna want to do is we're gonna want to select both because we want them both to be the same right now we're going to put this to zero so they start off as nothing and then we're gonna go to time 1 which is the end of the particles life and we're gonna put that to 2 so now you can see they start off super tiny and they go up quickly to 2 times their original size so basically that's just giving us a little bit better behavior saying that um you know they're gonna look a little bit more realistic they're not just gonna pop in we're getting popping out at the end and that's because the loop duration is only set to 5 and this thing is just going to you know 10 seconds and then ending so you know these these particles some of them are not even getting to their full lifetime so you're getting weird looking effect in here but if we actually put this into the world the particles would live out their full life and then just pop out of existence which is also not perfectly what we want so what we want to do is have these start to fall so that we don't see them pop out like that because we want the water to accumulate and then we wanted to drop off the surface so what we're gonna do is we're gonna click + and instead of adding a gravity force we're gonna add an acceleration force because we want to customize this so you see it's it's yelling because for some reason added it below us all forces and velocities are interact that up and now you can see we have the excel force module here and so what we're gonna want to do is we're gonna once again drive this from a curve so vector from curve so you can see it's automatically going from one to zero like curves typically doing here but that's not what we want to do so what we want to do is we want to start off I select all of these I want to start them at zero because we want the particle to accumulate on the surface we want to come up here to this little box up here where these locks and we want to lock X&Y because we don't want to change those we're just having gravity act on this so we just want to change the Z so now those are locked we can't touch them in fact we can turn them off or we can't see them because they're not important for us so we're gonna start at zero and we're gonna change this to negative of 980 at time one I didn't it didn't take so select at time one negative 980 so basically if we click this button up here we can fit to it and you can see that it starts off at zero and then at time zero it starts moving down to time one words at negative 980 and then it's did plateaus off because we've only given it those two values but you know that's kind of not ideal because obviously a gravity doesn't just like ramp up its force it's a constant force over time but also you know the particles you can look over here are spawning and they're getting bigger as they're falling which is not what we want what we want is the particles to get bigger over time and then like as they're getting to their biggest size that's when you know they break that surface tension and start to fall so we want to change some of these points a little bit so that it makes a little bit more sense so what we're gonna do here is we're gonna add a point at about we'll say 0.15 and we're gonna make that zero so basically the particles don't move to start off with they take a couple like you know a second to you know two seconds something like that depending on the range to form a little bit before they start falling but still we're not quite there we want to we want to add a few more points in here so first of all we don't want sorry and just in case you didn't pick up on this if you right-click on the curve you can add add a key and that's what I've been doing so we're gonna add this key right here we're gonna put it at 23 time point three and our gonna do negative nine eighty so basically what's happening there is that there's a pretty you know static acceleration due to gravity over most of the particles life the other thing we want to do is we want to add another point here a little bit a little bit in the middle of these two so we're gonna do 0.26 and then we're gonna call this about negative five we're gonna say and essentially what this is doing is it's giving us zoom in here before do you realize the zoom in to see that but so this is negative oh I did negative point five that's why negative five is what I meant to do so now you can see you know it starts off not moving and then it starts slide ever so much and the reason why I'm doing that is because you know if you've ever watched water drop when it starts to fall up and get larger just before it falls it starts to kind of stretch a little bit because it's trying to break that surface you know that adhesion or cohesion I can't remember the exact term but it's trying to break that tension that's keeping it attached to the surface so that's what this is basically trying to show is that they don't move and then they just barely start to move and they drop so that's just a little bit of detail in there that'll make the particle system will go blue but better but you can see doesn't move for the first third of the particles life essentially and then at just our first quarter and then it just drops and then it'll just keep accelerating over time so we have our acceleration now we kind of want to change the sprite scale to sprite size scale to you know gel with us a little bit better because right now essentially what it's doing is it's just accelerating over life or sorry increasing over life so the entire time the water drop is getting bigger which doesn't really make sense because it's water sources the surface that it's on or onion so we need it to only get bigger while it's on that surface so we're gonna add a little bit more to this curve so first thing we want to I want to add something the X curve here so right-click and we're gonna say at a quarter of the particles life which is when it starts to move we are going to put it at time two so essentially what that saying is that the X curve is done at that point it gets bigger and then it stops alright when the particle starts to move we're gonna change the Y a little bit more because the Y is you know there's a downward force acting on the water drop and we want to kind of make that look a little bit more detailed and give it a little bit of stretch based on the pull that it's getting is it starts to move and then based on when it just actually starts to freefall so we're gonna lock the X curve so we're not accidentally adding things to the X curve because it's actually kind of tough to add things in here without like selecting the right curve and not moving the wrong thing so you just want to you want to lock the ones you're not using so we're gonna start off and we're gonna say at time point two so just before it's done accumulating it's gonna actually already be at its full length right so the full spherical length of this drop so that's basically saying that gravity is pulling it down a little bit so the the water is accumulating more on the y little bit quicker because it's it's being pulled down and then what we want to do is we want to actually give it even more stretch because force gravity is pulling down on this thing it's causing it to stretch at time point three three we want to go to two point two five and so what that saying is as it drops it's gonna have that constant stretch to it as gravity is pulling it and then we're gonna add another key here in the middle which is gonna be at point three I'm gonna put that at four and so basically what we're doing here saying that like just like if you've ever watched water drop off of a surface like just before it starts to move it gets like really stretched out as it's trying to break that tension so it stretches and then it breaks that tension and it snaps back to something a little bit more like it's original dimensions but it's still a little bit stretched because that force is pulling down and you kind of want to give it yeah this is cartoony you want to give it a little bit of stretch to show the motion so that's that's essentially what we're doing there and I think that looks you know pretty decent you know it looks a little bit weird now that we're looking at ovals but you're gonna kind of embed this in the surface so that the top half of this is not really seen so it looks a little bit more like a drop just coming down so I think we're good at the size there and now you can see this is kind of looking like you know it's kind of looking like water form on the surface stretching and dropping the only other thing we're really gonna do to it in this video is we're gonna we're gonna create a material just to show you what creating materials is like this material is actually pretty decent for this I mean it's got a little bit of you know translucency towards the edges that's sort of giving it a almost 3d effect but I'd rather go for something a little flat shaded for this kind of cartoon effect so we're just gonna save this we're gonna go in here and we're gonna create a material we're going to call that M water water drop and then we ran open that and so we're gonna come in here and we're gonna click on this and we are going to change this to masked and unlit and the reasons why we're doing this are mainly you know super performant like this is probably one of the most like opaque is probably the only more performant settings that you could put in here for blend mode and shading monal unlit at like takes a bunch of instructions out of this if you're doing something super realistic you probably want to be doing like a you know mesh particle with a translucent particle that has refractions and is affected by the light but we're just going for something super simple here so unlit works for us masked works for us so then that changes what we can do and here what is available to us but you know this should work pretty well for us so we're gonna start off with here is we're gonna get a particle color node so right click and then type in a search bar particle color you get the particle color you just plug that straight into a mess oh so right now it's just white it's not being fed anything but when we put this material in our particle system Niagara will actually drive what this color is so we've got the color set and I guess we could actually just save this and take a look at it so that we we know what it's doing so if we go to sprite rendering here we can type in water drop right there you can see it's got the color but it's a it's a bunch of rectangles right now we don't want rectangles we want you know little drops little spherical drops so we're gonna go back and we are going to add a sphere mask and you could do this with the texture I'm not really sure sorry I'm not really sure what's more performant you know the texture is having to do a texture lookup and it's having to use you know memory for that this is gonna be more instructions but you know probably less footprint on the memory space I just wanted to do in this you know this tutorial just everything in the engine so we're just doing this here but you could do it theoretically which is the circle that you did in Photoshop or something super easy or you do it as a specific shape you wanted to if you wanted to help crazy effect a little bit you could do little water droplet shapes or a sprite sheet that use for the sub you've ease that you then can change the shape over time but we're just gonna stick with the sphere mask we're gonna plug that into opacity because we want it to define where the particle color is being drawn and this sphere mask note has a couple of inputs it's got this a B radius and hardness a is basically like the the coordinate space that you're working in so it's basically saying where is this material relative to everything else so we want to work in the texture coordinate space because we basically want to say where the sphere mask is going to be on this texture and it makes sense if we look at it as a plane but we need some more inputs here first so the other thing is we're saying all right so we're relative to this material or object do we want the sphere to draw and so texture space is UV space and it's from 0 to 1 on the X and the y or the R and G I think our U and V like it depends on what you're plugging in but this is defined as U and V and if you take you know a color vector you can do orange e but so you know 0 to 1 on the U and V so we want something that's smack dab in the middle of that right so we're gonna hold 1 and click to get a constant and we're gonna do point 5 so basically what this is saying is put it directly in the center of our material so you can't really see yet because we we have not added a radius for it so we're just gonna say point 5 for the radius because this is actually you know that's the full texture space that we have right so you can see we have a circle now and I also like to to just kind of plug in the hardness here you can see you get a slightly smaller circle this is maybe not as performant for for draw but make sure that you don't have any hard edges you could probably do you know a harder number that's a little bit less but we're just gonna go with this for now because it works it's basically the same the same numbers that they're using for this sphere mask in the the default texture that we were using also so this is this is a good starting point it gets us a pretty good effect circle so we'll go over and we'll look at this and so now you see they're just instead of having that little fall-off of translucency before it's just kind of a flat shaded like blue like this almost feels like something that would be in just like a cartoon you know and that's that's the effect I'm going for here you can notice that it's a little bit brighter and that's because you know this isn't a mist of color we can actually hold em and click to get a multiply node and then we can multiply this by 0.5 so it's the same color but it's gemmed essentially save that and let it apply and then come back to here and you can see it's it's a little bit less bright I mean unless you're like in full sunlight you don't want your your water to be super bright and this is another thing to think about you know using unlit these particles are not going to be lit so this is heavily dependent on what your scene looks like what you're gonna want this color to be like you know you could drive this as a parameter that you could then change depending on the scene we're not gonna do that here we're just going super simple but basically as you can see that works for our purposes it looks alright it's a super simple particle system but it's there it works so now we want to look at it in the world so we're gonna go out here and the first thing you'll notice is that you cannot drag and drop this in a level editor and the reason for that is we just created an emitter you can only place particle systems so if you right-click on this go up to the top you can go to create Niagara System and then we're gonna rename this to PSN water drops and then we're gonna drag this in and immediately you're gonna be thinking oh no we've done something wrong there's nothing here but you haven't done anything wrong it's just kind of a quirk of the Niagra system so we're gonna open this and you can see it's working here and then suddenly it works here I think it just needs to compile for the first time but you see that is functioning so we can actually drag this up here and give this like a surface Oh drag this up halfway in there and you can just see now that it looks like water drops forming on the surface and then dropping so if we take a look at this particle system real quick you can notice it's got our emitter in it it's down here it's named what we named it and then you look over here and you can edit all the things that were in the emitter here so you notice it you know it's pretty similar it's almost identical main difference is that you have the system stuff up here so there's system parameters that you can expose their system spawn and life update stuff we're not going to touch any of that what you will notice is that for each of these things you can click this little yellow arrow to reset it to the default number so that's the default for that module it's not the default for the emitter however if you change anything in here a green arrow will pop up and you can click this and it resets it to what's saved in the emitter right so if we click that the life time is back from 0 to 5 and you could do this for anything in here like we could just change that and you see immediately it pops up with this green arrow and we can change that and likewise you can actually go in so let's just save this I'm go in and change this to red for instance and hit OK and hit apply and go in here and now we have blood-red drops and it's just they're linked they should always we're gonna change that back they should always stay linked I've had issues where it wasn't updating or wouldn't revert back to what it should and basically what you can do at that point is come down here to the the timeline right click on it and delete it and then you can add the emitter again or you know also separate from that situation you can add the same emitter twice if you wanted to now we have the same emitter going off twice you can then go into each of these and individually change things in here like I can change I can change the box location to zero for all of these and so instead of being distributed out you've got this one little spot in the center that's doing all of the particles dropping so you can you can make changes to template emitters within a system to then you know drive even further great greater variability and there we're not gonna we're not gonna keep both of these so we just want the one and that's pretty much the basics of Niagra so we have you know we have this system that we like or you know it serves its purpose we're gonna move this a little bit serves its purpose it looks like water dropping it's not perfect you can notice that you know it just kind of goes to the floor and it doesn't doesn't do anything it just keeps going and the particle is out for its entire life so you know we can add a little bit of dynamism to there to make it more interesting and basically what I'm gonna do in the next video I make is we're gonna put a kill volume in here so that these particles hit the floor and then create another emitter that is a splash so it adds a little bit more life to this particle system it keeps the particles from going on forever and then we can also add in some things that will allow it to be communicated with via blueprint so we can set for instance where this particle system is and where the kill floor is so that's going to be in the next video but I think that should do it for this video we've learned basically everything about the basics of I may have missed a thing or two here but I think overall we've got you know pretty solid foundation here for Niagara we made a very simple particle system that has a little bit of detail and it looks you know decent cartoony little effects that you could just put in your game and you know players aren't going to scrutinize that it'll just be something that adds a little bit more atmosphere so I hope you learned something in this video I hope this is useful for you I will continue making these and you know if you if you have any questions just put them in the comments if you have any suggestions for things that I should cover also put that in the comments if you if you just found it useful let me know and you know if you're interested in more of this then stick around and I will be putting out more videos soon thanks for watching and I hope you have a great day
Info
Channel: Split Hare Games
Views: 52,685
Rating: undefined out of 5
Keywords: UE4, Unreal Engine 4, particle systems, Niagara, indie game development, game development, tutorial, how to make games, how to make particle systems, VFX, cascade, basics, learn, getting started, unreal, engine, epic, effect, how to, material, real, time, 3d, video, game, water, drop
Id: SI35du2U1AY
Channel Id: undefined
Length: 62min 51sec (3771 seconds)
Published: Tue Jan 08 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.