It seems like all the posts I’ve contributed to the #AltDev community have been theory-based or a little abstract in nature…well I’m here to break that trend!  Let’s discuss something that too many game devs leave to an afterthought: VFX!Preface

This is the first of a 3 part series based around specific techniques you can use to improve the VFX in your game without having dedicated personnel on it.   In this post we’ll explore the basics of particle systems, using Unity3D, the next post will explore integrating different VFX objects (lines, trails, particles) to create cool FX,  as well as scripting the behavior of VFX objects, and the final post will be on advanced techniques and considerations.  So let’s get started!

Weather Effects are a great example of the usefulness of Particles.

The Basics of the Particle System

Particles are a cheap, efficient way to draw many small things on screen at once*.   Every game worth its salt uses them but every game can benefit from more.  From the dirt kicked up by the player’s shoes when they run on a sandy trail to the muzzle flash of a gun to weather, fire, sparks, glows, drips, and really any other effect you can think of!  Particle systems are different from engine to engine, but the basic functionalities are these:

  • Particle Texture
  • TRS behavior
  • Emission behavior
  • Movement behavior

Particle footprints!

Particle Textures

I’m not going to go over how to paint particle textures here as I’m not even a self-proclaimed artist.  However, this is the basic building block of your particle, and the better it looks the better your system will look.  Some engines allow you to animate particle textures (generally like a sprite sheet) and colors but we’ll cover this more in depth in part 3 of this series.  In Unity3d, you must attach your texture to a material (which has shader information) as well as determine how the texture is billboarded — or rendered in relation to the camera.  Standard billboards always render the particle facing the camera’s view head-on; vertical billboards always render the particle vertically (such as gunshots in a wall); horizontal billboards always render it horizontally (such as footprints!)  Stretching particles in Unity allows you to take advantage of the length and velocity scales, which is useful for effects like blood dripping down a wall.

Tornadic patterns can be achieved with clever use of TRS behaviors.

TRS Behavior

Translation, Rotation, and Scale are the basic position attributes for elements in a 3D game.  The TRS behaviors in a particle system relate to where the particles are at a given point.   Unity3D offers a wide variety of options relating to translation, but rotation and scale are limited.  The velocity attributes on a particle emitter in Unity affect how the particle translates, and is probably the most important thing to start with.  Local and world velocities are useful for simple translation structures, but random velocity can also be added for more explosive effects, and tangent velocity can be used for more specialized effects (such as in the Tornado example to the left).

Mesh Particle Emitters are useful for 3D emission effects.

Emission Behavior

Emission behaviors control the quantity, placement, initial properties, and lifespan of particles.  Unity3d has two basic types of emitters: Ellipsoid and Mesh emitters.  Other engines have other types of emitters, but Ellipsoid is probably the most common.  Ellipsoid emitters in Unity emit particles within an ellipsoid (gasp!), and mesh emitters emit either at or interpolated between a mesh’s vertices.

 

 

Movement Behavior

Particles can use force to simulate gravity's pull.

Finally, movement behavior changes the way the particles move through space.  In Unity, this is represented by Force and Damping, which change how fast the particles are moving over time (providing for more realistic drag, etc.)

 

Afterword

Particles seem to be a foreign mystery to many devs who are just starting out in an engine.  Particles take a lot of time, iteration, and practice to get right, and you have to be familiar with what all of the properties of the emitters do.  I recommend making generic particle effects like the ones you see in this post in your spare time, as practice and familiarity are the best ways to get better.  And better particles mean cooler games :D

This was an introductory look at the particle system in Unity and overall particle system usage.  In the next post, we’re going to dive a little deeper and look at how you can integrate multiple VFX objects (such as particles, line renderers, trail renderers, etc.) to create more advanced VFX and how we can integrate scripting into the behaviors to get more precise control.

I’ve exported a unity package of the particle effects I’ve used in this post, you can Forest Johnson’s Unite Presentation.

{ P.S. The next one is going to be much more interesting :D }