How To Make Rain | Niagara Rain Particle System - Unreal Engine Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey guys and welcome back to another unwrenching 4 tutorial in today's video we'll be going over how to creating rain using the niagara particle effect system as you can see here this is also going to include collision so when you are underneath cover or inside a building or anything like that it's not going to be raining the rain will actually be stopped by the roof or any cover but you'll see it it still can flow underneath if the wind is pushing in as you can see here so this is what we're creating today and this is also including with minimal fps drop and i will also be showing you another way to make it much more efficient especially on larger maps later on in the video again this is what we'll be going over and creating today again it might look a little bit weird as it's a kind of a bright sunny day in the sky for me but without further ado let me just delete this code and i'll show you how i've done it so the first thing we're going to do is we obviously want to create our actual niagara system so we're going to right click go to effects or fx and we're going to get the niagara system right at the very bottom there this is the one we want click it and here we're going to choose a new system from selected emitters next and what we're going to do is choose the fountain a looping fountain spray because this one looks the most similar to rain out of all these so a lot of the work is already done for us we just need to customize it so press the green box with the right plus in it there to add it and that's the only one we want to use so we're going to finish that there now we have our niagara system i'm going to call this rain underscore ns so we know it is our rain for a niagara system and we're going to open it up straight away now you can obviously name it ns underscore rain for niagara system rain but i personally find it easier to search rain instead of ns but obviously you can come up with your own naming systems there now we have this fountain here now this is very similar to how i did the snow video because what we did there was turn this upside down that's essentially snow so let's start off by doing that what i want to do is i want to delete the sphere location and add velocity and cone because i want this to come down in a box shape and that's especially useful for what i'm going to show you later on for making it more efficient so now you see it's just coming down in a line like this which is obviously not what we want so we need to make this a box instead of sphere so we're going to hit the plus on the particle spawn there and we're going to add a box location the box size you can set to whatever you like and this again is important for what the size of your level is but i'm going to go with 5000 by 5000 on the x and the y and the z i'll leave as 100. again these are the values which i'm using for the more efficient way later on then this is obviously falling quite slowly and it looks a bit more like snow because it's slow and the balls so we want to add another particle spawn this one with add velocity now this is working in the zed put minus 500 minus so it flows downwards and 500 just so it's a bit faster you can again put whatever value in here you like so minus 1 000 if you want to be kind of stormy coming down really heavily or minus 750 whatever it is that you choose but you'll notice again there's hardly any here so if we go up to the spawn rate under emitter update at the moment it's 90 i'm going to set it to 2500 and you see there's a lot more coming down now what i like to do is just set the spawn rate to half of whatever the box size is so my box size is 5 000 my spawn rate is 2500 you can obviously choose whatever you like but that seems to be a good consistent one which i like to use it seems to give me the best results personally but again this still looks a lot like snow so we're going to change some of the initialized particle systems under the particle spawn the lifetime mode i'm going to keep as random and i'm also going to keep the min and max as 1.4 and 1.75 if you want to have your range starting higher up in the sky you'll want to increase this so they're not destroyed before they hit the ground but just keep in mind the longer you have a lifetime the more will be spawned in at once so the laggier it will be or the more demanding it will be on your pc so again always keep that in mind and if you find out it is getting a bit too demanding you can decrease the lifetime minimax and just lower the range closer to the floor and to change them from being balls what we want to do is change the size so the sprite size mode at the moment is random uniform which means they're always going to be the same kind of size we want them to vary a bit so it's not a ball it's a line so we're going to go from random uniform to just non-uniform so again they're now varying to make it a line we want to make one size bigger than the other obviously the x i'm going to put as 3 and the y i'm going to put as 60 for example like so now again you can choose whatever values you like in here i like these just because it makes them really thick and pronounced uh but obviously you can choose whatever you want that's mainly especially useful for a tutorial just to really show it off but you might want something a bit more subtle for example 2 and 50 or 1 and 30 whatever you want really just mess about the values together perfect for you but you'll notice they're now just coming down in random lines so it just looks like we're dropping a lot of straws from the sky not actually rain so that's very easy to change so what we're going to do is the rotation so you might think we'll change the sprites rotation mode here and you can technically do that you can do a direct angle degrees and then manually set it however a much more efficient way of doing it is going down to sprite renderer right at the bottom changing the alignment mode here from unaligned to velocity aligned and now you'll notice it is falling in whichever direction the range should be falling i.e the moment our velocity is straight down so they are going straight down now obviously you sort of start the video as well they're going kind of sideways as rain oftentimes does as the wind pushes it so to do that you just add the velocity again so for example you can change the y to 500 and now you see is doing it like this you can choose whichever location you want so you can do x or y you can do minus or plus i am personally doing y of the positive just because when i add it in the level it's going to be falling this way which is how i want because that is based upon the orientation of my map i think that looks the best but obviously again change this for what looks best for you personally and so now that is our rain pretty much set up we don't have the collision yet but let me just show you what we have at the moment so we can drag our rain in raise it up so this so it's actually falling from the sky and again this is where the lifetime comes in because the higher up it goes the longer it takes to fall which means the more will be despawned but if we just have it here you'll see we now have rain however if we go undercover it's still going to be falling through here and actually we've been going through the floor again that's not too much of a worry but of course it will be more demanding on your pc but again the main part is when we're inside your undercover it's still raining which we obviously do not want so we'll open it back up again and all we need to do is just give it some collision so that'll be under the particle update so we're going to add one and we're just going to add something called collision nice and simple now you'll notice we've got some errors what we're going to do is just fix issue and the problem will be sold for us automatically now if we go on to add another particle this will give us another error which we will have to manually fix but if we just get it first we're going to generate collision event again we've got some errors i already know what it is but just to show you if we hover over this here it says two errors particle spawn error this stage has compiler errors it's under particle update and particle spawn if we click on particle update this stage has compiler errors show the errors in niagara log all it says is before the particles id parameter can be used the requires persistent ids option has to be activated in the emitter properties so essentially all we have to do is go to emitter properties and tick requires persistent ids and that should fix the issue but a note this says it comes with additional memory and cpu costs so the collision side of this might not be too good if for example you are on a low end pc or your target audience is a lower end pc however in all reality this should be fine though again i do have other videos going over more basic range versions they obviously do not look at as good as this but they are aimed towards lower end so it's just using a widget and then just disabling it when you go inside and to make sure you can still see it outside we have rain effects on the windows i will leave a link to those in the description down below however again they don't look as good as this one but it is aimed for more lower end pcs but again this one should still work perfectly fine for you but once we've added the collision you'll notice that is halfway there so now it's no longer going underneath here but when they collide with anything they're bouncing now rain can sometimes do this it might sometimes bounce a little bit but it's definitely not pronounced as this and you kind of have to get quite low down to the ground to notice it so i'm not going to have it bouncing what i'm going to do is just instead destroy it so it's then just gone it's basically been absorbed into the ground or it's now just floating on the ground very simply what we can do is add another module on particle update and just kill particles which is basically a destroy actor or a destroy component and we don't want to just take it because that will then just destroy it immediately what we want to do is press this little arrow here and search for has collided so essentially when this particle has collided it's going to then despawn or it's going to be destroyed so that should it be now done for us we can save close this and you'll notice now it's not bouncing and it's not going under the cover as we have here so we have a nicer range system set up and this looks pretty good if i do say so myself nice and simple not too demanding again it looks great however at the beginning i said i'll show you a more efficient version of this or just having this in your level so especially for a larger level you don't want to make this absolutely massive i'm going to show you that now so we don't need to change anything all we're going to do is just delete this from our level and then open up our character blueprint and what we're going to do is basically just have the rain follow the character so the character isn't going into where the rain is the rain is just always above the character so go to viewport add a component add a niagara particle system i'm going to name this to be rain and we'll change it to be our rain ns system we have here again i'm just going to raise this up a bit as you can see here and now this is why i decided to have it this box size here because in my testing i found that this size was the perfect size for the player it's far enough away that the player thinks it's just going off in the distance it's not too close that they can see it and the same with the height if you have it around 750 i think i found was good for this kind of size and the lifetime which i had on there so compile save close this hit play and we'll have a look at what this looks like so you see the rain is now on us it's following the player now obviously as the player turns that is also rotating the rain however you might like that effect as well as obviously that's kind of giving a bit of a wind effect the range changing direction but as the player is moving the particles won't move with them as they are already falling so this looks quite good and again if you go into cover you can't see them there you will obviously be able to make it so this doesn't rotate with the player if you wanted and i can go with that in more detail with some of you if you wanted as well but i won't do it at the moment so again this is a much more efficient way so if you have a massive map you don't need to have the rain cover the whole map you just need it wherever the player is like this so i think that'll be it for this video as we've done if you want to do we've set up this rain system which we have some nice rain and niagara particle effects systems falling down from the sky as you can see here very similar to my snow one however it does look slightly different for rain obviously so thanks so much for watching i hope you enjoyed and hope you found this video helpful and if you did make sure to like subscribe down below so thanks so much for watching and i'll see you in the next one [Music]
Info
Channel: Matt Aspland
Views: 49,971
Rating: undefined out of 5
Keywords: ue4, unreal engine 4, unreal engine, tutorial, ue4 tutorial, unreal engine 4 tutorial, how to make a game, how to, 3d modelling, blender, unity, games design, graphic designer, ue5, unreal engine 5, ue4 niagara rain, niagara, rain, raining, system, particle, efficient, rain niagara, ue4 rain, simple, particles, real, FX, fx, vfx, create, make, audio, sound, move, realistic, collision, inside, indoors, no, stop, with, without, no rain inside, rain inside, outside, only
Id: s_UQYuM1RWU
Channel Id: undefined
Length: 11min 42sec (702 seconds)
Published: Sat Feb 12 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.