♪♪♪
Zak Parrish: Greetings and welcome back. In this video, we are going to
go through the setup of a simple mesh emitter. I will be honest with you.
There is probably an elite few of you out there who will
find this example somewhat familiar.
I am in the Content Examples project.
If you are looking for some of the assets I will be using,
they can be found in the Content Examples project. Go to the Game folder.
Before we do anything, go to the MyParticleSystems folder.
Click New and select New Folder. We will call this folder "Mesh".
Once we have the Mesh folder, then go to
the Game folder. In the search bar, type "Cow".
We are going to find the SM_Toy_Cow
Static Mesh. I want you to drag a copy of that
into your Mesh folder and select Copy Here.
Go into the Mesh folder.
Double-click SM_Toy_Cow to open it up in the
Static Mesh Editor, which is visible here. Here is the Material for it.
Click the Material to find it in the Content Browser. I would like you
to drag a copy of the Material into your Mesh folder as well.
Select Copy Here.
Let's rename some things. Select the SM_Toy_Cow.
We don't need our own copy of that Static Mesh. That is me
being a little over zealous. Right-click the SM_Toy_Cow and select Delete.
I don't need to be all that crazy about things. Click Force Delete.
That is fine. Now it is gone. All we really need is the Material.
Right-click on M_Toy_Cow and select Rename.
We are going to call this
"Mat_CowMeshParticle".
That is a long name, but it says what it is.
Double-click to open Mat_CowMeshParticle.
Hopefully you have seen the Material Editor once or twice.
If you haven't, it is pretty straightforward. We are going to make some changes.
Select the Base Color and press Delete. It is gone forever.
We are going to replace it with a
Particle Color. Right-click, type and select "Particle Color".
Plug in the Particle Color output into A of the Lerp.
We are going to multiply the Spot Color. Drag off Particle Color,
type and select "Multiply".
Plug in Spot Color to B of the Multiply.
Plug the result of the Multiply into B of the second Lerp. This way, the Spot Color
becomes like a modulation value. No matter what color our
cows turn out to be, such as purple, the spots are going to be a darker
shade of purple instead of being gray,
which would look a little drab.
With that done, click Apply. Click Save.
We have something that uses Particle Color, which will be cool for
our setup. Close the Material Editor. Right-click in the Content Browser and select
Particle System. We will call this "MeshParticles".
Clear out the search bar, so we can see MeshParticles.
Double-click MeshParticles to open Cascade. The first thing I am going to do is right-click
and add a type data module for Mesh.
These have a default mesh already setup.
They are going to start emitting these big blocks, which is not
what we want. Inside the Mesh type data module, you will see
the mesh we are going to use. Click on the Mesh drop down menu
and search for "Cow". You should find it pretty quick.
Drop SM_Toy_Cow into the Mesh property.
If we zoom out, these cows are already starting to come to life.
They are huge. Select the Initial Size module.
Set the Initial Size to 1.0 for the X, Y, Z Max values.
Set the Initial Size to 0.2. for the X, Y, and Z Min values.
The catch is the cows are going to be stretched
and squashed in a lot of different ways. To solve that,
we are going to click the Locked Axes drop down menu and select XYZ.
Now, they are scaled uniformly to
several different sizes. We probably don't need that many cows either. Before we
change how many we have, I would like to change the initial location
from which they are being spawned. Right-click, go to Location,
and select Sphere.
We are going to emit them from a sphere.
Select the Sphere. In the Details panel under Cascade,
you will see there is a 3D Draw Mode. You can click on it and see the
actual sphere that we are talking about. We can select its Radius
and increase it. Now you can see we are spawning cows from inside that radius.
Again, it is a good idea to test this in the level. Drag-and-drop MeshParticles
into the scene. We have a lot of cows
starting to float up into the sky.
I have to admit, that makes me pretty happy. They are all facing the same direction.
I feel like we should fix that. Let's fix the color problem before we fix
where they are facing. Right now we have the Color Over Life module.
That is great, but I don't really want to change the color of these cows
over their lifespan. Select Color Over Life and press Delete.
We want to use our custom Material that we
edited at the beginning of this video.
To do that, we need to go to the Mesh data module and check
Override Material. Then, we can
use the Required module.
Then we can plug in the actual Material we want to override it with,
which is our Mat_CowMeshParticle.
Notice right now, the Material was auto populated with the Material for
the original toy cow Static Mesh. Drag-and-drop Mat_CowMeshParticle
onto Material. Now, our cows immediately turn red.
That means they are not getting any color data whatsoever.
That is the same as a 0 value for this Material.
Right-click in the Emitter List, go down to Color,
and select Initial Color.
We will drag Initial Color up toward the top. I like my initial modules to be near the top.
We will set the Distribution for the Start Color.
Distribution is the type of number you want to use.
Set Distribution to DistributionVectorUniform,
which has Min and Max values. Leave the Min X, Y, and Z values at 0.0.
Set the Max to 1.0 for X,Y, and Z. Now we have cows
of many different colors being spawned.
Again, that makes me super happy. I don't know why; it just does.
Right now the problem is all of the cows are facing the same direction.
Let's solve that. Right-click in the Emitter List and go down to Rotation.
You will see we now have access to modules specifically for meshes.
Select Init Mesh Rotation.
Take a look in the settings. You will see the Distribution
is set to a Min of 0.0 and a Max of 1.0. Set the Min to
-1.0 for the X, Y, and Z values.
It is not going to matter that much. Now we have a lot of random rotations
for all of our cows, which is pretty great.
Now, let's make the cows fall down
to the ground. Again, I am going to try to make the most of
my screen space. I want you to be able to see Cascade, but there is
a whole section of Cascade we are not going to be using too much.
It is nice to be able to see the level at the same time.
Right-click in the Emiter List, go to
Acceleration, and select Const Acceleration.
Set Z to -980.0 and they just start falling.
I like how they get that upward pop at the beginning too.
We will leave the Initial Velocity right where it is. Now, I want
these to collide as well. A quick disclaimer, they are not
going to collide based on the actual collision of the mesh.
They are going to collide based on the location of the particle,
which is going to be at the mesh's origin. You have to know that going in.
You do not do this type of effect if you want pefectly accurate
collision. This is better for things like debris. If you had
a level that was a robot factory,
and you want a gigantic vat of robot parts
being dumped out in the background and
you don't care now accurately they collide, then a
mesh emitter would be perfect. Right-click in the Emitter List,
go to Collision, and select Collision to add its module.
They are not falling through the floor anymore,
but they are dying on impact.
Select the Collision module and go to its settings in the Details panel.
Expand Max Collisions and set the Min and Max X, Y, and Z
values to 2.0. You see they are stopping and
kind of falling down through the floor. They are not doing much.
To fix that we need to increase our Damping Factor. Set the Max value
to 0.4 for X, Y, and Z.
Set the Min value to 0.2. for X, Y, and Z.
They are going to get some bounce. Let's increase it.
Set the Max X, Y, and Z values to 0.7.
Now, we are running into a problem of lifetime
because they are not living long enough to do anything.
The collisions are going to kill them eventually.
They are going to die on that second bounce.
Set the Lifetime pretty high to 5.0 seconds.
There we go. Now we have some cows
falling from the sky and bouncing, which might be
somewhat familiar to a certain very special group amongst you.
With that, you have seen how to set up a mesh emitter. The takeaways here
are once you add your mesh, you can override the Material.
There are also several different modules you will get access to
that are specific to meshes. Notice for Rotation, I have
Init Mesh Rotation and Initial Rotation.
I would want to use the Init Mesh Rotaiton for those.
That is going to wrap things up for this video. Thanks a lot.
♪♪♪