Particle Effects Tutorial
|
- This is a beginner-level tutorial on how to create particle effects
Overview
This page gives a step-by-step tutorial on how to create a particle effect. These effects have dozens of different parameters, and this tutorial only covers a tiny fraction of them. For more details, see:
- Particle effects - for the many different properties
- Particle effect functions - for the specific HSL functions which can control particle emitters
Note that to change particles, the primary method is via the Properties Panel. Some properties are on the Particles, and some are on the Emitter itself.
Terminology
A Particle effect is something that is generated by a particle emitter, which, naturally enough, emits particles. A particle can be pretty much anything, from a light source to an asset which could be anything from a tiny leaf to an entire building, and many things in between. A simple way of explaining it, is like a raincloud: The cloud is the emitter, and each of the raindrops is an individual particle. However, for development, the term "particles" can be used interchangeably to refer to either the entire effect, or the individual particles.
Particle effects can only be changed in the specific Area where they have been created. To make an effect that can be modified individually, in a different area, see Copying particle effects
Creating a particle effect
The steps to create a particle effect are:
- Create a Particle spec, which means assigning a name to an emitter and its related particles, along with choosing a texture (graphic) for the particles
- Create a new instance of the new Particle Spec asset within your game world
- Modify the properties of the instance of the emitter and/or particles
Particle effect tutorial #1
Create a particle spec
- Via the Create Menu, choose Particle / New Particle Spec / Local
- The Create Particle Spec screen should appear, with both "Create Emitter" and "Create Particle" checkboxes selected
- In the Create Particle Spec screen, enter a name for your emitter (for this example, you could use: Effect1)
- This should automatically create a name for the particles, with a "_p" suffix (for particle).
- Stick with the default emitter type, BASIC_EMITTER
- Stick with the basic particle type, BILLBOARD_POINT
- Choose a texture for your particles
- It will be up to your team to create the textures that you want. With Clean Engine, you will receive a few textures, one of which we will use for this example
- Click on the "..." button next to the Texture box, select Engine / CleanGame / GlobalParticles / Textures / HE_particle.dds
- Click on "OK" in both windows, to get back to the viewport
Create an emitter
Now we will create an emitter instance, based on the asset spec that you just created- Via the Create Menu, choose Particle, and you should see a side-menu listing the names of various specs available. Select the one that you just created: effect1.prt (the .prt suffix stands for particle)
- This will create a basic emitter within your game world. It should be dropping particles (with the HeroEngine logo texture) in a steady stream.
Note: If you are having trouble focusing your view on the emitter, be sure to first work through the tutorial on Starting HeroBlade to learn how to look around in the game world.
Modifying particle properties
For best results, open and dock both the Assets panel and the Properties panel. A good way to do this is to keep the Assets Panel docked on the lefthand side of your screen, and the Properties Panel on the right.
- In the Assets Panel, in the Default section, open the "Particle" section, and select the particle type that you want to modify: effect1_p.prt
- In the Properties Panel, change the color of the particles
Changing color
- In the Color section, under DiffuseColor, click in the box to the right and then the "..." button to open a color wheel
- Select a color, and the particles should change to that color
- Set the color to red, and close the color wheel box
Changing direction
- In the Motion section, next to the Motion property, click on the "..." button, and try changing the XYZ values. For example, set the "Y" value to 1, and the particles should head up instead of down
- Set both X and Y to 1, and the particles should head up at an angle (like coming out of a cannon)
Changing duration
At this time, if you back up and look at the effect, you should see that you get about four particles at a time. To increase this number, modify the LifeSpan property in the Misc section.
- Change the LifeSpan to 2
You should now get about 8 logos appearing at a time, and they will be starting to "arc"
- Change the LifeSpan to 10
Note that the arc lengthens, but not immediately. The new LifeSpan only applies to the newest particles that have been created.
Buoyancy
The "weight" of the particles can be changed with the Buoyancy property. Positive values make particles more buoyant. Negative values make particles less buoyant.
- Set the Buoyancy to -5 (negative 5)
Trails
Each particle can be set to have a trail, and the trails have their own properties too.- First we need to specify a size for the width of the trail, by setting one of the two trail vertices
- Set TrailVertex1 to have a Y value of .001, by clicking on the "..." button
- Nothing visually will happen yet, since trails are still toggled off
- Set TrailVertex1 to have a Y value of .001, by clicking on the "..." button
- In the _Trails section, set DoTrail to TRUE
- A series of white dots should appear
- Right now things aren't very interesting, because all the trails are overlaying on top of each other.
- A series of white dots should appear
- Set TrailDecay to .15
Rotation
- On the Assets Panel, click on the .prt emitter asset to be able to get at its Properties.
- Alternatively you can select the emitter name with the .prt extension that does not have the _p in its name from the Properties panel.
- On the Properties Panel, set DeltaRotation3D to have a Y value of .5
- The particles should now come out in a rotating pattern, like a slowly-moving lawn sprinkler
To better see this effect, tap CTRL-O to go into Overhead Mode, and then hold down the Right Mouse Button and move the mouse to move the viewpoint around
Changing speed of generation
To change how quickly that the particles are generated, it is necessary to change the property in the emitter, not the particle.
- In the Assets Panel, click on the emitter, effect1_prt
- In the Properties Panel, change EmitFrequency to 1
- Particles should now come out at a rate of 1/second
- Change EmitFrequency to .1
- Particles should now come out at a rate of 10/second
Increase the speed of rotation
- On the emitter, change DeltaRotation3D to other values and see what happens
- For the purposes of this example, end with a Y-value of 20, X and Z of 0: (0,20,0)
Bouncing
Right now particles are probably either flying off the edge of your world, or disappearing through the ground. Let's change how this works.
- In the Properties of the particle (not the emitter), set CollisionResponse to COLLIDE_BOUNCE
Many other effects are possible, and the best way to explore is really just to experiment. Have fun! Here are some ideas:
- Set the particle TrailDecay to 1
- Set TrailVertex1 to (0,0.1,0)
- Set TrailColor1 to dark purple and notice how it affects color on one edge of the trails
- Copy the value in TrailColor1 to TrailColor2, 3, and 4 and watch what happens
- Set the Buoyancy to 5
- Under the DiffuseColor property, set the Type from RGB to Gaussian RGB
- Set the Red value to 1.0
- Click on the arrow to the right of the number, and change it from "Value" to "Gaussian"
- Change TYPE to "Timeline"
- Click on the left arrow to activate the timeline
- Click on the black box, and change the color to red
- Notice how the Timeline starts red on one side, and fades to black
- Click in the middle of the timeline
- Set it to a different color, like green
- Close the timeline box
- Set LifeSpan to 3
- Set Buoyancy to -1
- Set CollisionResponse to COLLIDE_STOP
Feel free to keep experimenting! For other examples, see below.
Particle effect tutorial #2
- From the Create Menu, choose "Particle / New particle spec / Local"
- Give the emitter a name, such as your name or your character's name (the same name should be automatically filled in for particles)
- For the texture, choose HE/Engine/CleanGame/GlobalParticles/HE_particle.dds
- Click "OK" to get back to the world.
- In the Assets Panel, locate the new Particle effect under "Particles" and select the one with the .prt extension
- In the "Instances" section of the Assets Panel, click on "Instances Menu" choose "Add instance near camera"
- Select the new instance in the Assets Panel
- You should see a new particle effect in the viewport.
- Open the Properties Panel. It should have three tabs at the top, for the "Emitter" instance, the ".prt" emitter, and the "_p.prt" particles. (If you don't see tabs, ensure that the effect is selected, and that the
Selection arrow is the current tool)
- Click on the _p.prt tab to change the particles:
- Set Buoyancy to 1
- Set LifeSpan to 30
- Set Size2D to 0.01
- Set DiffuseColor to #.5,.7,1
- For a fancier effect that uses a timeline cycle, use: [0:#0,0.36,0.78,1:L][0.992228:#1,1,1,1:L]P;2 (you can copy/paste the numbers into the field)
- Click on the .prt tab to change the emitter's properties:
- Set DeltaRotation3D to (0,0,5)
- Set EmitFrequency to 30
- Set "LinkChildren" to TRUE
Samples
To see several samples of different particle effects, go to the Particle Demo area in your HJ-reference world.
- When logging in, select your HJ-reference world
- Once in the world, open your Organizer Panel and ensure that the Areas tab is set
- In the search box at the bottom of the Organizer Panel, type PARTICLE DEMO
- Double-click on the Particle Demo area, and open a new PLAY instance
- Look around
To examine the specific properties of an effect, either click directly on the effect (ensure particle effects are visible via the Filters Menu first), or via the Assets Panel.
- Open the Assets panel and the Properties panel (have them both docked at the same time)
- Look in the Particles section of the Assets panel
- Particle emitters just have a ".prt" suffix
- Particles generally have a "_p.prt" suffix (note: a particle may be auto-loaded, which means that it may not show up in the assets panel)
- Click once on a particle or emitter in the Assets panel
- Its related properties will be displayed in the Properties Panel
- To tell which emitters that you are looking at visually:
- Click on the emitter in the Assets Panel
- Click on an instance of the emitter (in the lower part of the Assets Panel)
- Click Mouse Button #4 (the Back Button), which will center the view on that emitter
Note: Particle effects can only be modified in the Area where they were created. So just because you can see a particle effect, doesn't mean that you will be able to modify it.
To copy an existing effect to another area so that you can change it, see Copying particle effects.