Particle Explosion Part 1 - The Explosion
Tutorials in this series:
- Particle Explosion Part 1 - The Explosion: Create a fiery explosion particle for multiple purposes, including an FX sequence.
- Particle Explosion Part 2 - Hot Balls of Fire: Create a ball of fire that will be emitted with it's own smoke trail for use in a FX.
- Particle Explosion Part 3 - Adding Debris: Create some debris that will be emitted to accent the explosion.
- Particle Explosion Part 4 (Hooking up the FX) (Located in the FX tutorials)
In this tutorial we are going to tackle creating a fiery explosion particle that we can later on use for multiple purposes, including adding this to an fx sequence.
Step 1 - Create or Select a Texture
You can use our default textures, or make your own. By making it a 512 x 512 texture and dividing it up into 4 quadrants we can get some variance out of it. We will do this by emitting a different quadrant every time a particle is born. Once you have created your texture, upload the texture using the repository browser. There is a default location for particles in the clean engine folder. However you may place particle textures wherever you like.
It's important to note that particles are associated with the area they are created in. This is so that you can make a particle chain, and then use it all over the world, but still be able to only edit the "source" particle and have those changes be reflected in all of its children. For this reason, we suggest making a Particle Area, and constructing all particles while logged into the area.
Step 2 - Create a Particle Spec
Now we will create a local particle spec with HeroEngine. From the create menu, go Create/Particle/New Particle Spec/local. This will bring up the particle spec dialog. Make sure to check the following options.
- Create emitter is checked
- Name the particle Explosion_Tutorial_01
- Note that the particle name field automatically sets it self with an "_p" as a suffix.
- Emitter type should be set to "Basic Emitter"
- Create particle is checked
- Particle type should be set to "Billboard Point"
- Make sure to add a texture to the texture path, for this example Explosion fire 4x.dds is ideal and can be found in:
Also, a large number of textures designed for particle effects can be found here: /world/livecontent/globalparticles/textures/
Step 3 - Add the Particle Spec to the Area
Now that we have a particle specification, we can add an instance of the particle spec to our area. You can do this 1 of 2 ways. Through the create menu, or through the assets panel. You should see something like in fig 1
Step 4 - Tweak Properties
Now we want to make this look explosive instead of the default rainy behavior. When you select a particle emitter in the world or select an instance of it through the asset panel, your property panel will show a tabbed set of property sheets referring to different parts of the particle node(fig 2).
- The emitter tabe is the node itself and contains things such as transforms and room assignments.
- The next few tabs will be an assortment of emitter and particle specs depending on how complex your particle gets. Typically you have 2 spec tabs, 1 for the emitter and 1 for the particle.
In this example we will almost be exclusively using the particle spec tab, in this case, the tab marked as explosion_tutorial_01_p.prt
1 - The first thing we want to do is neutralize the buoyancy
- Under the motion section of the property sheet, change buoyancy to 1.
2 - Now we want it to randomize between all 4 quadrants of the texture
- Under the texture section of the property sheet, choose the option box to bring up the dialog or change texture number to 15.
3 - Give them some trajectory
- Under the motion section of the property sheet, choose the trajectory option box.
- set each vector as a Gaussian random value and set your min to -.25 and your max to .25 on each axis.
- This should result in an outward motion of each particle in a random direction.
4 - Give the particle a color timeline to allow them to fade in and out on their respective birth and death.
- Under the Color section of the property sheet, choose the option box dialog for DiffuseColor, once open, change it from RGB to Timeline
- Set the first and last color to be transparent, alpha of 0. this keeps the particles from popping in and out of existence.
- NOTE make sure to check the option for link to particle spec. This allows the color timeline to be active to exactly the life of each particle.
- NOTE: The newest version of the particle system allows designer driven lifetime values in every step of the process. So the "Link to particle spec" option is now a lifetime value. In most situations you'll want the lifetime of settings like color timelines to be the same as the life of the particle, but there are situations where this fine grained control can come in handy.
5 - Give the particle scale over time. This allows our particle to get small as it dies. First thing to note is that the Size2D property by default is a very small value .1, which makes it hard to work with. A way to work around that is to change the xScale2D and yScale2D to smaller values, .5 in this example, so that when we work with the Size2D property and the graph editor we'll have something easier to work with.
- Under the Scale section of the property sheet, change the following
- Set XScale2D to .5
- Set YScale2D to .5
- Set Size2D to a value timeline by choosing the option box and picking Timeline from the drop down menu.
- set the curve type to match whats in fig 3. This sets the particle to get big in a quick burst then level out more slowly as it approaches it's final scale at death.
6 - Give the particle some random rotation. This helps it feel a little less synthetic.
- Under the Visuals section of the property sheet set DeltaRotation2D to a Gaussian random value by choosing the option box and selecting Gaussian form the drop down menu.
- Set the fields to: min = -2.0, max =2.0, median as 0, and a variation of about 1.25.
7 - Now we just want to make a few final adjustments to the color. First thing to do is change the blending modes. These are a little trial by fire, SO alittle experimentation between the modes and how they react with different colors is worth your time. For this example we already know what we want.
- Under the color section change the Source blend mode to BOTHSRCALPHA and set DestBlend as ZERO
- Then we will make some color adjustments to the color timeline that we made before under DiffuseColor, and make the timeline look like the image on the right, to give the texture the feeling of burning out from yellow to darker brown.
8 - Now we will switch to the emitter tab, in this example this is the emitter spec, explosion_tutorial_01.prt. We want the particle to emit more particles and we also want it to emit in a volume not from a single point.
- Under the Emission tab, change EmitFrequency to .01. Keep in mind the smaller this number is, the more particles it will emit which ultimately will have an impact on your game. we can justify having this particle emit alot of particles thoguh because it will only be on for 1-2 seconds during an explosion. Ultimately it will not be constant in it's final usage like it is here during set up.
- Under the same section, choose the option box for EmitterRadius. Enter .2 for the value on each axis and close the dialog. This is the size of the volume on each axis that particle will be born within.
Final gallery of images displaying the progression of the particle building process