During the past 4 weeks I implemented the framework for this particle system so Amps reached its first working version. In this article I’ll describe the basic workflow through a few examples.
Before we move on I’d like to thank Attila Malarik who acted as 24/7 Unity and C# helpline despite crunching at his day job.
Setting up the emitter
I created an empty game object and added the Amps Emitter component. (All non functional parts of the Amps editor UI were removed for clarity.)
The emitter stack contains a single module which controls the basic properties of the particle system, currently only the number of particles.
After setting the spawn rate with a simple scalar module, I took care of the DeathCondition: if that stack produces a value of 1 for a particular particle then that particle gets killed. Having a constant value wasn’t very useful here so I set up a simple curve which outputs 1 when the ParticleTime reaches 3. This is the classic functionality of “kill by age” but the curve could be controlled by any of the emitter or particle properties, from emitter speed to particle alpha.
The last step was adding a random Vector module to the position stack which defined where the particles were located. I turned on visualization to make it more apparent where the limits are.
Simple motion
Although the acceleration and velocity stacks are not yet implemented, there are several ways to make the particles move using only the position stack.
When the weight of the vector module is decreased (indicated by the pie meter) the particles start to slide into place. This happens because the stack’s value is carried over from the previous update and not zeroed out. The less weight the module has the more time it’s going to take to fully overwrite the stack’s default value (0, 0, 0).
In the second part of the video I set the blend mode to Add which made the the particles move beyond the point defined by the module: due to the blending mode their position “grows” steadily.
Yet another way for movement is animating the X and Z coordinates of the particles by a curve: Here they steadily move sideways on X while their motion on Z reflects the drawn curve. Everything is driven by DeathCondition so the closer they get to fulfilling that condition the further they progress on the curves.
The last example shows how to move particles using two modules: the first one provides the start value while the second “fades in” over time, using a curve in its Weight property.
Samplers
There is an important rule regarding random values in most modules: they are generated once and then stay the same throughout the life of the related entity (emitter of particle). If we want more control over this aspect we have to use the sampler group of nodes. The only sampler at this time is the Point Sampler module, so let’s see what can be done with it:
It behaves very similarly to the Vector module: it defines a position in different ways. The important addition here is that it can roll the dice again when the sampling condition is met.
First I set up the sampling so a new value was picked at every second and then, to make the transition apparent, I decreased the weight of the module to mix in particle position from the previous update. (As you might have already guessed, the flashing rectangles indicate when a new sample was picked for the highlighted example particle.)
The second example shows how two samplers can be set up in a way that each samples when the other is in full effect thus avoiding any jitter caused by the sudden change in output values.
So this is where the project is at: a lot is to be done but the foundations are working. If you have suggestions, ideas or questions, please contact me.
