A particle emitter is the base of all Particles emission. It defines a point or a shape where Particles will be spawned. Particle emitters are attached to a ParticleNetwork which may contain multiple ParticleEmitter that are placed and configure in a way to achieve a specific type of effect.

A Particle emitters are using a combination of ParticleModifier which will dictate the behaviors of each Particles emitted. Particle modifiers act as a node that handles a specific function or behavior to apply to each particle. By adding and combining multiple ParticleModifier you will be able to quickly and easily creates very complex effects.

See Also

Static Variables

Name Description
particlenetwork Parent ParticleNetwork reference where that active ParticleEmitter is attached.
handler Handle scripting functionalities and callback for the active ParticleEmitter.
emission Access the EmissionData properties for the active EmissionType of the ParticleEmitter.
min Min. coordinate of world space AABB of the ParticleEmitter.
max Max. coordinate of world space AABB of the ParticleEmitter.
particlemodifier_count Total amounf of ParticleModifier attached to the active ParticleEmitter.
uid Unique id to internally idendity the ParticleEmitter.
particles Reference to the Particles managed by the active ParticleEmitter.


Name Description
fps Controls the refresh rate of the ParticleEmitter.
name Unique name to identify the ParticleEmitter within its parent ParticleNetwork.
local_matrix Local transformation matrix relative to the pivot of the parent ParticleNetwork.
state Th active State of the current ParticleEmitter.
flags Bit mask that determine the active option(s) the ParticleEmitter is using.
height Toggle on/off the visible of the ParticleEmitter Particles.
localize Localize the ParticleEmitter Particles.
volumetric Specify wether or not the ParticleEmitter should emmit Particles in a volumetric way or along the edges of the emission shape.
sync_time Last time the ParticleEmitter was re-evaluated.


Name Description
SetEmissionType Specify the EmissionType of the active ParticleEmitter.
SetEmissionWarmstart Warmstart the ParticleEmitter.
SetEmissionGeometry Assign the Geometry to use for emission.
SetEmissionSource Controls the linear motor settings.
SetEmissionGoal Set the emission goal for a kWire EmissionType ParticleEmitter.
SetEmissionTrack Specify the Track to use for a specific axis of a kWire ParticleEmitter.
SetParticleType Set the ParticleType to use for the active ParticleEmitter.
SetEmissionEntity Specify the Entity that the ParticleEmitter will emit.
AddParticleModifier Create a new ParticleModifier.
GetParticleModifier Retrive an existing ParticleModifier by name.
GetParticleModifierAt Retrive an existing ParticleModifier using its internal index.
GetParticleModifierIndex Get the internal index of an existing ParticleModifier connected to the active ParticleEmitter.
SetParticleModifierIndex Modify the internal location of a specific ParticleModifier.
RemoveParticleModifier Remove an existing ParticleModifier.
RemoveParticleModifierAt Remove an existing ParticleModifier by index.
SwapParticleModifiers Exchange the location of two ParticleModifier.
Play Tell the ParticleEmitter to start emitting Particles.
Pause Pause the Particles emission.
Stop Stop emitting Particles.
GetDuration Retrieve the duration time of the active ParticleEmitter (for how long particles are emitted).
Sort Sort all existing ParticleModifier based on their location in the emission sequence.


Identifiers that specify the type of emission a ParticleEmitter will be producing.

  • kCentral: Particles are emitted from a single point in space.
  • kCylindrical: Creates Particles that are contained within the boundary of a cylinder.
  • kConical: Emits ref Particles within a cone.
  • kSectorial: Particles are emitted within a sector shape (a non-closed cylinder).
  • kCubical: Creates Particles within a cube boundary.
  • kSpherical: Creates Particles around the radius of a sphere; or optionally a hemisphere.
  • kShape: Use the vertex information of a specific geometry to generate particles (non-volumetric).
  • kWire: Create particles along a tri-dimensional path in space.
  • kSource: Use another existing ParticleEmitter Particles information to generate particles.
  • kMotion: Use an existing Object (or an optional Bone) location to generate particles.


EmissionData variables available when the EmissionType is set to kCylindrical.


Name Description
radius Base radius of the cylinder.
height Controls the height of the cylinder.
centered Controls whether the pivot point of the cylinder is located at the center of the shape or at the base.
step The step value to use to generate Particles around the cylindex.


EmissionData variables available when the EmissionType is set to kConical.


Name Description
radius Base radius of the cone.
height Controls the height of the cone.


EmissionData variables available when the EmissionType is set to kSectorial.


Name Description
angle The maximum angle of the sector.
distance The radius of the sector.
height The spanning area of the sector.


EmissionData variables available when the EmissionType is set to kCubical.


Name Description
size Size of the cube for each axis.


EmissionData variables available when the EmissionType is set to kSpherical.


Name Description
hemi Use half a sphere instead of a full sphere to generate Particles.
radius The radius of the sphere.


EmissionData variables available when the EmissionType is set to kShape.

Static Variables

Name Description
geometry Reference to the Geometry to use for emission.


Name Description
restore Force the system to restore the Geometry vertices before emitting Particles.


EmissionData variables available when the EmissionType is set to kWire.

Static Variables

Name Description
curve_x Reference to the Curve used on the X axis.
curve_y Reference to the Curve used on the Y axis.
curve_z Reference to the Curve used on the Z axis.


