We have been working on a customizable, artist-friendly way of specifying particle velocities for particle systems in Unity. The built-in particle system animator only allows for a very limited range of motions, and it would be really hard to make the particles flow around obstacles or create vortices.
But before we dive into the details of our custom particle editor, why don’t you have a look at the result in the demo below? (We also demonstrate a Unity implementation of the shimmer shader effect from the previous post as well as a shader which creates foggy mirrors)
The screenshot below shows our editor in action. You are able to specify motion of the particles in a 2D plane by placing control vectors, solids, sources, sinks, etc. Velocities are then computed for the entire plane by running a fluid solver for a certain amount of iterations using your inputs as boundary conditions. This only takes a few seconds and ensures that you get a nice and smooth velocity field in the entire plane. In the scene view, control vectors, solids, sources and sinks are displayed in order to help with aligning the motion with the scene geometry.
We have chosen to create a 2D editor instead of a full 3D editor since it greatly simplifies the user interface as well as reducing the computational load of the fluid solver. Our system still allows you to create 3D motions by extrapolating the 2D motion into space using a linear fall-off.
But more importantly, the system allows for using a linear combination of several velocity fields. Therefore, to specify a 3D motion you create several 2D motions and position them differently in your scene. The below screenshots show 5 planes combined to create a swirling, tornado-like motion. The highlighted plane in the left image specifies the horizontal motion, while the the highlighted plane in the right image and the 3 remaining planes contain sources and dictate an upwards motion.
The custom particle system fully integrates with the built-in particle emitter, animator and renderer meaning that all other aspects – save for the motion of the particles – are handled in the usual way. Other highlights include the ability to:
- Emit particles from your custom sources rather than the single particle emitter
- Add vortices to the velocity field
- Change the weight of each velocity field separately at runtime, effectively turning on and off various motions
We plan on putting this custom particle system and editor on the Unity Asset Store in the near future.