Adding particles with campfire exemple

Add  a particle system :

Right click / Effects / Particle system.

A default particle system is created and plays in the editor. You can now see floating white particles, because the default material is white.

You can modify the various parameters in the inspector and see the results live in the editor.

 

Particle system main parameters

Although we cannot talk about all the various parameters in details, because it should take an entire website dedicated to the subject, we can review the main parameters.

  • Duration : it’s the lifetime of the effect, if looping is turned on you will not see any difference.
  • Looping : basically tells once particle lifetime is over, to continue with a new one.
  • Prewarm : to enable if you need the particle system to be already playing when you start a scene.
    Useful if you have a fire in the scene for example, if disabled you’d see the fire particles start from zero and grows into a looping fire as if the fire was lighted just when you enter the scene.
  • Start lifetime : lifetime of a particle, once the time has passed the particle disappear.
  • Start speed : how fast the particle will spread along its lifetime.
  • Play on awake : if turned off, particle effect will not start until it’s launched by script, if you want the particles to be shown at start of the scene, just leave it on.

 

note that on some parameters, you’ll see a little fly up on the left side , allowing you to choose between values, curves, or multiple random values too..

 

Emission

Emission parameters are used to change the rate of particles spawned by the emitter.

 

Shape

Changes the volume that particles are emitted from using various shape of emission (cone, sphere, etc..)

 

other options are self explanatory : size of the particles,modifying the color of a particle over lifetime, its shape over lifetime..

 

 

 

Noise

The particle will move along the noise image that you specify by modifying the noise parameters.

Texture Sheet Animation

A single particle can display an image, or even an image animation to render more illusion.
Let’s take the example of a campfire effect :

 

 

  • We’ve already got a particle effect created and running in a cone shape with a good radius (0,8) and a litle angle (1,20) to be more shaped like a cylinder (the cylinder shape does not exists). The gravity is set to 0,58 to have the particles go up.
  • We create a new material, call it “fire”.
  • We set its shader to be a Particle/ Additive.

The “additive” mode is a blend mode.
Blend modes are used to determine how 2 layers are mixed together. If the first layer hides the second, if the pixels are combined, etc..
Additive mode in our case, adds the pixel values from the boths layers; intensifying the colors (the lights will be lighter, the darks will be darker). That’s all we want from a firecamp light.
For more explanation about various blend modes, visit this photo blog site.

  • We will now add a sprite sheet to the material(more about sprite sheets here ).
    I’ve took a fire animation effect made from 4 columns by 4 lines, if you watch each sprite individually from 1st line to the 4th column and continue like this, you’ll see a little fireball animated. We will add this animation to each particle displayed.
    The image is set as a default 2D texture (the default image import setting, btw).
  • So let’s get back to our fire material, and set our fire image, as the particle texture.
  • We go back to our particle system, and in the “renderer” option, we set the material to be our “Fire” material.
    What do we see? we see all the sprites displayed on each particle, not an animation neither a good effect.
    Let’s work on it.
  • In order to get a descent animation of the sprite sheet, we enable the “Texture Sheet Animation” option, and fill the tiles X Y inputs by our values : 4 columns and 4 lines, so x : 4 and y : 4.
    Hey, that’s better, we can play with the random starting frame of the sheet to avoid to see the same animation pattern, and play with the Start size of the particle effect too to be a little wider, and we’re almost good.
  • Now we can enable the “Size over lifetime” parameter.
  • we’ll try to have the fire particle to shrink as they go up, as in a real campfire.
    When we enable the option, we see that it’s quite the opposite of a campfire : the  fire particles are tiny at the base, and gets wider as they spread, like in a flamethrower. We just change the curve at the bottom to have a linear effect from wide to narrow.
  • Then we’ll have to play with the particle size and emission to get the wanted effect, have fun !

 

 

 

 

 

Leave a Reply