Name Description
resolution Amount of samples to generate along the wire.
relative If enabled the system will use the resolution value to compute the playback time of the curves.
cycle_mode_x Specify the CycleMode to use for the X axis Curve.
cycle_mode_y Specify the CycleMode to use for the Y ayis Curve.
cycle_mode_z Specify the CycleMode to use for the Z azis Curve.
color_x Color to identify the X axis Curve inside the Molecules Editor.
color_y Color to identify the Y ayis Curve inside the Molecules Editor.
color_z Color to identify the Z azis Curve inside the Molecules Editor.


EmissionData variables available when the EmissionType is set to kSource.

Static Variables

Name Description
particleemitter Unique id of the ParticleEmitter to use as source.


EmissionData variables available when the EmissionType is set to kMotion.


Name Description
target Unique id of the Object to use for motion Particles emission.
target_bone Set the index of the Bone to use for motion emission.


A structure that contains the variables and properties available for each specific EmissionType. Take note that each specific reference to an emission structure will only be accessible if there's a type match. For example, if the type is set to kSource the cylinder properties of the EmissionData will return nil.

Static Variables

Name Description
type The active EmissionType used by the ParticleEmitter.
warmstart Active warmstart value.
randomize Determine if the warmstart should be randomized.
cylinder Reference to the properties of a CylindricalEmission.
cone Access the properties of a ConicalEmission.
sector Reference to the properties of a SectorialEmission.
cube Access the properties of a CubicalEmission.
sphere Reference to the properties of a SphericalEmission.
shape Access the properties of a ShapeEmission.
wire Reference to the properties of a WireEmission.
source Access the properties of a SourceEmission.
motion Reference to the properties of a MotionEmission.


Callbacks Description
OnPlay Called when the ParticleEmitter start playing and emitting Particles.
OnPause Triggered when the ParticleEmitter gets paused and stop generating particles.
OnResume Event triggered when the ParticleEmitter was paused and the play function is called resuming the emission.
OnStop The emitter is stop function have been triggered all particles are removed.
OnCreate Triggered when one or more Particles have been created.
OnDestroy One or more particles have been destroyed or have finished their life cycle.
OnContact Event trigger upon physics collision if one or more particles are in contact with their physics World.
OnUpdate Trigger when the ParticleEmitter gets updated.

Material Script & Shader

To help you get started right away with Particles rendering; the Shader and Material Script below is the base that allows you to draw Particles.

Material Script

  • Lua
function OnDraw()
    Gfx:Enable(Graphics.EnableCap.kBlend);              -- Enable Alpha Blending.
    Gfx:BlendEquation(Graphics.BlendFunction.kAdd );    -- Toggle Additive Blending.
    Gfx:BlendFunc(Graphics.BlendingFactorSrc.kSrcAlpha, -- Combine the alpha value.
    Gfx:Disable(Graphics.EnableCap.kDepthMask);         -- Do not write to the depth buffer.
    Gfx:DepthFunc(Graphics.StencilFunction.kLequal);    -- Less or equal
    Gfx:Disable(Graphics.EnableCap.kCullFace);          -- Draw double-sided (sprite only).
function OnDisplay() Gfx:Disable(Graphics.EnableCap.kBlend); -- Disable blending. Gfx:Enable(Graphics.EnableCap.kDepthMask); -- Enable depth write. Gfx:Enable(Graphics.EnableCap.kCullFace); -- Enable cull face. end

Vertex Shader

  • GLSL
//#define POINT_SPRITE // Uncomment if you are using kPointSprite
attribute vec2 TEXCOORD0;
attribute vec3 POSITION;
attribute vec4 COLOR0;
attribute float POINTSIZE;
uniform mat4 gfx_ModelViewProjectionMatrix; uniform mat4 gfx_ModelViewMatrix; uniform mat4 gfx_ProjectionMatrix; uniform vec4 gfx_Viewport;
varying vec2 texcoord0; varying vec4 color0;
void main(void) { texcoord0 = TEXCOORD0; color0 = COLOR0; #ifdef POINT_SPRITE // kPointSprite vec4 eyePos = gfx_ModelviewMatrix * vec4( POSITION, 1.0 ); vec4 projCorner = gfx_ProjectionMatrix * vec4( POINTSIZE * 0.5, POINTSIZE * 0.5, eyePos.z, eyePos.w ); gl_PointSize = gfx_Viewport.z * projCorner.x / projCorner.w; gl_Position = gfx_ProjectionMatrix * vec4( eyePos ); #else // kSprite, kTrail gl_Position = gfx_ModelViewProjectionMatrix * vec4( POSITION, 1.0 ); #endif }

Fragment Shader

  • GLSL
//#define POINT_SPRITE // Uncomment if you are using kPointSprite
uniform sampler2D SAMPLER0;
varying mediump vec2 texcoord0; varying lowp vec4 color0;
void main(void) { #ifdef POINT_SPRITE // kPointSprite gl_FragColor = texture2D( SAMPLER0, gl_PointCoord ) * color0; #else // kSprite, kTrail gl_FragColor = texture2D( SAMPLER0, texcoord0 ) * color0; #endif }

NRG - API 2022.3.383570 - Thu Jul 28 2022
Copyright © 2022 All Rights Reserved. Terms of Service - Privacy Policy - EULA