Unity 3D Particle Sub Emitters: Making Fireworks

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
it's almost the 4th of July here in the states and so that means lots and lots of fireworks and as I'm watching these fireworks I was thinking how cool would it be to make a tutorial in unity of how to create particle systems that look like fireworks so in this tutorial we're going to be making what you see right here we're going to be making different particle systems using sub emitters mostly which is a really cool feature found in unity and so we're going to talk about that the end effect won't look exactly like this because I did put a bloom effect on the camera but more or less this is what you're going to get please also consider following us on Twitter we love to shout out to all view and also communicate also follow us on patreon any of our patrons at a silver level or higher will get all the files to this so without further ado let's go ahead and jump into unity so we're in unity and you can see I have a scene and then a game window and then the camera basically I change this clear flags to solid color so the background is just that dark thing and then I'll increase this as we work on the particles so that you can see it okay so the first thing I'm going to right click here and create a particle system and you can see that it's created one but it's in the wrong place it's on the camera so instead of trying to you know finagle this let's just go ahead and create another particle system right click particles there we go so much better and then I can kind of move this around to where I want this but basically what I'm going to have this be is the Rockets that shoot up like this and then kind of explode so they'll go up and then explode so we need to we need to edit the different particles of this to make it look like the path of an actual rocket so over here you see a lot of different options in the particle system the duration is basically how long it goes before it starts to loop so every 5 seconds it's going to start the particles over again kind of in a loop so the start life time I'm going to change this to 3 so the rockets are going to go up for 3 seconds before they explode the duration really doesn't matter start speed I'm going to crank this up a lot to about 70 and then in the emissions I'm going to change this down to to probably about 1 so you can see that these are rockets they're just shooting up so it's like one rocket another rocket another rocket so on and that kind of looks like the rocket so if we can add a trail to that that's the path we want so what I'm going to do is I'm going to create two materials to actually assign to this so the first one I'm going to create material call this trail and then in the shader I'm going to change it to a particles and an additive and then I'm going to go ahead and create a new one gulp call this one rocket there we go go ahead and do the same thing particles additive and then in the particle system I'm going to name this rocket so it's the actual rocket is going up in the air and then down under a renderer you'll see it has a material default particle we want to assign both of these so if I add a trail like that we get another trail material so I'm going to drag and drop that there and put the rocket there and we have two different materials being applied now that doesn't look like a rocket that we want but if getting along the right lines of thinking here so I'm going to go to trails and affect this a little bit so the first thing I'm going to do is going to kind of talk about these things dye with particles that means as the particle dies the trail just disappears we do want that selected because if you unselect it it's going to do some strange things with the sublimator so we're going to leave that on as dye with parents the start color take from parents so if I change the parents start color the trail changes I can change that so it's no longer inherent in it so I have it green let's go ahead and zoom in there so that's green but the path is still a different color so if you want that you can kind of have a different start to the rocket and then a different trail and so looking over here with the trail I'm going to do curve and I kind of want to start out thick and then go spin so something like this and it looks more or less pretty good so it's looking like a trail coming off of that rocket there now I do want the color to be different so I'm going to go ahead and go here and change this now I can create any gradient I want so I'm going to try maybe an orange color so there's a first color there and then a red color like that and I kind of like what's that what that's looking like now I'm going to change this alpha by clicking that little node up there and bring it down to zero and you can see it kind of fades out now I'm going to change this one down a little bit too so it's not so strong and so looking pretty good now you can play with that to give a more strong effect on the trail or a weaker effect if you want to now if I change the actual particles color you can see that it's not affecting the trail that's pretty good now I do want to add a little gravity to make it Bend like that to make a little bit more realistic and that's looking great I like that so now as I look at this they're looking pretty good kind of like the paths are taking but it's missing some you know pizzazz we want to add some sub emitters to this to kind of have some sparkling effects so down in sub emitters you can go ahead and enable this and it says that birth so as these things are created it's going to start to admit and that's what we want so collision is that if they hit or if that death when they stop it would create a new particle system there but again we want the birth you can put any particle system here that you want so for example I can take this rocket duplicate this and then I can just drag this into the new particle yes I have to parent that there we go and now you can see as it goes it's actually spawning the other one again so it's kind of cool it's like going up and then breaking off and the breaking off some more if I go into the the sub emitter and actually alter this particle so emissions crank this up to a lot let's say 50 so each time something spawn it's actually spawned these other things continually as well so that's kind of a cool effect right there in and of itself but we can play around with this next to get a better effect of what we want so it's kind of cool so I'm just going to delete that thing go back down to this sublimator and then it's missing something so if you hit this little plus it'll do a default submitter and you can start to see these little dots that are chasing after that so the default submitter here let's unparent this so that you can see what it looks like it's basically just a single particle that just spawns and sits there so let's go ahead go over there and you can see what that looks like so there you go it's just basically a dot we want that to be sparkles I kind of rotate and come out of the rocket and add that extra little flare so let's go ahead and go to Photoshop here I have something that I was playing around with I can go ahead and just you know delete that I'm going to make this look really ugly just so that you can see that even if you don't have artistic skills you can still get your particle system to look pretty good so I just have a black background as a different layer and you can use any photo editing software you want and I can literally just make the ugliest looking piece of garbage that I really want so something like that for a sparkle and there we're pretty good now even it with it that ugly ifs still going to work so I'm going to you know clear out that black and say this is a PNG I'm just going to call it something stupid like sparkles or sparkle there we go go ahead and save that and then go back to unity and there's my sparkle and so I'm going to create a new material and put that as the actual image for the material so let's go ahead and do that now or I can just put for the rocket as well so go to this rocket here and you can see it's going up so the submitters were not seen so we're going to change the start size to 5 here let me just play around with this oh there we go so you can kind of see it's going to be this weird star sparkle looking shape is what we're going to add to the sub emitter so under sub emitters go ahead and drag that material up and we can call it anything we want but I'm just going to leave this rocket for now so right now it's basically just creating these little sparkles over and over again so the first thing I want to do is go ahead and kind of alter the rotation and the emission of this sparkle so under mission start speed actually this is the speed that comes away from the point so I'm just going to change that to one so it's going to kind of actually spit out of the origin I can do random so it's not so confident so 0 to 1 or 1 to 2 and I'm kind of liking what that looks like so it's looking pretty good yep now I want to add some rotation next so looking over here the start rotation will change the rotation but it won't continually move so if I do ran in between two constants you'll see what that does let's go ahead to negative 360 and 360 and so they're starting at different rotations but they're not moving they're just kind of sitting still like that so rotation over lifetime is what we want we want to run in between two constants and do negative 360 to 360 so they will rotate counterclockwise or clockwise either a whole turn or somewhere in between since it's random so now as we shoot this up it's kind of hard to see but here let me go ahead and pair in this sub emitter you're starting to get a better looking effect going on so I'm going to increase the size quite a bit so starts I'm out of the rocket that's the wrong thing I want to actually do the sub emitter so I'm going to change that back down to 3 go to the sub emitter and start sighs I'm going to do something like 5 and you can start to see it so it's not what we want but you can start to see that it's affecting this so I'm going to change this emission to be something like 50 so we have a lot more sparkles coming off this thing and then change that size back down to like one or two there we go it's actually looking pretty decent that way the colors horrible but you're starting to see that you can kind of play around with this and get a pretty good effect so they're rotating they're coming out alright so let's go ahead and move down here to sorry color over lifetime going to go ahead and do a gradient I'm going an orange one again so kind of move that down like that and then a red color again like we did like that and then I'm going to change the Alpha down like that and you can see that starting to look good and then you can actually create some presets so we can use this over and over and over again like that and there you go so now the trail of the rocket is a little too thick to my lip liking so I can change the curve in the rocket itself to point five and it makes it a little bit skinnier I can change the color so it's like a blue trail or purple trail and it's kind of cool-looking trying to get two different colors I found usually works well but you can use them the same color if you want I like that where it's like a darker red trail but the sparks are a little bit lighter I can even change the Alpha of the trail the stronger the alpha the more cartoony the the rocket is going to look so kind of alter that to your liking now let's go ahead and go back to the sub emitter and increase the rate over time to 300 and it's a little bit too much but it's kind of a cool effect right so let's go ahead and change that down to 150 and again a lot of things with particles is just playing around and seeing what works and what doesn't work and see what you like and sometimes you find these happy accidents it's kind of like Bob Ross right happy little mistakes that you have in the color for this I'm going to do random between two colors so here I can change this to like a blue and now it's going to be picking either the orange or the blue color as its as it's being spawned and so that kind of creates a cool a really cool looking calm effects change that back up to 300 and that's a cool rocket you can edit it you can change it you could do less or more just understand the more you have coming out in the emissions the less efficient your your particle systems can be okay so I'm just going to play around with these colors a little bit maybe change the color of this rocket and so now that's not really doing anything because that's a rock itself so it's that one particle at the top so I can decrease the alpha to zero because it doesn't really even matter you don't even have to see that particle okay so I'm just going to name this sparkles down here so the sub emitters not confusing to us anymore and I'm going to do size over lifetime as well okay so that they're not just being at the same size if you go down like this you can see that starts Kinion gets fat or you can kind of move it for sparkles I like them to kind of pulse in and out in and out so I'm going to kind of create this wave that that goes high and low but eventually reaches zero and you're starting to see what that looks like on the sparkles themselves like it gets really fat and thin and fat and thin so it looks pretty bad so far but it's going to get better and better so I'm going to increase the size of five and you can kind of see what that would look like so could decrease that to three or so and we'll play around with that now if you do random between two curves it's going to pick which curve to go between so I'm going to move the second curve up and basically do the opposite so it's always going to kind of be big and then go to small but they're still going to be that pulsing effect okay and that's looking fine now wait you're big so change that down to two or so and you can you can change edit that but that's looking a lot better already so start life time I can change that so if I do five you can see these sparkles go for a long time and now they stop because under the max particles it's only allowing a thousand so you could change that to like ten thousand but again you got to be careful because more particles on screen the slower it's going to be in your game but you can kind of play around with that and see what you like so start sighs I can start at one I like to keep it at one and then just affect the actual size down there so I'm not super happy with this yet kind of play around with this you can change the start lifetime to one again I'm actually liking that so maybe two ah there we go so just honestly just play around till you get the effect you like and never feel bad just iterating and try and get what you want so now I have two of these rockets if I just you know clone this one's going and then the other one is doing its own thing so that's kind of cool and I can actually make this rocket a child of that and let's see what happens there so as these go up again you see that kind of splitting off you can change that up to 20 and you can see that that's doing the same thing because the max particles is too low but you can play around with that again and get a lot of cool effects so don't don't feel bad to try and break stuff just throw things in see what happens see what doesn't happen so now what I want to do is actually create the explosion so we have the rockets that are going up and you understand submeters and you understand kind of the different parameters that you can play around with so what I'm going to do is I'm going to take this rock and I like the effect I'm going to just copy it down there and now I'm going to make this into the explosion so the first rocket I'm going to leave unchanged but the second rocket here I'm going to actually make an explosion so for the shape for the mission shape instead of a cone so it's going up like this I'm going to change it to a sphere so right there so now it's going to be shooting out in any direction because it's shooting out along the sphere I increase the rate over time you can see what's going on and again the max particles is too low for this so we'd have to play around with that okay so just put an extra zero there and you can see that's going to kind of be what it looks like now it's not a burst that was just kind of flowing forever it's just flow flow flow flow flow let me just change this camera a little bit so we can see this better I'm like what that looks like okay so it just kind of flows like this which we don't want we want to just burst so what we're going to do is we're going to kind of play around with the duration because the duration currently is five before it starts to loop again so I could change this to like zero so it only does it once turned off looping and then I'll just go Boop but the rate over time is 50 per second basically and so we're only getting about three to four at the very start I can increase the duration a little bit and watch what happens here so let's do 0.5 and you can see a little bit bigger burst but again it's not just one burst it's like did it it it it so I'm going to change this to zero and actually add this little component here under admissions called bursts okay now when you create a undeath sub emitter it actually has to be a burst to work I could not put a particle that's not burst into this so I'm going to put bursts add this time is when it starts so I want to burst immediately so zero minimum number of particles 30 change that to 75 maximum 150 cycles and interval really doesn't matter at this point and so let's go ahead and see what that looks like so it should start at zero and spawn either 75 to 150 just like that and we got the explosion it's looking really good so you can kind of play with the colors you can play with a lot of different things the trails especially the stronger color so the Alpha is kind of low but if you want increase the color of the lifetime that's going to make a big difference I'm going to create a new preset that's green there one that's purple so that we have a lot to kind of pick from and maybe one that's blue let's add that and let's just try and green and see what that looks like so let's simulate that and you can see the trail is green now it's changed purple look at that and you can see the effect that it's a very easy fast change just like that now the sparkles same same color over lifetime I can change that so let's go ahead and do like that that purple there and you can see that it's kind of - a cool effect now now the all of these kind of have a low alpha and so you're going to kind of get this soft luck if you want a harder luck just increase that alpha sort thing all right some emitter sparks now what's really cool is I could actually create two different sparkle colors so I have this purple one going off here if I create another sub emitter and I just kind of clone that sparkles so let's drag the second sparkles down there and now it's going to be doing those and now it's it's a lot of noise that's probably too much for an optimized thing but just you know for sake I kind of watch oh you change this start size three so the second one's gonna be bigger right over time change that to 75 so you can start to just play around again I've said that probably a lot in this tutorial but play around get something you like and I'm liking what that is so 1.54 start size simulate that now go back down it was burst and let's parent it to the rocket and then under the sub in bitter death put the burst so as things things are going up there they're popping right let's zoom out let's see what that looks like so it's going up and popping now it's pretty cool you have a basic firework now we can change color it's if you want to do different fireworks I would maybe just clone that rocket change color clone the rocket change color I'm going to change the start lifetime so that the explosions not so big start speed is a hundred so make it you know explode faster or slower or random start life as point five would be a really small one the rockets that shoot up let's go ahead and change this to start life time let's make this random between two constants three and five so they can go lower I'll change to zero that's weird so I can go up to three seconds or it can go five seconds and you're starting to get that different effect so I like that as well that's looking pretty cool okay let's go ahead and zoom back in there move that up I'm going to clone this rocket like I was talking about and get some different effects so I'm liking what that looks like already so let's change the start speed to 80 so this one's a little bit slower random between two constants maybe 80 and 100 so now it's not just a uniform circle it's a little bit more realistic looking that's really cool sparkles that come off of it let's play around with these settings see what happens so gravity modifier let's change it to five not what I want I don't know if you can see that but it's like it's kind of dragging off of the thing so the sparkles let's go ahead and change the colors let's do this red thing and you automatically just get a very different looking affect gravity modifier let's crank that that's maybe four and it's a cool looking effect as well so you can change pretty much everything about this now I'm just going to copy this again let's go submitters just going to try something out to see what happens so sparkles add a new one on death and do a burst here now that's way too crazy and you can start to see the frames lagging so if I go to the stats you can see I'm probably getting about 10 frames per second so don't put that big of yep 27 to 11 to 6 frames per second so don't put too many particles upon the screen at once otherwise it just it doesn't look good at all without that it's about 160 150 frames per second so even though I have a lot of particles it's still doing pretty good now that's pretty much it for the tutorial so you can edit these things as much as you want play around with it for a very different effect the ones we're gaining right now you're starting to see that they're very soft right so if you change the Alpha up it's going to give you a lot more kind of a strong feeling and I like that a lot more frankly speaking having played around with a lot the lifetime the longer the life the longer it is let's talk about this dye with particles though if you click this so it's not dying with particles you see that the trail keeps going and I'll keep on omitting those sparkles until the end so you kind of get those dots to stay on the screen I do like to die with that die with particles but if you want the different effect with the dots kind of staying like that you can turn that off so that's it thank you so much for watching I hope that this was helpful and have an awesome day
Info
Channel: Random Art Attack
Views: 65,651
Rating: undefined out of 5
Keywords: unity, fireworks, effects, magic, sparkles, particles, sub, emitters, color, over, time, size, rotation, variables, advanced, 4th, of, july, celebration, cool
Id: nlLow7DbKkY
Channel Id: undefined
Length: 24min 38sec (1478 seconds)
Published: Sat Jul 01 2017
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.