Initial values of particle attributes
Let’s say, we’ve set initial state for our particles or just have created them with some defined attribute values via meticulously crafted script, and now we want to change some of them… For example, smoke sprites have various starting scale and then they grow larger with time from it, and we want to make them half their size… Or we simply want to modify mass of exploding object‘s shards (that, let’s say, has been precalculated with respect to the volume of the shard), but without recalculations, re-setups and so on.

Particles with initial mass for each shard
The problem is – particles don’t have creation stage anymore. Writing down and modifying starting values for a hundred of particles is not an option. And if we write something like this into runtime expression:
mass *= 0.5;
each frame mass would be cut in half. Of course, we can write:
if( frame == 2 ) {
mass *= 0.5;
}
and while passing this frame #2 values would get modified, but it has it’s own problems…
Anyway, there’s a simple solution – use initial values of attribute you want to modify. All these initial versions of attributes are named the same as the attribute with addition of zero in the end:
mass -> mass0
position -> position0
myCustomAttrPP -> myCustomAttrPP0

Some of the standard particle attributes and corresponding initial ones
So, runtime expression for the mass looks like this:
mass = mass0 * 0.5;
Also, it’s often very useful to have access to starting values – which coordinate a particle had started from, which velocity with and so on.
By the way, if you assign a value to such initial attribute – it’d be saved permanently as an initial state.
In: FX · Tagged with: expression, initial state, maya, particle attribute, particles, runtimeAfterDynamics, runtimeBeforeDynamics