364 Game Development and Simulation with Unreal Technology
Screen Alignment to bec ome based on the velocity. This will stretch the parti-
cles as they speed up to m ake the effect more natural.
The next task was to make the particle system able to utilize our material’s
sub images. In order to do so we changed the Int erpolation Mode of the
Sub UV section o f our particle system to Linear Ble nd and its Sub Images
Horizontal and Sub Images Verti cal to 6. This will make our particle sys-
tem able to split the mater ia l into an array of 6×6 sub materials, and blend fr om
one to another linearly.
We also need to make app ropriate changes to the Spawn a nd Burst sections
of our particle emitter. Next, we added a Lifetim e module to our emitter and
made each particle last between 0.7 to 1.0 seconds. After setting the lifetime
of each particle, we added an Initial Size module in which we assigned a
random size to each emitted particle that r anges between [40,70,0] to [60,90,0 ].
Next, we gave our p articles a speed value between 40 to 60 along their Z-axis
by using a Vector Uniform distribution. We also made some modifications to
the color and opacity of o ur particles. We want our particles’ colors to start with
a very bright glow ([20,5, 1]), but for the glow to fade as the fire particles age
([7,1, 0]). We mad e proper adjustments to the Alpha Over Life of our parti-
cle’s Color Over Life module to make them transparent as they age, as well.
However, our effect is not complete yet. The problem in our effect so far is
that, de spite setting its Sub UV values, the effec t still uses just 1 out of the 6×6
sub images for each emitter particle. To make th e effect be able to go over each
sub image, we need a Sub Image Index module to be added to the emitter.
This modu le can be programmed in such a way that during the lifetime of each
particle, it selects one of the 6×6 sub images as it ag es. Once the Sub I mage
Index m odule is added to ou r emitter, we made it use a Floa t Constant
Curve. This curve starts at the value of 0 (at time =0), and goes linearly to a
value of 35 over the lif etime of our particle s (time=1) . Therefore, the particle
emitter starts with sub image 0 and assigns it to each emitted particle, and as the
particle ages, the image will change to 1, 2, . . . , and finally to 35, at th e end of
the particle’s lifetime.
ADDING LIGHT TO PARTICLES
Once the pa rticle emitter is place d in the level, and especially if it is placed close
to a surface, you will soon realize that the emitter doe s n ot cast light into the level,
despite its bright glow of fire. To make this effect even more realistic, we add ed
a Light module to our emitter. We made proper modifications and adjustments
to the light module for each emitted particle to ca st a fiery light into the scene .
6.8 PARTICLE TYPE DATA MODULES
So far we have used the CPU-based and GPU-b ased particles. The default data type
of an emitter is Sprite emitter. We referred to these emitters as CPU-based emitters.
We have also worked with GPU-based emitters whose data type is GPU Sprites.