Create VFX & animations with Unity’s particle system

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
When I first started out making games I thought that these were what we called animations I associated particle effects with a more continuous, looping, kind of visual effect not something that had a clear start and stop. But it turns out that these effects are actually made using Unity’s particle system, and it confused me for a long time about how to do that So in this video I’m going to give a very clear explanation of how the particle system works in Unity, what the modifiers actually do, and how these kinds of VFX are made. So to create a particle system you simply right click in the hierarchy, go to effects and click particle system. We then get the default particle system and a control panel in the bottom right Just click stop and ignore this for now What we want to look at is the inspector window. This shows us the particle system component and this controls everything about how the particle system works. There’s a lot of scary modifiers so I’ll start with the most important ones: duration, start lifetime, start delay and start speed. Duration is how long the particle system emits for. But crucially, this doesn’t control how long the effect will last, that’s very important to keep in mind. This only controls how long particles are being emitted out of the system, so if you set it to 1, it will emit particles for 1 second then stop the emission. If we untick looping, which stops the effect from repeating forever, and click play on the particle system you’ll see that the system stops after some time, but note that if I stop the system after 1 second, there are particles still active. You might expect the effect to only last 1 second but instead it goes on for 6 seconds before ending. That is because of the second modifier: start lifetime. Start lifetime determines how long each particle exists for after being emitted. This essentially acts like a countdown timer that begins as soon as a particle is emitted. If you have multiple particles then each particle emitted will last for this value and then disappear. This modifier contributes to the TOTAL length of the effect. If duration is set to 1 and start lifetime is set to 1, the total duration of the effect will never be more than 2 This is because a particle emitted at the end of the duration, e.g at 0.99 seconds, will then exist for the start lifetime value of 1 and so the final particle will be around until 1.99s from the first emission, or when the system started. With this new value of 1 for start lifetime, if I restart the particle system you will see that particles are emitted for up to 1 second, and after roughly 2 seconds the effect is finished. So remember, to control the length of a particle effect you must use both duration and start lifetime. The next modifier on our list is start speed, and this is only used for particles that need to move outwards or inwards. Right now our start speed is set to 5, notice the speed at which the particles move outwards at this value. Now if I set this to 1, the particles travel a lot slower. Two interesting things to note about this modifier is that for particles you don’t want moving, this must be set to 0. Then restarting the system you can see the particles are created, stay still, and then die, a bit like you. The other point to note is that if you want particles to move inwards instead of outwards, set the speed to a negative value. If I set the speed to -2, you will see that the particles move inwards and create a sort of coalescing effect. The final modifier is start delay. This is the delay before the system starts to emit any particles When you’re creating an animation, or VFX that doesn’t loop, any part of that effect that doesn’t start at the beginning must have a non-zero value. If I set the start delay to 1, you will see the particle system will wait for 1 second before starting. Notice that this affects the total length of the particle system, with a start delay of 0, our effect lasted about 2 seconds. Now with a start delay of 1 it lasts 3 seconds. And that’s that. In my opinion, these 4 modifiers: duration, start lifetime, start delay and start speed are the most important ones to completely understand if you want to create VFX using Unity’s particle system. I’m now going to quickly go through the examples I showed at the start, and show you how these 4 modifiers are driving the overall effect. But before I do that I need to talk about one other aspect of the particle system, and that’s the emission modifier. The panel below the one we’ve been working on is called emission and this controls how the particle system emits particles. Rate over time controls how many particles are emitted per second, so this value means that 10 particles are emitted per second. If our duration value is 1, which means the particle system emits for 1 second before stopping, then the system should emit roughly 10 particles. I say roughly because there’s a slight delay at the start before the first particle is emitted so it won’t be exactly 10 particles. Now I bring the Emission modifier up because the visual effects I’m about to show you all act more like an animation, with a start and a stop. To make these kinds of effects, we don’t emit particles over time, but instead set the emission to a single burst. See how the particle system emits particles one after another for one second currently. If I set the rate over time to 0, and press play, no particles are emitted. But if I add burst emission by clicking the plus sign in the bottom right, the particles will be emitted together in a single burst. The number of particles is controlled by the value under count. Burst emissions are heavily used to create the non-continuous effects seen in most video games, for example the VFX used for character abilities, gun muzzle flashes and much more. Alright, now we’re ready to jump into the effects I showed you at the beginning. By the way, all these effects are from the Allin1VFX pack on the Unity Asset Store so you can get them there if you wanted, hashtag not sponsored. So looking at the explosion first you’ll see there are a lot of objects that make up this effect. What is quite common is to have a parent particle system that controls the overall effect but doesn’t emit any particles itself, and then have all the components of the effect as child particle systems that combine to create the overall visual effect. Each of these objects you see are responsible for one aspect of the effect. If I isolate the side smoke object you can see what this particle system is doing. And see it with the full effect, the side smoke particles are marked in orange. If I pause midway through the effect you will see the particle count is 25. Each of these little smoke balls is an individual particle, and so each of these is what we’re controlling using the particle system component. First, let’s look at the emission pane, you can see rate over time is set to 0, we’re using a burst modifier with a count of 25. This ensures all of the 25 smoke particles are emitted at the same time. Going to duration, we see it is set to 3. Now because we’re using a burst modifier, the value for duration doesn't really matter. Remember, duration controls how long the system emits particles for, but since we just have one burst right at the start this value doesn’t do anything. Start delay is set to 0, so this particle system will emit these 25 smoke balls right at the very start. Start lifetime is set to a range of between 1.2 and 1.6. If I click on the arrow on the right you will see that the option “Random Between Two Constants” is selected. This means that for the 25 particles emitted, each of them will last for some time between 1.2 seconds and 1.6 seconds before dying. VFX artists will often use random values to make repeated effects more interesting. If a player is going to see an explosion thousands of times during the game, adding this randomness to how the particles behave makes it more interesting and more realistic, since explosions in real life aren’t identical, they all have their own flavour and personality to them. Notice that because we’re using a burst emission, this start lifetime controls the length of this particle effect. The maximum lifetime of a particle is 1.6 so this effect will, at most, last roughly 1.6 seconds, before there are no particles remaining. Start speed is between 3 and 4, which controls how fast these smoke particles move outwards. If I set this to between 1 and 2, you will see the particles move a lot slower, and equally if I set the values to 10 and 11, the particles shoot out much faster. Next, let’s look at the burnmark. This system also uses a burst emissions, but with a count of 1, since we just want one particle representing the burnmark. Again, duration is mostly irrelevant since we’re using single emission burst. Start delay is set to 0.1, because burnmarks don’t happen at the start of the explosion but just after. So this burnmark will appear just slightly after the effect starts. If I slowly go through the effect you can see the mark only starts to appear after the smoke has begun to move out. Start lifetime is 2.5 so the burnmark will last 2 and a half seconds before disappearing. Start speed is set to 0. This makes sense because burnmarks don’t tend to get up and walk about. They stay in the same place for their lifetime, so a speed of 0, means the burnmark will not move. The last part of the effect I want to look at is the late embers part which acts similarly to the other components of the explosion. There is a slight delay before the system begins emitting, the start lifetime is a random between two constants, so these embers will last for anywhere between 1.5 seconds and 2.3 seconds and the start speed is between 0.4 and 2. So some of these embers will move at a speed of 0.4, some will move at 2, and some will move anywhere between 0.4 and 2. The only new part of this effect is that while we’re using a burst emission, so all the particles are emitted at the same time, the count is set to between 6 and 10. So each time this explosion effect plays the number of embers will be anywhere between 6 and 10, again to add some variation and make the effect more interesting. So that’s the explosion. Next is the lightning strike which only has one thing I wanted to touch on. And that’s how the strike itself works It’s composed of the standard stuff we’ve been talking about. It’s a burst emission, with 0 start delay, the particles last 0.2 seconds and there’s 0 speed because we want the strike to stay in place. The only thing to note is that you can see if I pause the system, it still looks like something’s being animated. What’s happening here is that our actual particle is this orange rectangle shape and we’ve got a texture, which is essentially just an image, that we’ve put on this particle and we’re scrolling this texture along the particle to generate a movement-like effect. How to create this effect is outside the scope of this video, but just keep in mind that the particles emitted from a particle system are just like you, they can be whatever you want; they’re not limited to circular shapes, or what you might think a traditional particle might be. They can essentially be anything. Last up is this incineration spell effect. What’s happening in this effect is the pentagram image on the floor is being animated out. Then some fire effects are rising up before the whole thing fades. The fire effects are similar to what we’ve talked about previously. What I want to talk about is the pentagram image that makes up the core of this effect. If I isolate this system and repeat it a few times you can see it’s just an image that enlarges a bit before fading. The animating out effect is entirely driven by ‘over lifetime’ modifiers that you can see down here. If I disable these modifiers this is what’s left. It’s literally just a single particle with an image on it. The random rotation is driven by the Start Rotation modifier here, and if I set this to 0, the effect is almost completely static. To create these kinds of effects you need to have a burst emission count set to 1. The duration doesn’t matter, the start delay depends on when you want this to occur and a start speed of 0. The start lifetime, as usual, controls how long this image stays around for. Once you’ve got this setup, you need to play with the size over lifetime modifier to replicate the animation-like effect that causes the image to grow, and the colour over lifetime modifier to control how the colour of the image changes while it’s alive. These are really powerful modifiers because they allow you to create these animation-like effects for images, meshes or anything else you put on a particle. I suggest going into Unity and tweaking the values for size over lifetime and color over lifetime to see how they impact the particle. And that’s it. Hopefully you have a better understanding of Unity’s particle system, and how tweaking only a few modifiers drives most of the behaviour of a visual effect.
Info
Channel: Archions
Views: 58,830
Rating: undefined out of 5
Keywords: How to, Tutorial, Unity tutorial, Unity VFX, Unity particle system, Particle effects, VFX, Visual Effects, Animations, Game vfx
Id: mJ3k_DLxRU0
Channel Id: undefined
Length: 12min 1sec (721 seconds)
Published: Sun Jan 29 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.