Godot 4.2 - Particle Effects Tutorial.. Deep Dive!

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey everyone I hope you're having a great day so now that 4.2 is finally out I wanted to put a particle effects tutorial together for you this is going to be a deep dive tutorial looking at the various settings that make up the particle effects system in gdau now there is a lot of excellent documentation on the gdau website already about a particle effects and I'll put a link in the comments below but for those of you that maybe prefer to see a more visual example then this tutorial may be for you I'm certainly not an expert and there are definitely some settings that don't seem to make a lot of sense to me and I'll point that out as I go through them and if you do see or know something that I've missed then please comment below that would be really appreciated so this is going to be a two-part tutorial in this part we'll cover the basics although by Basics it's pretty much 90% of what you need like the effects I just showed you but in part two we'll go through some of the more advanced topics like turbulence collisions sub emitters Etc things that would make this video longer than it already is and at the end as a bonus I'll go through how to create some of these effects that you see here so grab a cup of coffee sit back and relax while I take you through particle effects let's get set up okay I've created a basic scene here just to give us something interesting to look at while we go through particle effects it's just a world node 3D there with a world environment and a floor so what I'm going to do is I'm going to click on world and I'm going to right click and do add child node and then I'm going to search for particles or particle in this case yeah and you can see that we've got two options here one is CPU particles 3D and one is GPU particles 3D now you can probably guess what the difference is uh CPU particles 3D runs its processing on the CPU and the GPU particles 3D runs its processing on the GPU now it's not quite as obvious as that a lot of CPUs now can handle GPU related commands and what have you but the we're going to be using GPU particles 3D because if I'm understanding some of the documentation CPU particles 3D may actually be deprecated in the in the future it's meant for older devices older mobiles older PCS obviously PCS that don't have dedicated graphics cards but this GPU particles 3D is what we're going to go with and I suggest that's what you look at today because these are the features that we're going to be looking at so let's let's click on Create and here we go we get our box here uh and I'm just going to drag that up we've got like I say we've got this yellow box or what is it well it's actually not unique to GPU particles 3D it's what gdau uses uh to define whether or not this is active or not based on whether the camera can see it I find it quite um obtrusive so what I'm actually going to do is I'm going to click on view and then gizmos and if we go to GPU particles 3D I think I might to click it twice and there we go and we can hide it but nothing is happening it's just actually just an empty thing uh node there and you can see we've got a couple of warnings here nothing is visible because meshes have not been assigned to draw passes and a material to process the particle is not assigned so no behavior is imprinted I think that's a very difficult message to understand if you were to come straight into gdau and try and play play around particle physics what they're referring to are these two tabs here we're actually I'm actually going to go a little bit jump a little bit ahead here and create these just to show you but we we'll we'll certainly come back to those what we're going to do very quickly do is I'm going to click a process material here and I'm just going to create a new particle process material and then under draw passes I'm going to click on pass one and I'm just going to create a new sphere mesh don't don't uh pay too much attention to that all I was doing was just getting it working and now we can see that we do in fact have something happening we have these spheres being generated and dropping down from our uh nodes position well why is it doing that well it's actually doing that because gravity is set at the moment so they're dropping down uh but they are sort of dropping down a little bit and then they're disappearing so let's have a little look at the basic settings that we've got here we've got this emitting setting well guess what if you turn that off it stops emitting and if you turn it on it starts emitting again that makes sense we've got an amount here okay and that is eight and what that is saying is that at any time during the emission if particular if it's looping like it is now eight of the um particles will be active Okay so this is this is this is an important number and we're going to talk about what that actually means because the spawn rate at the moment is based on time and we'll come to that in a few moments but you can see that any point there are eight being emitted at any point during the lifetime of the particle effect moving on to amount ratio this is one that's confusing me a little bit so if you do understand this one please let me know it does make General sense but what actually it looks like in practice is quite different it's saying the amount of uh particles that should be emitted so at the moment one which is fine which is basically saying yeah do as you're told but if I just move that down to something like 0 let's say 0.4 it doesn't seem to produce uh um emissions in any sort of meaningful way it's almost like it's gone random I don't quite understand how that how this is working there is another effect or another setting in time that we can look at that seems to make a lot more sense to me and seems to be a lot more predictable so I would leave this one alone um biom have play with these things this is what you end up doing with uh particle effects you play with them until you find something you like but I'm going to set that back to one and the final setting we've got here is sub emitter and like I said that's something we're going to be looking at in the next tutorial but the effect of a a sub emitter is that once this is finished emitting you can have it do something else so this is particularly useful for things like fireworks where perhaps you want a firework to come out and then and then to spawn multiple Fireworks off the back of that you know something effect like that but we look at that in the next tutorial for now that's the basics of getting a GPU particles 3D set up on your scene okay let's talk about the time settings and the first one we see here is Lifetime it's probably one of the most important settings of all the particle effect settings you're going to see today as this name suggests it says how long this particle is going to last so if we set this to 2 seconds what we'll see now is that suddenly the emission rate drops basically to half what it did before and there's a reason for that and I hope it makes some sense is that now there are still eight particles being emitted but of course they're lasting a lot longer so the emitter is if I drag those up there you can see that uh there're still eight being going done but now suddenly it's not having to emit particles as quickly and by the same token if we do 0.5 of course it'll each particle will be a lot shorter but then the emissions will have to be a lot quicker so this this is the number you're going to play around with a lot to get this right they amount and lifetime are two figures that you're going to be playing around with a lot when you play around with gdau I'm going say that back four and one or something like that so you can get a real feel for what it looks like okay uh interpret to the end is a bit of an odd one I can't actually um work out what this one means if you do know and do understand it then please do let me know um it says causes all the particles in the node to interpolate towards the end of their lifetime well there is an interpolate uh checkbox down here uh that seems to do the same thing I certainly can't notice any difference in general you can change the setting you see it looks to be the same again play around with these I I would leave this one alone for now um I don't seem to think it makes a lot of difference with everything I've played around with but by all means if you do know of any advantage for this one let me know I'll set that back to zero one shot uh basically what that's saying is once it's finished emitting in this example four it will stop let's let's do a few more let's do 100 let's say okay and if I turn it back on if I click emid what it'll do is it'll emit emit 100 and then it will stop emitting so this is something that you would Ed for something like an explosion well you wouldn't want it to keep looping the explosion you want it to do it in one go okay um so that's that's one shot there I'm going to turn that off um and put that back to something like what I'm I'm playing with the numbers here just to kind of give you a variety of what's going on okay so you can see four being emitted um if we look at pre-process pre-process is a useful one if you want the uh emissions to look like they the effects for to look like they have been running for a while so if I just turn this off and then on again what you will see is that 1 2 3 4 gets generated okay and if I turn it off and then on again you'll see 1 2 3 4 gets generated but if let's just say we want it to look like it's been going like this for a while let's say two seconds we if I press two enter okay and now when I turn it off I have to wait for them to finish and then click on on it goes straight in there okay like it's been running for ages I think my graphics card is letting me down a little bit here but you get the idea um that it actually goes straight into what it would look like okay so that's obviously for something like a fire perhaps or something like where you want the fire to be uh showing like it's it's not going to suddenly rise from the wood From the Ashes and suddenly create the fire you want to see it in action okay um speed scale this is a very useful one you can use this to do things like speed up the uh um particle effects or slow them down so what you can use this for is actually pausing uh if you set it to zero look you can actually stop the particle effects all together it does cause a weird effect in the editor I don't think that effect exists when you're in game but it does look a little bit jumpy in there there but the same token you can speed it up as well you can make it go crazy or what have you so this gives you a little bit of flexibility to do all sorts of things perhaps as you're playing with the particle effect you can adjust the speed scale if I just I'm going to make this a little bit longer for the next setting let's make that two seconds long okay now uh explosiveness is how quickly all of these will be delivered in one go okay so at the moment they're being distributed in a nice even format 1 2 3 4 every two seconds right so it's one every half a second if you wanted to give it a little bit more uh upfront uh emission so let's just say let's say 0.5 what you'll see is that they all get distributed in the first half of the lifetime okay now so we get four and then we get a delay and then you four and then you get a delay this would be another very good example of when you would want to um uh an explosion you wouldn't want it to be kind of um slowly emitting you would want some level of explosiveness if you do one then they all come out at once and you can't even see so you may want to to play around with this and pick something like 0.8 something like that and just and then get it to and you'll see they all come out at once so that would be a very useful one for an explosion okay I'll set that back to there Randomness is another good one again this is a I I find this is a very useful one for something like a fire perhaps where you want the missions to have a little bit of Randomness to them not pure uniformness so if you set this something like f whatever you make it fully random and then it'll just emit them at a variety of rates um which is uh you know I think possibly a little too much so you want just have a little play with a little blend on this so so it still keeps it something that like you expect but not crazy crazy so Randomness is is that effect that you the setting that you'd want to use there okay the fixed FPS so what this is doing is this is saying how many times for each of these particles do I need to recalculate where I am now at first glance that might think well 30 is too low well it is um in essence but you can actually mix and match them with these interpolate ones if I turn them off it might look a little bit jaggedy let's turn that a little bit lower and you'll see what I mean if I make that 15 you can really see the difference now can't you okay that it's actually doing 15 frames a second um but there are a couple of settings that can help you out here and they are interpola and fractional Delta so interpolate what this does is it says well every frame I'm going to check to see where it would be based on the calculations of of those um emissions so interpolate then moves it back to a nice smooth kind of run there do you see so it's actually saying well don't although it's only you know updating itself 15 times a second I'll I'll do I'll I'll fill in the gaps for you and let you know where where I think you should be okay and fractional Delta actually kind of adds to that and this is useful if you've got a lot of um particles uh it adds a little bit of extra extra cleanliness to it I think this is my take on it it doesn't make a huge difference but it's wor another one of those T Flags you might want to play with just to see if it if it improves your effect does add a level obviously all a lot of these add a lot of um processing uh overhead so you know play with these to get them right so if I if I put this down to five hopefully here we go this is a good example so even though interpolates on it's still not doing a great job there yeah so you want to play around with these and get something that's I think I think 30 seems to be an acceptable level and well by the way we're using spheres here we're not spheres aren't the only thing we're going to uh emit from this I'm just using spheres because they seem to be very clear and easy to follow as as as they drop okay so yeah but have a play with interpolate and have a play with fractional Delta to get the setting that you like I have a feeling that the lower you can get away with here the better but also you probably want to try this on try this on different systems uh to get something to make sure that it's actually working for you okay so that's the time settings moving on to drawing okay in order to understand the drawing settings we need to turn back on our our GPU particles 3D Gizmo there we go so we can see it so what is this yellow box now like I say my understanding of this yellow box is it's a box that it tells the camera when it should be and should be uh enabled or you know active and if it's not in view then in theory something like that the uh particle effect would not need to be run however in practice I've really struggled to get this to disabled so I'm not 100% sure the workings of good do here I believe my the general advice is make this as small as you can um if you need to right so we can just do this here and then and then make it smaller So in theory now you need to have a um the camera needs to be uh have it in shot more for it to be active but I've not found this to be a perfect science so again this is one of those ones if somebody can advise me on how this draw Bo work draw box works I honestly think you do not need to worry about this just get this reset it's probably one of those things you may have to come across when you start optimizing your code but for now I would say you can actually just leave that well alone there is a setting in here that I do believe is important which is this local coords here so if I just drag this across here no sorry not that one control Z that and just grab you you'll see something that's happening here you'll see I hope you'll see that the they are actually following the the uh the Spheres are actually following my transform and and so they're they're dropping but they're staying in line now if I that to to local what you'll see now is that they initially after a weird drop from the sky they will actually follow and stick to stick to the actual uh GPU particle uh node itself okay so there's an effect there that you might want to think about this would be an example where you probably would want to have it sticking to it for a jet engine uh the uh the thrust coming out of the back of a jet engine uh but perhaps if you were I don't know running smoke off the back of a car you'd probably want to to run something a bit more like this where you would have it kind of uh leaving a trail behind it so that's a that's a um that's probably the only setting I touch on here um like I said this isn't unique to GPU particles 3D it's actually a fairly standard setting this visibility AABB and there's a fair amount of information on there uh I haven't looked into it inte great detail because I haven't needed to yet it's probably an optimization uh level um technique that you may want to have a look at later on but for now that is basically everything you need to know about drawing okay before we move on to the main event which is the processed material I did want to talk about draw passes and I actually don't like the term draw pass I wish they call it something like emission pass because a draw pass is what gets emitted it's it's the actual thing that's getting emitted each time uh as you know we've been using a sphere mesh but what you could potentially do is use a box mesh as well and there we go it's creating boxes for you uh and this is the sort of thing that you may want to use but generally speaking you'll probably be using a quad mesh um which uh and what you'll be doing is you'll be setting the uh let me just change the size this bit bigger uh what you'll be generally be doing is you'll be putting an image here uh and then uh and and that image will have some transparency and you will and it will always face towards you it's not at the moment you can see it's actually disappearing when we go behind it but you'll have we we'll set up a setting so that it's always facing toward W you and this is a very efficient way of creating particles doing the way we're doing with a sphere mesh is not hugely efficient you can see it's creating well I don't know how many verts that is but it's got 64 segments 32 rings so you can imagine that would be quite an overhead it's okay it's okay right now and we can create quite a lot of these and it's not really noticing any difference you know we can do a thousand probably and yeah my computer seems to be okay with this doesn't seem to be having a problem but of course there's nothing else in the scene so it's not it's not really struggling so what we'll we'll be doing later on when I'm going through the examples is we'll be using a quad mesh I'm actually going to change this to a box mesh for now because in a moment we're going to start seeing some of the rotation effects and that's going to be very difficult to spot when we are using sphere so let's keep with the Box mesh okay the other thing it's worth mentioning is I did mention the fact that you can have multiple passes now um if I set this to two so what we could potentially do is have a second pass of let's just say a sphere mesh um and you can't see it because it's probably too small so maybe I want to make it bigger hang on there there you go you can see it's sticking out now so but the annoying thing about this for me is that it's not alternating them it's doing them at the same time it's doing the same amount at the same time I'm not clear on what advantage this gives having multiple passes had it alternated between the two that would have been tremendous but it doesn't seem to be actually doing that I can't find a way to make it do it any of the settings like rotation and scale they all they apply to both of them it's not they're not unique so I'm not going to use this now if you know a use case where this would be relevant then please let me know we're going to stick with box mesh and sphere mesh now just to show you the various settings in process material because if I used a quad mesh it can be a little bit difficult to visualize some of the settings I it's by using this it's actually quite a clever way of of sort of getting over a gdau deficiency which is you can't see some of the settings very easily uh skin setting is seemingly um unneeded I it's it's the skin is to do with bone animations and I think attachments uh between the bones u i I cannot find a use case that if you click on here on the documentation uh there there is none um it just says there's currently no description for this property if you go to skin there's no actual information on here but it is something to do with with bones um and animations so I I I think for now you can probably just completely skip that um so but the key thing here is the pass itself defines what is going to be emitted at each point and for now we will sit with with the box and the sphere uh but we'll move on to quads once we go to our examples so that's draw passes and we are on to the main event as I've said the process material itself so for all of the other things we've done the processed material kind of controls what happens to the emitted particles the speed its angle how you know it size its Alpha all of that stuff it's going to control through its lifetime okay so if we click on process material here it's currently empty like it was at the start we do have the option for a Shader material so if you really know your stuff get into shaders you can create Shader based particles uh I'm not going to be doing that I'm going to be doing a new particle process material here which is kind of like the default standard and here we go we're back to where we were a moment ago now on its own this little guy here I don't know why this hasn't been given one of its own um sub subcategories but lifetime Randomness as it name suggests allows you to to from the uh time of life here to 2 seconds I'm guessing any now now you can go from anywhere between uh not and two seconds and then if you do half you know that something I think that's something between one and two seconds in this example okay depending on so you can you can you can and again this is probably a very useful feature just to tweak just to give you a little bit of variation as you go along okay so I'm going to leave that back to back to where it was to keep everything kind of standard and straightforward okay the particle Flags themselves these are these are flags that allow you to kind of position where things are now for Quad meshes which is what we'll be looking at later on it's you don't need to worry too much about these if you want to rotate them I think you need to make sure that rotate Y is on um things like a line Y will will ensure that it stays um aligned in the on the Y AIS and again disable Zed um uh stops it Moving On The Zed axis there we go here we go you see that example there okay um and damping as friction allows you to adjust things like the the acceleration and deceleration um of that particle now I'm not going to go into huge amounts of information about um acceleration deceleration and damping and all that stuff because you may want to play around with that um with the particles that you're using it's certainly not something that I've had a need for um the linear acceleration of those sorts of things um because I found that all of the other part particles seem to suffice so the ones I really care about line Y and rotate y are kind of the key ones here um you can disable those like I say if you're using quad meshes it doesn't really matter so that's the particle Flags the spawn this uh specifies again as the name suggests how it spawns okay so this is at spawn time and the first and probably one of the most important ones is how it spawns right what type of shape is it using for a spawn now I'm just just skiing straight over the offset and scale the the offset was obviously where about starting in relative to the nose position and it's the shape scale which we which is this one here so if we click on this we get a list of possible options now we've got a point right now like I say makes perfectly good sense but if I do sphere this allows us to spawn from uh a sphere that we cannot see this this is one of the most annoying things that uh I think in good day think if if we was able to see the size of this sphere we would have a really good idea of what was going on but we don't so what I'm going to do let's just um let's just set to what was it one I just noticed there's no reset option on here is there that's interesting one for Rado do to take a look at we have no idea where abouts this sphere is and so in order to fix this what I'm going to do is I'm actually going to turn off if you just be with me accelerations I'm just going to turn off gravity uh we'll come to that in a moment but if I just turn that off now you can see that there's a sphere here now it's very difficult to know what's going on so what I'm going to do is I'm going to turn this up to something like a th000 and now you get an idea actually it might have been easier if i' use a sphere for this for the uh for the draw pass should I do should I do a sphere for the draw pass well we can we can make we can make the sphere bigger let's make the sphere bigger and there we go you can you get a real idea now of what of the sphere that it's using as its emission Point okay now at the moment it's just kind of just emitting at any point in there but you get the idea now you can see that it could emit anywhere this is very useful if you want to have perhaps a sphere object that you're not using gravity on um and yeah and just allow you to kind of create a sort of sphere look the other one you can have is sphere surface and for that to be um uh more visible I think what I'm going to do is I'm going to change the draw pass back to a sphere and make it very small oh there we go that's for Co isn't it and if we make the the sphere size sorry make sphere size like I don't know 0.1 .2 there you go now you can get get a real feel for What's Happening Here okay this is something like I say you cannot see easily based on the uh settings here it's very difficult but by doing this sort of thing you can get an idea and then perhaps change it to a quad mesh later on when you when you know what's going on so you can see this is this is and what the way that one of the effects I created was a kind of sphere and then I rotated this something like that sort of mini map that you got from the uh when they were attacking the Death Star not quite as as fancy as that but it looks a bit like that so there you go so you can really see now what going on by by creating a large number of particles and and playing around with the emission shapes let's have a look at a couple of others box where you're not you you're going to easily be able to guess what that does that emits from a sort of box size um and then points and directed points now I I I may go on to talk about them in a um a subsequent tutorial but the way it works is you can actually create a mesh um and use that mesh as as a emission points a good example of this would be something like a river where perhaps you want to have bubbles coming out of the river you can create a mesh along that River and say right please use these as the points for the river and I'll talk about how to do that it's not particularly difficult you can click over here uh create emission points from node and it'll ask you what node you want to use and it will then create the emission points for you and you can use that okay so that's another thing you can do it's a little bit out of the scope of this one and the directed points is very very similar to that that basically just says which direction those points can go so it uses the normals of the of the mesh uh and finally ring uh this is one I have used for the um a couple of my effects let's just make that a little bit bigger shall we um by changing the height now this is the confusing you have to sometimes you have to play around with the axis so I'm going to try changing the that to one and that to zero I'm trying and work out which axis is which I cannot tell you let's just do one let's try that one on the AIS one and that that's zero there you can play around with these until you get the the shape you desire it's a little bit difficult to see there we there we go we can see now okay um if I just actually just that back I think it pretty short it's the it's that one there and then change that back to zero and we can see I hope that it's now there we go flat yeah something that would have been very very difficult to see had we not used this kind of emission thing I'm going to make the height a little bit lower let's 0.1 and you'll really get a feel for it there we go there we go now you can really see what's going on right you can really see this is kind of like a cool like a bubbling cauldron isn't it you you go Crea an effect without even trying um so now you can really see and what you can do as well is if you want to you can it doesn't have to be the whole thing you can actually make the in a radius let's make that 0.05 and you'll see when they disappear I hope was it was it 0.2 there we go let's try 0.5 there we go you're starting to see there we go now we're getting a real effect around around the ring in fact you can see one of the effects that I use does exactly this I do 0.9 and then it rises up there you go now we got something like a a weird looking ring I don't know what this looks like now maybe some sort of some sort of bubbling Donuts here so that's that that's the position um of the spawn okay and another thing you can do now is you can choose I'm I'm going to drop that right down now so it's a bit more not up down okay so now we we've got this let's try maybe 100 I want to try to find something so it's nice and obvious what it is 50 50 is not too bad is it um and let's make them last a bit longer now that they're not um no T's too much obviously just try five okay so now there we go we're going to see that they're uh that they're kind of going around that ring now in terms of the uh the position that one's done the in terms of the angle this is the um angle that is going to start off minimum and maximum so this is going to add a touch of Randomness to it again for this to work we're going to want to change the draw pass to a cube um new box mesh sorry there we go and obviously set the size to much much smaller let's go 0.1 okay there we go now we see what's going on and if we go back up to here up to minimum maximum side I think you can just do- 720 to 720 uh and you should see they are spawning at different angles can you see that there okay and by the there's a lot of these where you'll see there's a curve okay and you can control um how much between those two values how how popular it should be so I us do a new curve texture click on here this is consistent across but what we can do is we can say it's more likely to be 720 there I think that means it's more likely to be along the 720 there so it's producing a rather weird result that isn't it I've never used it on this one before so that's interesting again might have to might have to seek out some uh some advice on that one it seems to be wobbling between the two I'm even wondering if that's actually broken um okay so that's the actual angle minum Max so that gives you some Randomness in terms of how it spawns and what angle it spawns you can imagine that would be very useful again you don't want to have a pure uniform you know emission each time you can set some values on there so let's um let's close those down just so we're I get rid of the curve texture there we go velocity okay now we're talking this is where we can actually say what velocity this this particle is traveling at when it gets emitted okay now this is a big one at the moment we don't have any velocity whatsoever so this spread is irrel I'm going to change this spread to to zero and I'm also going to um change the uh position again to point okay now at the moment that's going to result in a just the one here I I'm going to change the time back to 2 seconds okay so at the moment we can't see anything because there is no velocity so let's give it some velocity you can see it's got a direction here which is X right but I'm going to change this to a direction of Y one there okay so this is going straight up all right and we I'm going to ignore the spread and the flatness for now I going to change the minimum velocity to say two and the maximum to five and now I seem to have more that's at 10 or something like that and now suddenly you can see that they are flying up in the the air with nothing to stop them because there's no gravity okay uh if we were to add gravity um let's just do that minus. we would we would start to see them fly up and drop out and this is this this is something like a like a a you can imagine like a fountain effect in fact if we change the direction perhaps there to one as well you can see this is kind of firing it out at different rates you see and because we've got a minimum and maximum let's set to four maybe would give us a better chance you can see a really cool fly off here and they're dropping down right so this is something you might want to consider if you're doing like a more natural particle effect like a waterfall where you would fire out but it wouldn't actually um uh you know go on and upwards forever it needs something to pull it down for things like smoke and fire you would not have gravity involved but for something like water that's a good example of where where you would use something like that okay so that's the uh Min and max volume but you'll notice it is emitting from one point okay I'm going to turn that back off again so that it fires in a in a constant Direction This is a rather good example actually I'm also I'm going to um set them to the same speed let's go for let's go for one and one there that's perfect right now what we've got here at the moment is I'm coming out in a nice straight line and that's what spread allows us to adjust if I change this now this spread is like a cone that moves outwards it's it's a it's a bit of an odd one if I just change that let's just change that to 15 you'll start to see things that go out in various directions from where it currently is now I'm going to wrap this right up I'm going to make this back up to a th again and now you can really see what's going on can't you right so that's 15 there I think this I think it's going to be in degrees so where were we and then we can rattle this up and you can get an idea so that's 50 and you can see it's it's kind of going every direction 50° I think if you do 180 that's the maximum so that's absolutely every direction okay and I'd imagine if you do 90 it'll only be forward oh yes no of course that yes that makes that makes sense right it's only going to do um yeah you can see the the angle there that's a per that's a perfect example of what I'm talking about you see so you can control this um about about how it emits outwards this is this is a very very good example and would be very difficult to prove were it not for um were it not for using spheres and quads all right so quite often you'll very you'll want to keep this quite low something like 10 degrees something like that um and blasting out yeah something like that would be good good for a far or smoke or whatever okay the flatness setting allows you to control uh along the y axis this is where I always get confused which is along the Y AIS I always end up having to play play but if I just take that to its extreme you'll see what what I'm talking about there you go now it's constrained it to one to one axis if you see what I mean so it's put it's it's spanned out along that axis and that's again that's a very you you can you can see where this might be very useful in certain scenarios um but I I'll be honest with you and I always have to play around until I get the right uh Direction and axis here um but you can control that and do you know just give it a little bit more kind of control about where it's emitting to that's a good this is this is for instance good looking smoke isn't it um something like that so you can get a real feel for it okay so that's the um velocities that are covered there uh animated velocity this is where things start to get a little bit more complicated Okay so we've got something like angular velocity now I'm going to have to bring this right back down again I'll be honest with you I'll probably change the um spread as well on the uh velocity here somewhere is it spread here we go I'll set that back to zero there okay so we're getting a nice straight line angular velocity controls how uh how much it's spinning as it as it leaves as as it emits so actually make this a bit longer as well let's make this five I'm going to make the velocity speed 0.2 or something2 so we should easily be able to see them coming out now maybe a little bit quicker than that .5 .5 okay here we go that's okay there we go now at the moment you as you can see they're coming out like marching soldiers but the angular velocity gives us a little bit of freedom to to play around with these numbers and as you can see now they're spinning around in various e either backwards or forwards and this is this is something that you can see very very nonuniform now and gives us this effect if you me you got fire now if if you had this and the quad was facing towards now you can see you've got various levels of spin that are happening okay that gives you that control and again you got the velocity curve which lets you completely override the settings so if you if you do select this it will as far as I'm aware it will override anything you put here okay what what's actually saying is um let's do a new curve texture and it will actually let you say right through this lifetime I want it to be at the moment it's on 0er degrees uh but at the start I want it to be minus you have to be very very gentle with this and then at the end like that okay something like that you can see that they are spinning around as per this lifetime here right so starting up .99 and finishing up I could probably say it's down here here we go we can choose the oh we can choose the minimum and maximum so let's just set that minus minus 30 and then 30 all right and now we're going to get some relatively small amounts let's just reset these as well hang on the points you can control all of this this all right via put there we go there we go now we can now we now we can control it a little bit easier it should be a little less a little less frisky now okay there we go we can see how how the Cur how it runs along those curves you can f tune all this stuff I don't usually touch all these um so play around with those and see how you get on but again I tend to use these it's just these ones here again just delete the curve clear that okay let it do it thing here there we go okay directional velocity okay this is a curve that allows you to control the directions that it travels now again I don't particularly you can see here you go you can see it's fired up in in that direction there right so you've got you've got a level of we can make it minus not point2 and point oh God that's got mad hang on so if we do minus one and one there you can see now that it's getting a little bit of directional um velocity as well I how you can see that it'll sort of curve around right I don't again I don't play around hugely with these but you can get you get a feel for it let's let's do a load of them again and just have a look and see what the differences are one second um where's he there we go to a th000 do 2,000 there you now you get a feel for the directional velocity let's just reset those we set to zero let's do Z on one we now we can get a feel for what that looks like perfect look at this you can get a real feel for what it's talking about here uh and some and some of the features you can you can set now again I don't know why you you would do this this looks to me like you're creating a whole lot of pain for yourself but you want to play around with these let see you go and again you can control them via a curve texture if you wish okay so entirely up to you the orbit velocity I haven't touched if anybody understands this this this confuses me the orbital velocity um the radial velocity same thing I'm not quite sure how that works again so do let me know if you uh want uh to understand those bits um and velocity limits okay I think this allows you to control uh how fast um these things can go right so so some and you can set a curve on it to say some are allowed to and some some aren't this is very cool now what's happening there we go okay moving on to accelerations and we have gravity we know how this works now don't we we can do minus 9.8 and there we go we've got a kind of draw drop there right I'm just going to click on zero there of course you can make it a lot smaller of course you can make it on something like on the moon or something and then you can have a sort of a stream going across like that got far too many boxes going on for that to make sense I'm going to remove that down there uh we've got things like linear acceleration so this allows you to increase its speed as it moves or um between a minimum and maximum again using a curve if you wish okay um I don't touch these acceleration seems unnecessary to me for a particle effect but it should allow you to uh adjust the accelerations if you wish the radial acceleration allows you to do something rather cool if I need to um I need to actually change the spread I think for this to be more relevant so just do 30 okay here we go we can start to see it all spanning out I I really like I really like that effect um but now what we can do is we can actually create a sort of a pull or a push uh towards this this point here uh let's try like something like minus three and zero okay it start it always starts off with a bit of a whoosh not sure why so there we go so so now you can see that some are okay some are pushing out and some of them are um some of them are getting away but some of them are getting pulled back in okay so we can try this try minus five and something like two maybe so some of them are going to get thrown out uh harder and some of them are going to get pulled back I think we should minus s then minus most 10 you get the idea you can see some of them aren't are getting are getting pulled back in uh back to the point and getting thrown the other direction despite their speed you can see they're really struggling to uh to to get back and they're having to sit here and they'll get they get pulled back I like that effect it's it's um it's a effect it's well documented on on the good website and it gives a an interesting effect if you want to create some sort of gravity style uh pullback I don't I don't know why you'd use it but uh but it's it's an interesting one tangent tangential tangential acceleration uh creates a sort of a curve effect if I can show you I'm hoping there we go creates this sort of spiral effect as it kicks off look how cool that is and depending on where it spawns I think and and the rate depends on on where about it FES off and as it as it flies off it I think it curves even more so this could be an effect that you might want to use it's making me feel quite queasy watching it I might have to reset that let's just reset those there we go so we got something a little bit cleaner um yeah there you go now you get a real feel for it don't you you can see that as it sprays out it's kind of turning around the curve depending on the spread absolutely brilliant absolutely lovely effect that I really like that one okay um damping like I say this is to do all about deceleration and I I don't understand it enough um but you could use it to start slowing things down and particles and things like that definitely maybe something you want to play around with a tractors I haven't actually mentioned um but what you can have is what's called uh a GPU attractor node ATT tractor GPU attract a box and a GPU attract a sphere 3D things like this now what these do is they can actually affect the path of the uh particle as they pass through them now honestly I've not been using them I've I've not used them uh I I played around with them I found them quite difficult to get the hang of they almost seem like they're a sort of mathematic iCal experiment things you could do with maybe playing around within in the classroom they don't seem to have any real effect that you might want to use in a particle effect but by all means take a look at those uh again it's on the documentation but I've not really found a huge use case for them so let's turn these guys off as well so we're back to where we were there we go sorry okay so we're spawning out there we go lovely um display right so now we can start talking about how these things look over time okay the first one being scale now the scale Min scale Max right so what we can do here is we can say well uh depending on uh you know the size let's say the size of the Box let's just say 0.1 and one all right so now you can see the boxes are a different random size which is tremendous you can actually do the different uh yeah this this is a sort of thing you would want when you creating a file you would no point one on one but you when you're creating sort of effects that you want to be have a little bit of difference to you would you would have a bit of bit of that going on there uh the scale curve so you can say right over time um let's just create a new curve texture uh I'll just reset that I think the reason some of these things has been has been freaking out is because I've been setting those and setting the scale curve as well but now what we can do you see they they've all gone back to the same size again but what we can do is we can make them start small and get bigger there we go see we can adjust this curve and perhaps we can make it go like something like really big and stay big or perhaps big and then go small again right so this is how that curve works yeah so and this is this is definitely something I've used a lot of um when you're using a quad mesh you want the scale to get smaller perhaps as the Smoke Gets smaller um something like that this is a really good example of how you can do things like that or perhaps it just stays alive sorry just so you know you can you can click by left clicking it creates a new thing if you right click it removes it and and you probably notice the bars there you can adjust these this is standard gdau curve stuff right so you don't need to uh know know about particle 3D to use these okay we've got ourselves our sort of Curves uh our scales there bring that back a little bit should we so it goes a bit smaller there I I like that effect there all right okay um and yeah you can set your Min and Max values and all that stuff as part of the curve like I said I think maybe adjusting the um scale Min and Max was messing all that up you've got scale over velocity um so as things get faster you can make the scale bigger or smaller we don't touch the the uh the accelerations do we so this is going to be the velocity is not going to change okay uh potentially you could say well if it's running faster then it needs to be bigger stuff like that um a little bit worth maybe worth having a play with I haven't touched them the other thing is color curves I use this particularly for um uh defining the alpha curve here to say over time uh gray out so let's just have it let me show you how that looks this may not work initially let's just find out because sorry what I just done then hang on color curve curve texture click on the curve new curve and then if I'm lucky I can do that and then click again uh it might be a bit easy to spot actually if I um remove the scale curve all right now that's not working initially and this is because we need to go to the draw pass here we need to give it a material so let's just go to the draw pass and under material we'll click on new standard material 3D and if we click on here under transparency we need to have this Alpha okay and now that should allow us to um what just the alos there that's fine so we should now be able to set the alpha curves let's just have another go with that I'm sorry there is a setting that I had forgotten uh and it's a big uh it's the vertex color here you need to click as use as alido this has caught me out before um and what that allows me now to do is set up the alpha curve so here we go so now we can click on new curve texture again and then click on curve new curve initially it'll be empty because there's nothing there but what we can now do is create our Alpha curve there we there we go that how cool is that I might just change the spread just to make that look a little bit more clear maybe 10 or something now we should start to see that fade away look at look at that and now that's almost that's almost a smoke effect there isn't it that's actually a rather goodl looking smoke effect there he just using boxes now again I think this inefficient because it's h using boxes but gosh you could from that sort of angle you could use that as smoke couldn't you yeah so this is cool so this so what this um uh these allow you to do I'm just let's just keep that where it is um is is set things like a color ramp okay so this is actually a color ramp allows you to change the color over time so let's just let's just do a new gradient texture 1D this this if I click on here gradient this doesn't always work for me let's just give it a quick go let's just try from um red to green or something like that red red TO white there we go it's working on this occasion I think once you start using emissions it starts to mess up we go red to Yellow look there and now we've created a fire effect we created a fire effect without even thinking about it okay there you go so you can choose the gradient the color ramp over time um you can also if you miss mind going away thank you you can have a color initial Ram what this is saying here is is um a selection of colors that it can can can go along uh if you choose this you can it's not going to it's not going to play nice with that one so let's get rid of that and then we'll have here we'll just have a selection of colors um perhaps here we'll say right you can you range from Green there in the middle we'll have a color blue blue something like like that and then over here we'll have red should we red like that right and then and then you can see now what's happening now is it's it's picking a color somewhere along that along that color ramp okay sorry bring that back there we go okay that's the sort of thing you can do and the emission curve again this controls the emission level so you you can choose the amount of emission over time that uh um during uh um the when it's being displayed the emission levels okay the Hue variation again for this to be shown I think I need to um actually I didn't need to get rid of the alpha curve but the Hue variation allows us to say well pick colors in between the uh what what this color is here I don't know if this is going to work for me there and you can choose H this I don't use this this seems too this this shoe variation seems too fiddly to me to get a meaningful color but you get the idea um if I'm using it's only going to be very very subtle okay so you got Hue variation there okay um the animation settings are use when you use an Animation Sprite sheet so the only time I've actually used this is where the settings here I just set the speed to Min to one and the max to one I don't touch the other values but you can see that you could potentially change the uh speed of the animation or indeed you know set some of some of the ways it starts and stops and all that stuff I I wouldn't touch any of that initially at least uh to get your animation going be having a play with that a bit later on because we will be using uh a Sprite sheet animation for the fire so we'll have a play with that bit later on but that's what that's useful and that is all of the settings that we're going to cover today in the um process process material so I hope that makes sense so let's now that we've done all this let's go and get some examples uh of how we can use these in the real world okay so let's get started with a nice easy what we're going to do is we're going to create this spinning sphere here it's got a few characteristics about it it's it's Alpha comes in and out and obviously as you can see it rotates so the rotation is actually be done by Script but everything else we'll do using particle effects so let's get back to our scene and added in okay so I have added a directional light 3D and a camera 3D to our scene so we can take a look at what it looks like when we run it may need to move these but for now we'll just keep them where they are so what I'm going to do and click preview there to right click here okay and then I'm going to click attach child node and it's going to be a GPU particles 3D perfect let's click on create drag it up and what we'll need to do immediately is add a draw pass on the process material let's add the draw pass first which is going to be a sphere a new sphere mesh right it's very very small and it's down there for some reason and we will click on the size I want to make this quite small let's just try 0.1.2 and then let's add the uh process material here new particle process material there we go and we've got that dropping we know why that's dropping right we know that's B dropping because of gravity and that's certainly not something we want to have here so let's just go into our particle process material look at accelerations gravity and change that to zero okay now the from memory you may remember that it's the sphere surface that we need to use here for our um for our point of emissions so let's go over to spawn position and if we click here on point we can choose sphere surface and we can see that now it is actually working around that sphere now I think what I actually set the radius to was two and I think that's okay let's have a quick look in our camera see how we're looking oh let's let's see let's also um up the number of particles to something ridiculous like 600 for now and that's that's promising so if we go to the camera 3D click on preview camera 3D preview okay we're a little low so let's get that camera we selected there we go and on here let's try 10 eight there we go that's absolutely fine okay this is way too many particles let's get that right down to something like 300 I want this to last a lot longer maybe something like 10 seconds which probably means we don't need anywhere near 300 I'll try 200 and we've got this weird effect where it's where it's doing like you know drawing them very very slowly but once they're all drawn they will be um they you know they will will come and go at 200 will be displayed at any one time what I'd like to have here is the kind of um fading in and out so what we will do is we will go to our draw pass here click on down and then we're going to add a material to it so we C standard material here now let's go through the motions make sure we get this right we want to have uh transparency is Alpha shading I'm actually going to turn off so I'm going to do unshaded and that creates this effect here which I rather like I rather like that effect it just gives it a flat look okay the vertex color must be used as albo or we're going to have problems and then under the albo I'll just pick a color that I like the look of um maybe a light blue like the previous one okay now one thing I'm thinking already is this sphere is much too big let's go half the size1 okay and that's not bad now if we go over to our um display here under color curves under Alpha curve we can have a new curve texture and then we'll click on that and then what we'll do is we'll have it click on new curve eventually there we go we'll click in here and we'll have have it at the top and then we'll have one at the bottom there and then another one something like that so that we've got it fades in and Fades out and that's that's already looking really good I think obviously it's not rotating yet okay and we can fix that um very very easily so what we're going to do is we're going to go here let's just rename it as well should should we call it spinning sphere lovely and we're going to create a script for it so click on here spin out I'll put it in lower case I haven't wor putting any of these in folders or anything obviously you would normally do that as part of a project but for what we're doing here we're just going to crack on and get it done so we're not interested in ready what we want this to do is is to rotate every frame so let's give let's actually just give it a speed a rotation speed export VAR rotation speed I think something like 0.25 and then under process here we can say rotate y um Delta times rotation speed okay and now if we run this okay that it doesn't look to be rotating and I think I know why that is we need to go over to the um the drawing which I've now lost where are you drawing there we are and click on local coords and the other thing was that it was not it was gradually fading in what we really want to do is have that pre-process so it's already started let's try 20 there okay now if we click on 3D now we may have I think that'll be okay the next time it does the pre-process I think it's just taking its time this time but if I turn this off we may have to wait a few seconds I feel like this is a slight bug in gdau here you have to wait for it to finish and then turn it back on again okay if we turn it back on pop there we go this is much better and now it may well our script now that we've turned the local coals on if we run it again what do we have a lovely spinning sphere how quickly and easy was that was that done that's obviously because I knew what I was doing but hopefully some of that is very familiar to you the spinning sphere uh uh the sphere surface on the uh on the point emission uh and we've got ourselves a rather cool looking effect there something you know maybe you could use for a sort of a an ornament or something like that a high-tech ornament that you could use as part of your game assets now just a a brief eye on the uh um emissions and things like interpolate and F fractional Delta can we reduce these in fact can we even turn them off we've got 30 frames a second right now this isn't doing anything okay other than staying where it is fading in and fading out so I might even try 15 frames a second I think that's enough frames literally as all it is doing is is fading in and out that may well be enough but it looks okay to me there uh I think 200 seems to be about right I'm not going to spend a huge amount of time optimizing this because you ultimately it may be for nothing but that looks pretty good to me off the bat there we've managed to turn it down to a fix 15 frames per second and turn interpolate and fractional Delta off so this should be a very very efficient particle effect that you can include in your game okay so finally let's take a look at creating this beauty it's a roaring fire as you can see this is all purely a particle effect no scripts here whatsoever it moves from a kind of a red hot at the bottom to an orange and then to a smoky finish at the top I've added some sticks and some stones at the bottom we won't do that as part of this uh tutorial you I'm sure you are capable of doing that with the CSG boxes and CSG spars this is going to be all about creating the particle effect we're going to have to introduce a couple of new things not really big ones one is a quad mesh and the other is a particle Sprite sheet so let's have a look at getting that set up and creating this fire okay so let's go about adding our GPU particle through 3D as always GPU parle 3D GPU parle 3D there we go click on create I'm actually not going to move this one up this time I'm going to keep this one near the bottom makes sense doesn't it's a fireplace it would be near the ground so I just click on there press F make sure it's on Focus uh we want to add our process material and draw passes let's focus on the draw passes first if we click on here the draw pass click on pass one and we're going to add a new Quad mesh this time something we haven't done before okay a quad mesh and this is the quad mesh that you would add an image to so if we click on here what we can do is if we go down here to material click on material new standard material 3D that then gives us a material we can use and we can go through here and do the usual pieces make sure that Alpha is enabled uh the shading is unshaded uh the vertex color uses albo and under the albo here what we're actually going to do is we're going to use a billboard texture a particle texture a smoke texture that is available on the gdau webs site as part of their tutorial actually here it is uh you can click on the link here I will put a link into the uh comments below as well so you can download this Sprite sheet here okay so we will uh load that texture up I'll just do quick load here I've obviously already downloaded it but it's uh it's called particle Sprite smoke one. webp there we go click on that and at the moment it's just um excuse me I have to move this up a bit it's being a bit of a monkey no um at the moment it's just the 8 by8 sheet so we need to tell it to use uh uh it as an actually animation the way we do that for uh particles is we actually go to billboard click on mode here and choose particle billboard and what that will do now is we that means that particle will always face us now wherever we are okay this is exactly what we're after for things like smoke and stuff we don't want it to have a back we want it to always be looking at us so that's good so now what we'll also do here we'll click on keep scale so that we can adjust the scale on it and particles anim here this is actually an 8 by8 particle billboard okay this doesn't appear unless you unless you select particle billboard this will actually be hidden so if you're wondering where it is it's because particle billboard won't have been set okay so we've got our um particle but nothing's actually happening to it which kind of does make sense we haven't set up our process material yet so let's click up minimize that in here and click on here and do a new particle process material and let's just drag that up now so we can get a rough idea of what it looks like and come Ross there we go now it's dropping as usual because of the gravity so let's sort that one out early under accelerations we want to uh change gravity to zero but then it doesn't really do anything it just sort of sits there and that's because we need to go into display animation and set the speed Min and Speed Max I wish this was defaulted to one um uh because then we'd actually be able to see you know at least it trying to move and do something now the reason it's kind of got that weird look at the moment is because we probably we got too many particles so if I set the amount to one there we go now we're starting to see something now aren't we we're starting to see that it's actually creating smoke and then sort of Disappearing like that which is good okay um so I've actually obviously done this before so I believe the settings I used were three for the lifetime and something like 300 for the amount and then I gave it a if we go now down to our uh spawn position we want this to be a ring uh on the uh emission on the Y AIS zero and the uh height to be zero and the radius to be something like 0 0.2 I think is what it was so let's create a small ring down there that's better and it has no acceleration so let's sort that out now let's give it some velocity um that's a very small number let's try five and then we'll set this to somewh one and two it's going in the wrong direction so let's change that to one that's a zero and you can see at the moment it's quite aggressive so maybe that's a little too strong so let's try 0.5 and one that's a bit better okay so let's think about how we're going to actually make this g a little bit smaller and start to fade out so if we go into our um scale here what we want our scale code let's just let's just have something like a minimum of 0.5 and one so we've got a little bit of variety there and while we're at it let's have some um angular rotation which is here is an animated velocity let's just do something like that between minus 30 and 30 something like that just to give it a little bit bit of U uh um rotation as it as it as it moves around um and the scale curve we want this to start getting smaller as it goes up so let's just click on scale curve new curve texture click here click here and let's just try that okay that's looking better that's looking better it's already starting to disappear that's very very good okay and then the usual color curve is one of my favorit here we need to give it a decent Alpha curve so that it gradually Fades out so let's just click on new curve texture um where did that go up here moved out there click on curve new curve and it's not going to be happy so we'll just do this I think the way to do this is to is to get it to fade in a little bit as well because it it looks a bit aggressive coming in there that's a better that's a better look coming in and I think by the same token we want we want it fading out reasonably soon okay this is starting to look better it's not perfect yet and obviously it's very very white so how do we go about making it so that it looks orange at the top orange at the bottom and then gradually go to sort yellow and then black well we need to create a color gradient and let's to give that an early go here we got a color ramp they call don't they s a color ramp uh but you you set the gradient here and these are the colors now now it's done something look it's gone from black to white which isn't quite what we're after what we're after is more of a um initial color here of orange so I got a red and then orangey and then there okay we're happy and then heish let's click on that click there and do a yellow color perfect that one there and then at the end we want more of a black here and we want that to be black okay and we may need to move this this way to make it look more block as we go there we go I'm going to have to play around with these values a little bit until I get something I'm happy with now it's a bit aggressive at the moment um and the reason for that is what I like to do here on the black one here is click here click there and change the alpha to something a little more friendly I think this is very very good I think the velocities is is the problem here I think we I'm going to try not point2 not5 even that sorry that's the animation isn't it sorry where's the velocity let's change those what was that that was let's do minus 30 to 30 again and change the velocity up here yeah let try not point to .5 that's a bit better although it's puffing out a little bit there isn't it let's try 0.51 that's a bit better now I'm not loving the colors here so we may need to have a little play to get the colors right I'm going to try changing that to yellow and that one to Orange you got to be double careful that you have selected it okay let's go with this one to an orangey color about there I'm going to pull that in a bit closer as well like that and that's obviously quite quite a let's bring that around now we're talking now we're talking if I bring this in this one I think we can start to see a real effect there we go okay this is good this is much much better and we just have a quick look at the scale again I might just change this to be a little bit more aggressive on the scale maybe not that aggressive somewhere like that no no I'm going to remove that okay so you can see what I'm doing I'm playing around here until I get a kind of a kind of a a POS effect that I like and I'm already liking this this is quite an aggressive fire I think if I had a choice I'd make that maybe maybe just move this back over here until I find a value I like there we go something like that okay now talking okay I think what I might just finish with is to just TW get rid of you and just start to get this a little bit more aggressive so if I just just do that there that's better now we're talking there now I've got a fireplace that I like the look of that's much much better okay so there we go we've got our fire now just hide that away oh hide that away there that's a fire that isn't too bad now you can see obviously I've tweaked the values from the previous one so there's a little less of this puff going on but you get the general idea this is how you can create a really cracky looking fireplace I will put a link to the original fire that I created after having a about half an hour of tweaking around with it but you can soon see that you can create a really cool effect in next to no time in in gdau with particle effects once you know what you are doing guys thank you so much for watching I hope this has been a useful tutorial for you well done for sticking out this long I know it's been a long one but I wanted to try and cover as much as I could so I hope it's been helpful please put any comment suggestions what have you in the comments below and I will do my utmost to respond to them and help out where I can all right until next time folks next time we're going to be looking at a lot more complicated elements of the particle effects but for now I think we're going to stop here for the sake of your sanity and mine and look forward to doing the next tutorial till next time folks all the best Shar out
Info
Channel: Wide Arch Shark
Views: 8,792
Rating: undefined out of 5
Keywords: godot, particle effects, particle system, tutorial
Id: Pl9PfZL_MaM
Channel Id: undefined
Length: 69min 18sec (4158 seconds)
Published: Sun Dec 10 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.