#UE5 Series: Guiding Fluids Using Particles in UNREAL Engine

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone this is Reza and welcome to my channel here I am with another Unreal Engine tutorial in this step-by-step walkthrough we're going to dive deeper into fluid simulation which has been improved significantly in Unreal Engine 5.3 we're going to explore how to guide your fluids using a simple particle system as usual we have a lot to talk about so without any further Ado let's get started [Music] alright first things first let's create a blank scene I'm in film blank and let's name our project fluid with particles we don't need starter content nor Ray tracing but I left them on just in case and let's run Unreal Engine okay here I am with a brand new scene first things first as usual we are going to create just a couple of folders I'm going to call this folder Reza I am going to give it a different color so it's easier to distinguish and within that I'm going to create a different folder called VFX so I can create my first Niagara system now prerequisites for this video is to make sure that you understand the ecosystem I have an hour long video on all the do's and don'ts you need to be mindful of about how to start with Niagara system and of course in another video I will explore how to get into fluids so with those out of the way I'm going to create an empty system I'm going to create one without any emitter and I'm going to call that burst with particles I'm going to double click on it to bring in my Niagara window system and just double check and make sure that you have Niagara fluid enabled and Niagara same caching in case if you wish to put that into your sequencer ready as well and with those we are going to restart the engine fantastic now start with the Niagara system let's double click on the particle system so we have access to the system but there is no emitter again I've covered this in the past all you need to do is just to press e to bring in a particle I'm going to go with simple Sprite burst which is going to create spawn burst instantaneous so basically what this does if I go to spawn burst instantaneous module it's going to give me one particle over a span of almost no time so the simplest form of particle system what I'm going to do is to give this a value so maybe starting with 500 would be a good number and once I do that then it puts 500 particles in one location obviously that is not going to work for me at all because well at the end of the day by the way the particle is here as you can see because there is no movement and there is no interaction so basically those particles never get separated as usual to force the separation of the particles we need to introduce a force field now if you would like to have the force field at the time of the creation of the particles you need to add this module into the particle spawn because we're not really aiming for changing the behavior of the particle over time then this module add velocity will go into our particle spawn group okay I'm going to add velocity and right now the velocity mode is linear so it's going to force everything in a single line to make it a little bit more interesting I am going to go in a cone now if I now play you can see gradually but surely those particles will be pushed in x axis I actually don't mind that so I'm going to leave that as is but this push is very very subtle remember what we're trying to do is to create a model for the fluid we want the particle system to drive the fluid system so anytime you invest on this particle system to make it look more interesting will be paid off because eventually we're going to link our fluid system into this type of behavior of the particle system that you're seeing here so I am going to start with a really really high value 900 and this will provide us with that initial push for the fluid system as it disperses into the space and makes the result look quite interesting now before I move forward I'm probably going to narrow down the look or the angle of the cone maybe set 25 I don't want that to be too wide that kind of works for me the cone X is set to one is good but if you want to push that towards other directions feel free to change that now I'm going to switch back to spawn burst instantaneous and one thing I'm noticing is the count of the particles it would be nice to have a little bit of randomization in there I'm going to stop that it would be quite nice to have a little bit of randomization in there also another thing that I'm thinking is the lifespan is fairly rigid again that's another Factor you need to be mindful of all the particles do die at the same time and at Birth so it would be nice to change some of these values also you can see in this uniform Sprite size all the particles get 50 units in terms of the size again that's another thing that we can definitely break up to some degree and add a little bit of randomization so before we jump ahead let's fix those things really quick and then we can comfortably move on to the next step with regards to Life Time the best way to randomize if I just type in random is random range float and that gives you a bit of a range to work with let's say 0.4 2.6 would be the range that we're looking for again I'm just dropping in numbers there's a good chance that I go back and fix that later since these particles are going to drive our fluid system this size is not really that important so instead of making sure that particles are visible it's best to actually add a randomization and pay attention to that as opposed to just looking at the particles in the viewport because eventually you're not going to see the particles you will be seeing the fluids so let's just randomize that as well so I'm just going to go and add this random range float to that as well now remember that this float gives us the decimal value so while I'm using random range float for these some attributes like spawn burst instantaneous cannot have let's say 500.2 you either have the particle or don't have the particle and for that you get random range integer so it's good to have that differentiation for this integer I'm going to go 500 to 600 and again there's a strong chance that I go back and change that for add velocity we need to make some changes as well but I'm just going to go into initial particles and let's change this to let's say three to six and that gives us certain particles with a scale of three and the remaining between three to six and six now if I rewind and play you can see they do die really quickly but it gives us a good level of randomization now in order to see things better I'm going to go and turn off the environment and probably dial down the color of the environment so I can kind of see things better let's rewind and play yep you may say Reza I feel like it's a bit too fast but remember again I'm reminding you that the look of the particle is really not that important how it's going to impact our fluid is way more important so I feel like this push is actually going to help us to get a good result in terms of the density values and temperature values once we introduce them into the scene yeah that looks pretty nice actually let's do that level of randomization in our velocity as well so first things first I'm going to go in here and go for random range float apply that in here as well and maybe 900 to 1100 I'm sort of pushing those numbers really really fast but again if we feel like it's bit much I can always go back and change that again you never know if those values are super accurate until you connect your fluid system and only then you can go back and tweak some of these values so more or less I'm blocking out the particle system and getting them ready for our fluid simulation all right let's say that's uh that's almost enough for the amount of time that you spend in your particle system once you bring the fluids in you can just comfortably go into Sprite render and just disable that we really don't need to see it but for now I really do need to see it to sort of have a better understanding of what the fluid is going to look like once I bring it let's move on to the next chapter and bring in our fluid Sim and I will show you how to connect the fluid Sim into our particle system so basically this guy is going to drive the um the fluid Sim before I do that I am going to call this emitter underscore driver so we know that this guy is going to drive the fluid Sim let's move on to the next chapter [Music] now you have the Niagara fluids plug-in enabled that should allow you to bring in the presets that Unreal Engine provides to us again pressing e but this time instead of going through the template I'm going to go into parent emitters and I'm going to bring in great 3D Master emitter as I said before this is still in beta mode at least in this particular version so it's a very good idea to just go in there and save all right let's uh rename this without um getting ahead of ourselves I'm going to call that fluid underscore driven so we have a very clear distinction between the two one is driven the other one is driver now this fluid system does not have if I play it does not react to our particle system you may have noticed that our particle system just emits on the side and the fluid system does its own thing it just emits density and if we want temperature over time through a sphere so if I go in here into Source you can see that sphere Source has been enabled and that's why we get this sphere as a source of our emission just like that now one thing that can help with the performance is actually if I zoom in you can see we are processing through CPU now if you have a decent GPU card then it would be a great idea to switch to GPU Sim and we're getting a warning that it says all right you need to calculate these bounds we're going to go and pick fix and that's going to get rid of the warning for us it makes it quite comfortable for you and Unreal Engine to push the boundaries if need be let's say we want to increase the number of our particles through spawn burst instantaneous with CPU you know things may get a bit messy and and Unreal Engine May crash on you but if it's set to GPU there's a slightly lower chance of you compromising the scene again I'm going to go save all and with that let's see how we can connect the driven into the driver it's actually fairly straightforward first things first we do not want this sphere to drive or have any role in the fluids and because there is no other emitter we simply do not see anything if I just press play we're not going to see the fluid driven we're just going to see the emitter driver because of course both of them are ticked in here and in our timeline let's go into particle source and let's say we would like to Target an emitter and this expands and says all right do we have an emitter in mind this is the default name do you have any new name that you can replace this with of course we have a fluid driven and emitter driver we would like emitter driver to drive the whole thing so if I go in there and enter you can see all the warnings go away and all of a sudden this emitter driver is in fact in the driver's seat and it's going to take control now what we're going to see is actually quite funny because the bounding box of the driver does not match our fluid driven so what we see is going to look quite funny so let's go ahead and change a few things and let's see how we can enhance the result first things first we need to look after the boundaries so I'm going to go into boundary box we've got word size World size for the boundary box um let's put in 1500 for X because well with the amount of velocity that we added we need quite a fair bit I'm actually going to give this a little bit of room because I don't know what to expect and how it's going to clip off definitely see we don't have but with X and Y we do have that initial velocity which is pretty high Eleven Hundred so let's see how we can work things out let's go ahead and play oh I noticed that the starting of the particle has been moved so I'm just going to rewind and play we can sort of look around and it's not working you may say what is happening because we successfully nominated our driver and it should identify the driver and Link the driven and the driver but it's not working well there is a very simple explanation to that and that is we identified what we want within the fluid The Driven but we never told the driver that there is a fluid that you need to attach to so it's always a two-parter where you need to not only link your emitter into your driven but also you need to set fluid attributes in your driver to be able to see things now this happens over the course of particle generation we're not going to introduce that in the spawn we're going to actually introduce that in our particle update so if I type in set we have set fluid Source attribute and it's extremely important that you don't forget about that otherwise nothing is going to work if I rewind and play you can now see the fluid system is following the movement of our particle how cool is that I am going to save that let's bring this into our scene or into our level and see how it plays out and based on that we're going to move to the next step so I'm going to quickly go in there I'm going to go into particle fluid and I am going to bring that in and position it like so now every time you bring this particle system over you can see that I need to sort of wait for that to be repeated if you're kind of tired of this and you don't want that you can just go into activation and toggle on and off auto activate just to be able to see what's going on Auto activate it resets the particle system and allows you to preview the result much faster now we have that working let's go into our Niagara system and now with that out of the way we can move on to the next chapter and start tweaking certain attributes to get even a better result I've gone ahead and turned off Sprite render of course so we don't see the renderer now from now on the attention will be on this fluid driven to create that I don't know energy burst or whatever you can do or come up with there's all sorts of crazy stuff that you can do now with the power of this fluid Sim now we have this guide we can tweak this further now remember in spawn instantaneous and we have certain amount of particles in velocity we have randomized the speed so if you feel like it's too slow or too fast that would be the time to change it if you wish to push this upward or even downward you can certainly do that in here and of course in initials particles if you want the particles to die early and as a result of that this will have an impact on your fluid or live longer you can change that as well now from this point onward because we don't have any brief we're just going to start with a little bit of adjustment on our fluid driven since we are already accomplished the mission that was how to connect the fluid into the driver we're going to use the rest of the tutorial as an opportunity to discuss more about fluid and the important attributes that you can make use of to enhance the look of your simulation so we already looked after the boundaries but I feel like the emitter is not located in the right spot we need to push that back into x-axis and move it up in z-axis to be able to sort of centralize it in a better position so for the X maybe 0.45 yep and for Z since we are going to move this up maybe something like 0.25 or 0.2 is going to work for us yep that's definitely better also I'm going to ever sew slightly bring this timeline back because I feel like this is a bit too long for us to visualize so let's have a look yes that's definitely better let's discuss some of these important attributes within our emitter summary the first one that we're going to Target is simulation obviously we've talked about the world size and pivot I'm going to turn off draw boundaries or Draw bounds if we already took care of that with regards to resolution Max axis is just going to add more cells along the longest axis which in this case is X now you got to be very careful with that number because increasing that number yes gives you more detail but not necessarily the better result not to mention that you're at risk of Unreal Engine crashing so if I go and increase that to 400 we immediately get some sort of a strange look that might be the look that you want let's say volcano eruption maybe something that you want thick viscous smoke is something that you're looking for but probably for a fast-paced puff uh you're better off with even lower number something like uh one five zero is going to give you a slightly better result maybe 175 or Max 200 is going to work for you just fine so the default 200 in my case works just fine I really don't need to increase that on the other hand this pressure solve iteration works really well for you if you are have a character in front of your smoke or your fluid simulation or any type of collision so I always increase that to double the number that is going to make the fluid simulation run slightly better and more accurate and if you have colliding objects it's going to interact with that more accurately now the amount of push that you get is being defined by two attributes buoyancy and gravity now the first one buoyancy is going to make the fluid buoyant based on the attribute that you are selecting so if I go with density and that's the only one that I have if I instead of minus 0.5 set it to 0.5 it actually pushes the particle a lot faster and further right let's introduce a little bit of temperature to bring fire into the mix it makes the result look way more interesting as you can see the behavior of the density does change every time you bring temperature and now you can see because the temperature is already set to 0.5 the entire fluid simulation will rise up due to having this gravity set to minus 980 or 980. so if you want that to sort of stay in the void you just zero that out and if I rewind now it's no longer pushes itself upward and the amount of push that you see now is the result of the buoyancy that we're getting I can even go in there and give this an extra push in x-axis by putting -100 or I can intensify that minus 200 and now we get even more push from buoyancy and from the gravity now you can see the smoke lingers it doesn't vanish or dissipate and that takes us to the next roll out attributes where you have density enabled temperature enabled and then you have dissipation rate for density and dissipation rate for temperature I can just make that a little bit better to read easier to read now dissipation rate density in this case is very very low I might even increase that to 0.6 and you can see the smoke dissipates a lot quicker you can do the same thing with temperature and instead of one I can just move that up to 1.3 and now we have a slightly faster dissipation rate for temperature and for density again it all comes down to a type of look that you're looking for I feel like that they're hitting boundaries so let's have a look at that well they're not actually which is good I'm going to turn that off now enough with this we go into Source there is not much in there I mean if you're using a normal default fluid Sim you will be getting emission rate but remember we're connecting this to the emitter driver and the driver the spawn burst instantaneous it can have particles rate in here as well and that rate is going to define the amount of emission that you're getting that's why we don't have this here what we have instead is density scale and temperature scale so if I go in there and reduce this temperature scale to 5 if you feel like all right I need a little bit less temperature that's what you get and now you have more smoke and temperature is almost non-existent you can reduce the temperature as uh density as well set it to 0.5 instead and then you get a less amount of temperature and less amount of density that's your way of controlling the density without tweaking the particle system I feel like dissipation rate is not high enough so I'm just going to set the dissipation rate for density to one and let's give that a try and that's uh that's a lot better I'm going to save and now we go into forces you can add vorticity if need be so I can go in there and increase or introduce a little bit of turbulence and you can see it adds Swirls and a little bit of unexpected Behavior to my fluid simulation and make the result look way more interesting I'm a huge fan of turbulence the difference between turbulence and vorticity is vorticity is a small scale turbulence that's the simplest explanation I can come up with you can increase the speed to make the result a little bit more erratic so if I just go in here and set that to something like five you can totally see that when the particles or the fluid actually start emitting in here looks really really cool with Collision it really comes down to the look that you're looking for at the moment all boundaries are open so the density goes beyond the boundaries and dies off if you would like to close them uh so the puff of smoke hits the boundaries and deflects or bounces back then you can go ahead and close them in this particular example they don't even hit the boundaries so we really don't care but that is available to you to tweak if need be and lucky last we have render where we can actually change the look of our simulation by changing the colors so with the smoke I can certainly tweak that to a darker smoke if fire is what I'm looking for I can go and let's say instead of this flame thrower type of look I want to change that to a puff of toxic smoke if that's the case I'm going to recolor my density smoke color you can change the opacity of your smoke using density gains or something like 0.5 so they're semi-transparent now and to change the render temperature instead of using the black body which is the typical color palette for fire I can switch to curve and I get that color chip whereas a very over saturated fire that I'm looking at right now but that gives you the opportunity to go in there and tweak some of these values so this is definitely the potion look the puff of toxic smoke that I was talking about and you can even change the value go higher than one and that now emits light as well and glows a little bit so if I set that to 1.5 or 2 now we're actually not only introducing the fluid it emits light at the same time so if I go in there and I'm just going to turn off some of these actors in the scene so some of them we really don't need probably Skylight I don't need and sphere reflection I don't need all I have is this guy right here and if I go there and the way that I use Auto activate again the same scenario I'm going to bring this up so I get to see the result better I can even hide the floor I really don't need that let's have a look and that's the type of result that I'm getting and from this point you basically take it from there and you just get the desired look I can go on and on and on but to be honest with you that's just a brief look at what the particle system is about fluid simulation is about and how to link the two I truly hope you found this video useful and use this particular technique in your own projects thank you very much for your support and for staying in touch and for your comments until the next one see you guys later
Info
Channel: SARKAMARI
Views: 7,104
Rating: undefined out of 5
Keywords: unreal engine 5, unreal engine 5 tutorial, ue fluid simulation, unreal engine fireball, ue5.3 preview, unreal engine vfx tutorial, unreal engine vfx beginner tutorial, unreal engine niagara tutorial, unreal engine niagara, ue niagara tutorial, ue niagara fire, unreal engine beginner tutorial, unreal engine beginner tutorial building your first game, unreal engine beginner course
Id: 8Udr0i8EJiM
Channel Id: undefined
Length: 35min 0sec (2100 seconds)
Published: Sat Oct 07 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.