In this article you'll find information on advanced techniques you can use with the Particle Editor to achieve better results.
Attaching Particles to Geometry
Here is a description of the various ways you can attach particle emitters to other geometry, with particular emphasis on breakable geometry.
To attach particle effect to the other entity, use Link Object tool on editor and link particle effect entity to the source object entity at first. Then set AttachType and AttachForm in the particle effect entity parameter appropriately, not on particle editor. There are also AttachType and AttachForm in particle editor's parameter, but they only affect on the Second Particle from other geometry particle.
Second Generation Effects
You can attach emitters to the parent particles, as part of the parent particle effect. If the parent effect has geometry, then the Second Generation effect can optionally emit particles from that geometry, based on its parameters. In this case, AttachType and AttachForm parameter are controlled from the Particle Editor.
There are several ways to create breakable geometry in the engine. All are based on a CGF authored with multiple parts. All optionally allow secondary particle effects to be spawned on the broken pieces.
- Pure particle effect: You can create a particle effect that instantly creates an "exploding" object. To do this:
- Set the effect's Geometry to a multi-part CGF.
- Set Geometry in Pieces = true, and Count = 1 (for 1 exploding object).
- Set appropriate values for Speed, Focus, Rotation Rate, etc., to create a nice exploding effect.
- Optionally set Rigid Body for physicalized pieces.
- Optionally create Second-Generation child effects, with appropriate parameters, to create secondary particle effects on the pieces. These effects will spawn at the location of each piece, and if set Continuous, will stay attached to the piece during its lifetime (useful for fire, etc).
- DestroyableObjects: This is a special entity that can be "exploded" via an event. All its pieces break off at once. Particle emitters will be optionally attached to each piece based on its *Surface Properties(see below).
- Physically breakable object: This is a Basic Entity, set to use a multi-part CGF, with physics parameters specifying how pieces break off. The physics engine will break pieces of this geometry off individually based on external forces. Particle emitters will be optionally attached to each piece based on its *Surface Properties(see below).
Generating Particles from Surface Properties (Material Effect)
Surface properties specify events that occur when something happens to an object with a particular physical material (surface) type. Surface types are identified by names (such as "wood" or "metal").
They can be specified on a render Material, and also on individual pieces or surfaces of a CGF. The properties for each surface type are specified in LUA scripts, stored in the directory.
Many of these properties specify particle effects which are spawned based on events such as "bullet" hit or "walk". The effect spawned when a geometry piece breaks off of an entity is specified on the section of the script. This section has the following parameters:
Particle effect name. This effect can, of course, have multiple child effects.
Additional scale to multiply particle size quantities.
Additional scale to multiply particle counts.
True if particle count should be scaled by the extent of the attached geometry (length for edges, area for surface, etc).
The total number of particles in a scene is actually not very critical. Much more important are total fill-rate, physics, and (to some extent) spawn rate. So, in a framerate-challenged scene, try to avoid these things:
Large Overdraw: For example, using several large particles (Count > 1 or 2, Size > 1m), additively blended to achieve dense, chaotic glows, refractions, etc. Instead of multiple overlaid sprites to provide chaotic variation and overall density, try the following techniques:
- Use an Alpha texture with high average opacity instead of Additive.
- Use just 2 particles at a time, and carefully tune the lifetime, rotation rate, and set curves for Alpha, Color, Size, so that they combine in chaotic ways.
Large full screen particles should have the Fill Rate Cost set at 1 or above, as far as possible.
Soft Particles: Soft Particles and expensive shaders, such as refractive materials. These are quite expensive when used with several large particles. Use Soft Particles only on sub-emitters that are near the ground, and have only small particles. Create similar sub-emitters higher up, that emit particles that never intersect the ground, and don't need soft particles. For fire, use a horizontal glow texture. Combine that with some glow billboard sprites emitted higher up that don't intersect the ground. None of them need Soft Particles. Small particles don't need soft particle.
High-resolution textures: Use lower-res textures (if sharp details are not required), and texture compression.
High-count second-generation: Each 2nd-gen effect causes an emitter to be created for each particle in the parent effect. This can be quite nice, but somewhat expensive, so use sparingly.
Physics Parameters: Simple physics and rigid bodies are very expensive, even simple collision costs a lot of performance. In the event of wanting many colliding objects its best to clone the emitter with the colliding particles and make one only spawn about 20% of the other, and enable collisions only on this emitter. As long as some particles are colliding it will look like everything is colliding. If simple terrain collision is enough, set Bounciness > 0, and don't use rigid body. Consider splitting an effect into sub-effects, so that only a few particles (perhaps large ones) have Real Physics for appearance, and the rest just go through the ground or fade out quickly.
Geometry Particle: Drawcalls are added from using geometries as particles, one drawcall per mesh spawned. Where possible just use non camera aligned sprites using full rotations to resemble meshes at least in their rotation.
Small Particles: Small particles like sparks can have a max distance applied to them to make sure they aren't rendered even as very small, single pixel particles. Especially those with collisions, should be turned off for the lowest spec.
Turn off Diffuse Lighting: Diffuse lighting should not be used unless it is needed, for self lighting effects like sparks and explosions where they would create their own light the diffuse lighting slider should always be set to low.
Keep Short Duration: Keeping effects short in their lifetime obviously helps performance but it also makes the effect more powerful, coupled with a good sound. For explosions the shorter the fire stage of the explosion is the more believable it is. You don't have a chance to see the obvious textures used to create the structure of the effect. This applies to most effects in the game.
Making Muzzle Flash Effect
To use an effect as a muzzle flash, there is a rule to correctly attach effect to the helper of the weapon.
- Set Enabled as True: Top node of the effect should be set true on Enabled.
- Set Count as 0: Top node of the effect should be set 0 on Count.
- Bind To Emitter: Top node of the effect should be set true to Bind To Emitter.
Kill Particle When They Collide
There is a special value for the Bounciness Physics
- Use Simple Collision: Set Physics Type as Simple Collision.
- Set Bounciness: Set Bounciness to -1. This is a special value to kill particle when they collide.
Use Force Generation
You can add some physical force by using Force Generation parameter in Physics tab. These are some examples of Force Generation.
Hierarchical Attracted Effect: As written in Basics/Child Effects above, you can make hierarchical effect. When you use Target to Force Generation parameter, you can make hierarchical attracted effect which has a specific, impressive movement.
- Set Top Node: Make an item to use as top node of the hierarchical attracted effect, and set its Force Generation to Target . Set texture or some of appearance parameters, use small Count Value and turn on Continuous . Then set simple radial emissive movement to them, like Emit Angle 180, Var Random 1, and Speed 10.
- Make Second Effect: Copy top node, add a sub effect and then paste it. Turn on Second Generation.
- Make Third Effect: Copy second generation particle, add a sub effect to it, paste and make third generation particle.
You can see every sub particles are attracted to the parent effect's particle position through their life time. By repeating this procedure and do some tweak, you can make impressive effect which has very complex movement. Only Target force has a special rule that it's affect only on sub effects of its self.
Wind Force Effect: By adding wind force to the effect, you can blow the particles and vegetations around the spawning point of it. It's a powerful function to make explosive effects like hand grenade.
- Open Vehicle_fx library, then drag and drop Damages_Land.USTank_engine_smoke_a to the scene.
- Open explosions library, then drag and drop Grenade_SCAR.soil to the next of smoke, somewhere around in 5 meter distance.
- Select grenade effect entity and press Reload Script. Grenade effect spawns, and smoke effect will blown by it.
- Look inside of the grenade effect, and see an item which name is wind. This item has no Count, but has radial emission setting and high Speed value, and Force Generation is set to Wind.
The appearance of the particle itself doesn't has any effect on force generation. You can add Count Value and tweak appearance if you want. Intensity of the wind force is controlled by the Speed value of the wind force effect, and affected effects must have value on Air Resistance.
Gravity Force Effect: You can also add gravity force to the effect. Intensity of the gravity force is controlled by the Gravity Scale value of the gravity force effect, and affected effects must have value on Gravity Scale.