Particle Systems
A particle system is a really versatile technique that allows creating complex moving structures that produce dynamic and "fuzzy" effects. These structures are used for simulation of abstract effects of fire, smoke, explosions, electricity, fountains, rocket trails, flocking, magic, and many many more. All these effects are hard to reproduce using traditional rigid objects: particles are represented not by a set of primitive surface elements, but by point masses forming the volume of particle primitives. Another distinctive feature is that particles are not static — they may change not only their position, but also the form with the time.
A particle system consists of three main entities:
- Emitter — the source that emits particles according to the values set in the Emitter parameters.
- Particles themselves, which are emitted according to the predefined behavior after emission.
- Additional physical effects applied to the particles that affect their behavior.
See also#
- The particles_base material to adjust the particles appearance
- The ObjectParticles class to manage particles via API
- A set of samples located in the Art Samples suite.
Creating Particles#
To create particles, perform the following steps:
- On the Menu bar, click Create -> Particle System -> Particles.
- Place the Particles object somewhere in the world.
- Specify the particles parameters.
Emitter Parameters#
The particles emitter's behaviour is set via the Emitter parameters.
Clear On Enable | Enables re-initialization of the particle system each time it is enabled. When this option is disabled, turning on the particle system restores the state it had before it was turned off. |
---|---|
Emitter Enabled | Enables the emitter. |
Emitter Sync | Enables synchronization of the child particle system with the parent one, even if the child particle system has the Emitter Enabled option disabled. |
Emitter Shape |
The shape of the volume within which the particles are generated: |
Emitter Size | The size of the particles source. The number of fields (whether it is radius or boundary dimensions) depend on the chosen shape. |
Particles Type |
|
Sequence Order |
The order of rendering for particle systems, especially when creating a complex effects like shots (with muzzle flash, smoke and the shot itself, each rendered with different particle systems). This parameter is very much the same as Rendering Order option in the Materials Settings. But it allows setting a rendering sequence inside of the particle system hierarchy, to avoid such situations when the smoke from a distant shot is rendered atop of the fire of the foreground shot.
|
Emitter Shift | Enabling this checkbox makes the emitter generate particles only when the Particle System is moving. |
Emitter Continuous | Enables continuous particles that follow the shift of the emitter. |
Texture Atlas | Enabling this feature makes the following: a random image from the albedo texture is picked up for every particle. For using this option, Animation of the texture should be disabled. |
Texture Atlas Size | The size of the texture atlas. |
Random Flip X | Flipping of random emitted particles horizontally (along the X axis).
|
Random Flip Y | Flipping of random emitted particles vertically (along the Y axis).
|
Warming On Start | Toggles on and off the particle system initialization with the illusion of prior activity. The particle system evolves with time, so after encountering it in the virtual world, the system only starts to be generated, particle by particle, until the whole system gains the intended look. When the character comes out on a glade, we will see a fire gradually burn up. Warm start for the particles enables rendering the full-grown particle system straight away. The technical implementation of warm start is the following: when the particle system is initialized on the encounter, its life is computed starting from the generation of the first particle to its disappearance. After that, the particle system is considered evolved and is rendered in this state. The calculations are taken at a fixed frame rate of 25 fps, which is the minimum required for the correct simulation of particle systems (see also information about correlation between framerates). Warm start can be enabled without any detrimental effect for any particles systems, except for huge ones. |
Max Warming Time (Sec) | Maximum time of the particle system warmup. |
Spawn Rate | Number of spawn actions per second. The value defines how many times a certain number of particles will be spawned in one second. For example, the value set to 5 equals to 5 spawn actions per second. 0 results in no particles at all. |
Number Per Spawn | Number of particles to be spawned simultaneously each time according to the Spawn Rate. |
Spawn Threshold |
Threshold of the number of particles depending on the velocity of the parent particles. Threshold for random emitter functions only with a particle system as a parent node.
|
Limit Per Spawn | The total maximum number of particles emitted per spawn. This parameter specifies the number of particles that can simultaneously exist in the world. In other words, the number of particles existing in the world cannot exceed the limit value. For example, if the Number per Spawn value is 10, and the Limit Per Spawn value is 5, 5 particles will be emitted. And no particles will be spawned until the previous ones exist. |
Life Time (Sec) | Duration of the particles existence after emission in seconds. This parameter also has the Spread value that creates the variety of the Life Time value, in seconds. |
Delay | This option defines the time to pass between the parent system initialization and initialization of the child node. If any delay is set, the parent system starts emitting particles, and after the delay, the generation of child particles is activated. If a particle system doesn't have children, the delay defines the time after which the particles are emitted. This parameter also has the Spread value that creates the variety of delay of particle initialization, in seconds. |
Period | Duration of a pause between generation cycles, in seconds.
This parameter also has the Spread value that creates the variety of the Period value, in seconds. |
Duration |
Duration of generation cycle, within which emission occurs, in seconds.
This parameter also has the Spread value that creates the variety of the Duration value, in seconds. |
Spread (+/-) | Spread option introduces additional modulation of the corresponding parameter. It represents the range of values that can be randomly added to or subtracted from the specified parameter value. |
Behavior After Emission#
This set of parameters defines how the particles behave after they are emitted:
Value Setting Options#
Most parameters in this section have multiple options for setting a value:
- Const — the value is precise and unchanged over time.
- Between Const — an interval is set, from which a random value is selected for each instance.
-
Curve — the parameter value changes over time based on the curve defined in Curve Editor.
In case of small values (close to 0), the curves may lose accuracy if the Max Value value significantly exceeds the actual maximum value of the curve. To avoid this, Max Value should be set as close to the actual maximum as possible. - Between Curve — there are two curves set in Curve Editor that define the limits, and a random value is taken at every moment of time within these limits. The parameter value changes over time based on this randomly generated set of values.
To select a desired value type, use the gear button.
Depth Sort | Depth sorting is required, if particles use alpha blending (except for the additive one). If not enabled, then based on the depth buffer data, opaque objects positioned farther can be wrongly rendered in front of transparent particles. With depth sorting, geometry is rendered in the order from back to front, which rules out visual artifacts. | ||||
---|---|---|---|---|---|
Emitter Based | Enabling this option makes particles move along with the emitter. | ||||
Position | Particle position coordinates relative to the emitter along X, Y and Z axes. | ||||
Gravity |
Gravity force affecting particles along the X, Y and Z axes.
The rotation of particle system node does not affect the gravity vector. |
||||
Direction | Direction in which all emitted particles move forming a flow, specified along the X, Y and Z axes. | ||||
Velocity | The speed of particles movement in the set direction, in units per second. To grant the natural-looking flow, the final velocity of each separate particle can differ, if the range of values is set. | ||||
Linear Damping | The decrease in particles linear velocity over time. This parameter is used to simulate effect of friction of the medium for particles. | ||||
Angle | Angle of particles orientation in space, in degrees. |
||||
Rotation Speed | Angular velocity of particles, in degrees per second.
|
||||
Radius | Radius (half-size) of the particle. | ||||
Increase In Radius | Increment of the size of a particle, in units per second.
|
||||
Screen Size Mode |
Screen size mode to be used for particles. This mode defines whether the maximum and minimum sizes of emitted particles should be limited relative to screen size or not (e.g., to avoid cases when snowflakes or raindrops obscure the view if they are too close to the camera or when they become invisible as the distance to the camera increases). Three modes are available:
|
||||
Screen Min Size |
Minimum screen size to be set for particles limiting the minimum fraction of the screen a single particle can occupy:
|
||||
Screen Max Size |
Maximum screen size to be set for particles limiting the maximum fraction of the screen a single particle can occupy:
|
||||
Length Stretch | Stretching of a particle billboard, available for the Length Particles. With the value of 0, the length particle is simply a square billboard. Increasing the value stretches particles in the direction of their movement. The result is calculated by multiplying the stretch value by the particle velocity value. So, the higher the velocity is, the more stretched the particles are in the direction of their movement, while the other side remains of the same width.
|
||||
Length Flattening | Makes the Length Particles not camera-oriented as usual billboard particles, but more perpendicular to the Z axis. With the value of 0, the particles are not flattened. With the maximum value of 1, the particles will be flat (perpendicular to the Z axis) when they are emitted.
|
Interaction#
Interaction of the particles is limited to the application of forces and collisions with external objects. There are two methods to detect the collision with external objects: by using the Physics Intersection parameter or the Collision parameter.
Physical Mask | For a more selective interaction of the particles systems with physical nodes, the physical bit mask is used. This bit mask is set for both the particles system and the force. These masks should have at least one bit matching, otherwise there would be no interaction. The other bits of the mask can match masks of other forces, thus providing perfect control over the scene integration. |
---|---|
Particles Field Mask | Bit mask for interaction with Particles Field nodes (Deflectors and Spacers). Emitted particles will be affected by a Particles Field only if their masks match (one bit at least). |
Physical Mass |
To participate in the scene dynamics, particles should have a certain mass in kilograms. This value defines the intensity of the impact of the physical node on the particles flow. The Physical Mass parameter doesn't affect other calculations.
|
Restitution |
Strength of particles bouncing off an obstacle. This option is very convenient for simulation of some water effects that include splashes. The strength the bouncing effect depends on both the restitution parameter of particles and the value of the restitution surface parameter set for the colliding object (Properties -> Parameters -> Restitution), or the restitution value of a Particles Deflector.
|
Roughness |
Roughness of the surface of an obstacle the particle collides with. It determines whether the particles scatter in different directions or react as a uniformly directed flow.
|
Collision |
Enables collision detection with the whole shape of a particle. Collisions are detected for matching collision bit masks. |
Physics Intersection |
Enables detection of physics intersections with particles. Physics intersections can be used, for example, to detect collisions of spawned particles with physical shapes and bodies or static collider surfaces to ensure proper interaction, or as a quick way to detect collisions for raycast-wheels of a simulated ground vehicle, or to check if a destructible object or a player was hit by a projectile. Physics intersections are detected for matching Physics Intersection bit masks. |
Destroy In Collision/Intersection | Toggles on and off culling of particles that have already undergone either collision or intersection. |
Render To Texture#
Particles can be rendered into a procedural texture to be used by an Orthographic Decal or a Field Height. This feature can be used, for example, to create ship wake effects or oil splashes.
The following settings are available:
Rendering | Enables rendering of particles to a procedural texture. |
---|---|
Positioning |
Defines positioning mode to be used for child nodes (decal or field) using the procedural texture, to which the particle system is rendered. The following values are available:
Takes effect only when Procedural Parenting is set to Children. |
Parenting |
Defines relationship between the particle system and a Decal / Field node, that uses the procedural texture into which the particle system is rendered:
|
Resolution |
Specifies resolution of the procedural texture into which particles are rendered.
|
Additional Physical Effects#
More intricate changes in further movement of the particles may be performed by applying the additional physical effects. They have influence on the particles flow in the desired direction or on the contrary deflect it. The effects can be of three general types:
There is no limitation to the number of additional physical effects applied to one particle system and they can freely overlap, enabling to constitute complex trajectories easily and fast.
Forces#
You can apply a physical force to particles inside a sphere-shaped volume in order to affect their movement and behavior. For that, simply add a Physical Force node, adjust necessary settings and set up Physical Masks to selectively enable interaction.
Noises#
You can apply physical noise adding a distribution flow based on a volumetric noise texture inside a cuboid-shaped volume. For that, simply add a Physical Noise node, adjust necessary settings and set up Physical Masks to selectively enable interaction.
Deflectors#
Sometimes it is necessary to put an obstacle for particles to make them change their trajectory by bouncing off or sliding along a certain surface. For this purpose you can use a Particles Deflector node, a surface field that has no visual representation, but physically interacts with Particle Systems leaving other objects unaffected. You can control interaction between the particles and deflectors via the Particles Field mask: a deflector will interact with particles generated by a Particle System if they both have matching Particles Field masks (one bit at least).
For more information on Particles Deflector please refer to this article.
Particles Node Hierarchy#
To create complex effects, it is necessary that all particles systems are synchronized in time. Setting a particle system as a parent node results in the following:
- All particles systems that are child nodes are synchronized relative to their parent particle systems. If the children have children of their own, they still are synchronized with the main parent system, which is the highest in the hierarchy.
- When creating a new child particle system, it should be synchronized with the parent one by disabling and again enabling the parent emitter (Node tab -> Enabled box). At this moment, each of the child systems is initialized with its Emitter parameters (such as generation duration, period of generation pause, and delay of initialization).
- Disabling or enabling the parent emitter (Node tab -> Enabled box) affects all child particle systems: they synchronously stop or start emitting particles (emitted particles still live out their time).
- Disabling or enabling the parent node (Node tab -> Enabled box) also affects all children: all particle systems in the hierarchy are turned off and on — and preserve the same state as was at the moment of their disabling.
Synchronizing Several Particle Systems#
To synchronize several particle systems, for example, to create a shot effect (with three particle systems: muzzle flash, smoke and the bullet), you can do the following:
-
Create the parent particle system that will be used as a dummy one, purely for synchronization purposes (you can even disable its surface). Its Duration time interval should cover all duration intervals and delay intervals (if any) of the children particle systems. Other parameters (Spawn Rate, etc.) do not matter.
-
Add the child particle systems. They can have any Duration time required (but it should be smaller than the one of the parent). For example, to synchronize all child particle systems at once and spawn only one particle, you can set the following:
- Duration = 0
- Limit Per Spawn = 1
- Spawn Rate = inf/100000
Optimizing Simulation#
Updating each frame a huge number of objects located far away from the camera that are hardly distinguishable or observed as a mass is a waste of resources.
To improve performance and avoid the excessive load, particle systems simulation can be updated with a reduced framerate. When a particle system is out of the area specified by the Update Distance Limit, particles stop to be updated and freeze statically.
The set of frame rates given below enables you to specify how often the particles simulation should be updated when the particle system is visible, when only its shadow is visible, and when it is not visible at all.
This feature is enabled with default settings ensuring optimum performance and can be adjusted per-object in the UnigineEditor or via API at run time.
If your project, for example, contains an invisible particle system (e.g., using the Viewport mask) and some logic attached to its update (e.g. spawning some visible particles on collision with objects) this logic won't work, as the particle system might be updated with a reduced rate or might not be updated at all. To enable updating such objects regardless of their visibility you can set the Update Distance Limit and corresponding update rate values for it to infinity.
Mesh-Based Particles#
It is possible to create mesh-based particle systems. For that, Mesh Cluster should be added as a child node of the particle system (ObjectParticles). After that, meshes are automatically spawned by the emitter.