All
fields in Maya are unique. A thorough understanding
of each field's behavior is a crucial first
step towards an artist's ability to efficiently
and effectively design a dynamic effect. There
are two fields, however, which are commonly
thought to yield identical results: Gravity
and Uniform. While similar, they have an important
difference: how they deal with mass.
While
Gravity and Uniform have different default
attribute settings, they can yield identical
behavior with a couple attribute changes.
Gravity, by default, accelerates particles
along the negative Y-axis. The field also
has the same effect on particles anywhere
in worldSpace, regardless of the location
of the field. Uniform, on the other hand,
accelerates particles along the positive
X-axis. Particles which are closer to the
field accelerate faster than those which
are further away.
gravity
vs uniform default attribute settings
These
differences, however, are not intrinsic to
the field types, but a result of the settings
on field attenuation and field axis. While
gravity has an attenuation value of '0', by
default, Uniform has a value of '1'. As with
all fields, attenuation determines a decay/falloff
effect. If a gravity field's attenuation is
set to '1', it will no longer behave like
real 'gravity', in the sense that particles
closer to the field will accelerate faster.
The axis that the particles move is also just
a matter of attribute defaults. Both Uniform
and Gravity have X/Y/Z axis attributes. With
this said, it should be clear that one can
get Uniform to behave like a default gravity
field by simply setting the attenuation to
'0' and the Y-axis to '-1'.
So
then, what is the real difference between
Gravity and Uniform other than different default
attribute values? As mentioned above, the
difference is 'mass'.
It
is important to know that all dynamic objects
in Maya have a 'mass' attribute. For particles,
this exists has a Per-Particle attribute found
in the 'per-particle array attributes' folder.
If particles are individually selected in
component mode, and the Component Editor is
opened, looking in the 'particles' tab will
display the fact that all particles have a
default mass value of '1'. What is imporant
to note is that ALL fields in Maya use this
mass attribute to determine their effect on
particles... except for Gravity. The
reason for this is that gravity, from a human
perspective, causes all objects at human scale
to fall at the same rate of 9.8 m/sec/sec.
A marble and a boulder dropped from 50 feet
will hit the ground at the same time. If you
want to get scientific about it, based on
Newton's Universal Law of Gravitation, where
objects attract each other based on their
mass, the boulder and marble do not actually
fall at the same rate... but from our human
perspective they might as well be. Gravity
fields, therefore, are most effectively implemented
when you need to simulate gravity... or when
you need all particles to move in a specific
direction at the same speed. To reiterate, gravity
fields ignore mass
Component
Editor with individual particles selected,
mass highlighted
So
what about Uniform? Well, when you need particles
to move in the same direction but you do
not want them to move at the same speed,
Uniform is the answer. Example applications
include dust, debris, transporter effects,
wind blown objects and so on.
In
regards to particle mass, it can be set in
the Component Editor on a per-particle basis,
although this is tedious for particle objects
which have more than a handful of particles.
The most effective way to set mass is with
a creation/runtime expression.
Expression
Editor; creation expression to randomize mass
values
Effect
of Uniform field on particle grid with random
mass values
Example: Disintigrating
Vase
Lets
say you need to disintegrate an object into
dust which gets blown by a gusting breeze.
This can be accomplished by baking lighting
into the textures on an object, then getting
the surface to emit particles which inherit
color from the baked texture. With a nice
animated transparency map the surface can
disappear while a similar animated map controls
the emission of the dust particles. By randomizing
the mass of the particles with a creation
expression (i.e./particleShape.mass = rand(1,5))
and applying a Uniform field, the dust can
dissipate in a more natural uneven manner.
You could even have the size of the dust clumps
be derived from particle mass, so that larger
clumps move slower then smaller ones... you
get the idea. Mass can also be controlled
via a runtime expression so that mass can
change based on definable conditions (i.e./mass
could decrease as velocity increases so that
as particles move faster they eventually accelerate
at the same rate).
In
the above image, particles are emitted from
a NURBS surface emitter. The texture rate
is controlled by an animated ramp, while the
particle color is derived from a file texture
created by baking the vase's shading group
lighting. The particles are pushed to the
right by a uniform field and dissipate due
to turbulence and an opacityPP age ramp.
When
all the particles have the default mass values,
as in the above image, another by-product
is the usually undesirable patterns which
can emerge within the particle object. This
is a result of how often Maya calculates particle
emission. One way to solve this problem is
by increasing the 'oversampling' value found
in Solvers > Edit Oversampling. The reason
to avoid this is that it has a substantial
effect on playback speed. By randomizing mass
values, however, this pattern will disappear,
without a performance hit.
Staccato
pattern removed by randomizing per-particle
mass.
Final
Composite of HW rendered, motion blurred particles
with SW geometry.
Click
Play to see animation
So
at this point I hope the advantages of Uniform
Fields and Mass have been clarified and that
this tutorial has given you some ideas that
will help you get more out of Maya. More detailed
information regarding fields, surface emission
and particle rendering is available, of course,
in the Gnomon Workshop DVD library.