326 Game Development and Simulation with Unreal Technology
to c hange the points (Figure 6.20).
You have created your very first visual effect using a spr ite emitter to enhance the
look of any level. This effect creates a smokey look. Now, let us see if we can create
another kind of effect using the same kind of emitter. How about some rain?
FIND ON THE WEBSITE
To find updates to this tutorial and upda te d instructions about its implementa-
tion on othe r UE4 versions, p le ase visit the books companion Website at:
http://www.RVRLAB.com/UE4Book/
TUTORIAL 6.3 Simulating Rain
In this tutor ia l we will set up another sprite emitter to simulate the effect of
rain. Like all other tutorials, the first thin g to do is to create a project to which
we add the particle system. The initial setup of this tutorial should resemble the
image shown in Figure 6.21.
NOTE
We will need the demo ro om to be set up before we can proceed
with the rest of the tutorial. You may find instructions to set up y our
demo room in Tutorial 6.1 on page 309.
SETTING UP THE LEVEL
To have a uniform level that we ca n work with, you may perform one of the
following options to start the work:
1. If you have not created the demo room, perform the tasks in Tutorial 6.1 on page
309 to create a project which includes a Demo Room, a Player Start, and a
Demo Display item a s shown in Figure 6.1 3.
2. In the con te nt browser, loo k for a folder inside the Demo Room folder called
Blueprints and open it.
3. Drag a copy of Display Item onto the level and place it along a wall. Change its
properties to the following:
Number: P-2.
Description: Rain Emitter . . .
Type: Square-L
Visual Effects and Cascade in Unreal Engine 327
FIGURE 6.21: Rain Demo Display.
4. Save your level so far.
ORGANIZING ASSETS
Now that we have our level availab le , we will organize the particle systems we
create in the content browser.
5. If yo u are following from Tutorial 6 .2, then you should have a folder
called MyParticles. Otherwise, in the content browser, crea te a folder called
MyParticles.
6. If you do not have th e Sprites folder, create a folder and call it Sprites. This
is the folder where we will put the sprite emitter we are going to create.
7. In th e Spri tes folder you ju st created, create a new material and call it
Mat_Rain.
8. In the Sprites folder you just created, create a new particle system and call it
P_Rain.
328 Game Development and Simulation with Unreal Technology
CREATING TH E RAIN MATERIAL
9. The first step in creating this material is to set up its shading and b asic properties.
We would like the ma te rial to look like what is shown in Figu re 6.14(a). To do
so, double click on the Mat_Rain ma te rial to open it up in the Unreal Material
Editor. Set the following properties:
Blend Mode Translucent
Shading Model Unlit
(a) (b)
FIGURE 6.22: (a) Rain Emitter Material Look. (b) Rain Emitter Material Network.
10. To create a material network like the one shown in Figure 6.22(b), perform the
following tasks:
a. Right-click to the left of the material expression and type Rad ial
Gradient to place a Rad ial Gradient Exponentia l expression.
b. Place a Particle Color node ab ove th e Radial Gradient expression.
c. Create two Multiply expre ssions to the right o f both the Radial Gradient
and Particle Color nodes.
d. Connect the output of the Radial Gradient expression to the B input of both
Multiply expressions.
e. Connect the A input of one o f the Multiply expression to the color output
of the Particle Color expression (its topmost node). Connect the output of
this Mult iply expression to the Emissive Color channel of the Material
Expression.
f. Connect the A input of the r emaining Multiply expression to the alpha
output of the Particle Color exp ression (its bottommost node). Conne ct the
output of this Multiply expression to th e Opacity channel of the Material
Expression.
11. Your material is now set up. Save the Mat_Spar ks ma te rial and close the Unreal
Material Editor.
Visual Effects and Cascade in Unreal Engine 329
SETTING UP THE RAIN EMITTER
Double-c lick on the P_Rain particle system you created in the last section to
open it in Cascade Particle E ditor.
(a)
(b)
FIGURE 6.23: (a) Initial Color. (b) Initial Size.
12. In the Em itters panel of the Cascade Editor, remove all modules from your Particle
Emitter. Only the Required and the Spawn should be left (Figure 6.15(a)). We
will build th is emitter as we go on.
13. Right-click on the name of the emitter in the Emitt ers panel, choose Emitter
and then Rename Emitter . Type in RainEmitter in the name textbox and press
enter.
14. Now we a re going to apply ou r Mat_Rain we c reated in the previous section
to our emitter. Click on the Required module of the emitter, in the Emitter
330 Game Development and Simulation with Unreal Technology
(a)
(b)
FIGURE 6.24: (a) Initial Velocity. (b) Lifetime.
Panel (Figure 6.15(b )) click on the drop-down list next to Material and type in
Mat_Rain (or any name you gave your particle material in the p revious step).
15. To be able to have a visible effec t we need to set up at least three Initial Mod-
ules, and a Lifetime Module. Right-click in the grey area under the RainEmitter
emitter and select to add the following modules to your emitter (Figure 6.15(c)):
a. Color Initial Color: Expand Start Color and Distribution proper-
ties and use values from Figure 6.23(a).
b. Size Initial Size: Exp and Start Size and Distribution properties
and use values from Figure 6.23(b).
c. Velocity Initial Velocity: Expan d Start Velocity and
Distribution properties and use values from Figure 6.24(a).
d. Lifetime Lifetime: Expand Lifetime and Distribution properties
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.137.188.201