Unreal Engine 4 Particle Systems Tutorial
In this Unreal Engine 4 tutorial, you will learn how to create particle systems and update them using Blueprints. By Tommy Tran.
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress, bookmark, personalise your learner profile and more!
Create accountAlready a member of Kodeco? Sign in
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress, bookmark, personalise your learner profile and more!
Create accountAlready a member of Kodeco? Sign in
Contents
Unreal Engine 4 Particle Systems Tutorial
25 mins
- Getting Started
- What is a Particle System?
- Creating a Particle System
- Cascade: The Particle System Editor
- Applying a Material to Particles
- Attaching the Particle System
- Setting a Particle’s Velocity and Size
- Setting the Particle’s Size
- Increasing the Particle Spawn Rate
- Shrinking the Particles Over Time
- What is a Curve?
- Modifying a Module’s Curve
- Adding Color Variations
- The Initial Color Module
- Toggling the Particle System
- Creating an Explosion Effect
- Creating a Burst
- Moving the Particles Outwards
- Setting the Emitter Loops
- Spawning Particles on Enemy Death
- Changing the Explosion Color to Enemy Color
- Setting Particle Parameters Using Blueprints
- Where to Go From Here?
Increasing the Particle Spawn Rate
To increase the spawn rate, you need to use the Spawn module. This module controls how fast the emitter will spawn particles. Along with Required, every emitter must have a Spawn module.
Open PS_Thruster and then select Spawn. Go to the Details panel and then expand the Spawn\Rate section.
Set Constant to 50. This will increase the spawn rate to 50 particles per second.
Go back to the main editor and press Play.
As you can see, it now looks more like a trail. To make the particles look more like thruster flames, you can shrink them over time.
Shrinking the Particles Over Time
Open PS_Thruster and then go to the Emitters panel.
To shrink the particles, you can use a Size By Life module. This module will apply a multiplier to the particle’s size over its lifetime. Create one by right-clicking an empty space in the emitter and selecting Size\Size By Life.
By default, this will have no visual effect on the particle’s size. This is because the multiplier is always set to 1. To shrink the particle, you need to adjust the module’s curve so that the size multiplier decreases over time. But first, what is a curve?
What is a Curve?
A curve is a collection of points. Each point has two things: a position and a value.
When you have two or more points, you form a line. Below is an example of a basic linear curve. Point A has a position and value of 0. Point B has a position of 2 and value of 1.
If you sample a linear curve at any position, it functions like a linear interpolation. For example, if you sampled the curve above at position 1, you would receive a value of 0.5.
If you create a curve that declines, the value you receive will gradually get smaller. This is the type of curve you want to use for the Size By Life module.
Now, you will create the curve above within Cascade.
Modifying a Module’s Curve
Select Size By Life and then go to the Details panel. Afterwards, expand Life Multiplier\Distribution\Constant Curve\Points. Here, you will see a list of points for the Life Multiplier curve.
In Val is the point’s position on the curve. For Size By Life, a value of 0 indicates the beginning of a particle’s life. A value of 1 indicates the end of a particle’s life.
To decrease the size multiplier over time, you need to decrease the Out Val of the second point. Set Out Val of point 1 to (0, 0, 0). This will decrease the particle’s size towards 0 over time.
You can visualize the Life Multiplier curve using the Curve Editor. To do this, click the graph icon on the Size By Life module.
This will add Life Multiplier to the Curve Editor. To fit the curve into view, click Fit in the Curve Editor.
As you can see, the size multiplier decreases from 1 to 0 over the particle’s lifetime.
Go back to the main editor and press Play
The particles now look more like flames! The final thing you will add to this particle system is color variation.
Adding Color Variations
To set a particle’s color using Cascade, you need to set up the particle material correctly. Navigate to the Materials folder and open M_Particle.
Currently, the color is set in the material. To use a color from the particle system, you need to use a ParticleColor node.
First, delete the node connected to Emissive Color. Next, add a ParticleColor node and connect it like so:
[spoiler title=”Optional”]
If you would like to control the particle’s opacity as well, add a Multiply and connect it like so:
[/spoiler]
Click Apply and then close M_Particle.
To set the particle’s color, you can use the Initial Color module.
The Initial Color Module
Open PS_Thruster and then add an Initial Color module. You can find it under the Color category.
To add color variations, you need to specify a range the color can be in. To do this, you can use distributions.
Select Initial Color and then go to the Details panel. Expand the Start Color section and change Distribution to Distribution Vector Uniform. This will allow you to specify a range for each color channel.
For this tutorial, the color should range from orange to red. To do this, set Max to (1.0, 0.0, 0.0) and Min to (1.0, 0.35, 0.0).
If you look at the Viewport, you’ll notice the color behaving strangely.
This is because the Color Over Life module is constantly updating the color to white. To fix this, select Color Over Life and press Delete. Your module list should now look like this:
Close PS_Thruster and then press Play in the main editor. Look at those thruster flames!
Next, you will learn how to toggle the particle system, depending on if the ship is moving.
Toggling the Particle System
To check if the ship is moving, you can check if the player is pressing any movement keys.
Open BP_Player and locate the Event Tick node. Add the following set up to the end of the node chain:
Let’s run through what this set up does:
- This checks the MoveUp and MoveRight axis mappings. If both return 0, that means the player isn’t pressing any movement keys.
- If Branch returns true (player isn’t pressing any movement keys), deactivate ThrusterParticles
- If Branch returns false (player is pressing a movement key), activate ThrusterParticles
Click Compile and then close BP_Player. Press Play and switch between moving and not moving to see the toggle.
Now it’s time for the fun part: creating an explosion particle system!
Creating an Explosion Effect
Instead of creating a new particle system, you will duplicate the thruster particles. Navigate to the ParticleSystems folder, right-click on PS_Thruster and select Duplicate. Rename it to PS_Explosion and then open it.
For an explosion, all the particles should spawn at the same time instead of one by one. This is known as burst-emitting.