Unity wind particles tutorial

This is a tutorial on how to make stylized wind particles using Unity's shuriken particle system. It can be used for both 2D and 3D games.

### Setup

Before getting started, first create a new particle system. Then, set its start speed to zero. To make visualization easier, consider reducing the emission rate under the emission module and increasing the size of the emitter's shape in the Shape module (to reduce visual clutter). Any shape will do for this tutorial.

### Anatomy of a loop

The first step in any creative endeavor is to break the effect you're trying to achieve into its basic components. To that end, we must examine the anatomy of a loop.

A simple loop consists of two axes of motion: vertical and horizontal. It moves up and then down. And, at the same time, it moves forward, backward, and then forward again.

### Getting started

Unity's shuriken particle system has a module called "Velocity over Lifetime," which we can use to move a particle in a specific direction at a specific point in time via a curve graph. The trails module will then take care of generating a trail for us.

To prepare the curve editor, first enable the velocity over lifetime module. Then, switch the value method from constant to curve using the arrow to the right of the input boxes. Finally, click the "Particle System Curves" bar at the bottom of the inspector window to show the curves graph (if it isn't already visible).

On this graph, the y axis represents a particle's velocity at a given lifetime percent (a 0 to 1 value along the x axis). Curve visibility on the graph can be toggled by clicking on any curve in any module. Nodes can be added by double-clicking on the curve in the graph, and nodes can be rotated using the handles that appear when one is selected.

To make a loop, we must first make the driving particle go forward, backward, and then forward again. Hide all curves except the x axis (our forward axis). Click and drag the curve to bring it to the top of the graph. This will cause the particle to have a positive velocity along the x axis at its max speed.

Next, we need to make the particle go backward for a moment during its lifetime (which would occur around the top of the loop). Add 3 points somewhere in the middle (and an optional point at the end), and drag them around to create a dip that reaches down to the maximum negative value. This will cause the particle to spend this period of time moving backward (negative) before moving forward again. Change the number in the top-left corner of the graph to increase the speed for this axis to whatever you'd like.

Next, we need to make the particle move up and down, to complete the loop. Ultimately, this will look like one hill going up (for upward movement) and one valley going down (for downward movement). Create 4-5 nodes, and position the hill over half of the x axis dip and the valley positioned over the other half. At this point, the particle should loop once when played.

To make it easier to change wind direction, set the velocity over time module's space setting to local. With that done, you can now rotate the particle system to blow wind in any direction.

Now, it's time to replace the particles with trails. First, enable the trail module. Then, in the renderer module, click the circle next to the trail material, type Default-Particle, and select it as the new trail material. If you have a custom material, apply that instead. I've attached a solid circle image to this post, which you can use however you'd like. If the particle trail appears too large at this point, you can adjust its start size.

To remove the driving particle at the front of the trail, create a new material, and assign any transparent shader, such as the alpha blended shader with the tint color's alpha set to 0.

At this point, assuming everything is working correctly, you should have a wind trail that loops once. However, it instantly pops in and out of existence. To fix this, enable the color over lifetime module. Then, open the color dialog, and add a point halfway. Change the start and end point's alpha to 0, and drag the center point (at alpha 255) to wherever you want the particle to be most visible along its lifetime.

To make the trail appear to move, change its lifetime to anything lower than 1 in the trails module.

To make the trail grow in size as it moves along, enable the Size over Lifetime module, and create a curve similar to this:

You now have a stylized wind particle effect that you can customize however you'd like!

For more of a 3D effect, experiment with the z-axis curve in the velocity over time module. And, to move the loop position, simply drag out a box to select all of the inner nodes in the velocity over lifetime module's curves and move them left or right.

The project files and examples from this tutorial are available for \$5+ patrons to download in this post.

### Become a patron to

17
Unlock 17 exclusive posts
Be part of the community
Connect via private message