Class GPUParticleSystem
Hierarchy (View Summary)
- BaseParticleSystem
- GPUParticleSystem
Implements
Index
Constructors
Properties
Accessors
Methods
Constructors
constructor
-
new GPUParticleSystem(
name: string,
options: Partial<
{
capacity: number;
emitRateControl: boolean;
maxAttractors: number;
randomTextureSize: number;
},
>,
sceneOrEngine: Scene | AbstractEngine,
customEffect?: Nullable<Effect>,
isAnimationSheetEnabled?: boolean,
): GPUParticleSystemInstantiates a GPU particle system. Particles are often small sprites used to simulate hard-to-reproduce phenomena like fire, smoke, water, or abstract visual effects like magic glitter and faery dust.
Parameters
- name: string
The name of the particle system
- options: Partial<
{
capacity: number;
emitRateControl: boolean;
maxAttractors: number;
randomTextureSize: number;
},
>The options used to create the system
- sceneOrEngine: Scene | AbstractEngine
The scene the particle system belongs to or the engine to use if no scene
- customEffect: Nullable<Effect> = null
a custom effect used to change the way particles are rendered by default
- isAnimationSheetEnabled: boolean = false
Must be true if using a spritesheet to animate the particles texture
Returns GPUParticleSystem
- name: string
Properties
animations
List of animations used by the particle system.
apply Fog
Gets or sets a boolean indicating that this particle system will allow fog to be rendered on it (false by default)
begin Animation From
Gets or sets the frame to start the animation from when beginAnimationOnStart is true
begin Animation Loop
Gets or sets a boolean indicating if animations must loop when beginAnimationOnStart is true
begin Animation On Start
Gets or sets a boolean indicating that hosted animations (in the system.animations array) must be started when system.start() is called
begin Animation To
Gets or sets the frame to end the animation on when beginAnimationOnStart is true
blend Mode
Blend mode use to render the particle For original blend modes which are exposed from ParticleSystem (OneOne, Standard, Add, Multiply, MultiplyAdd, and Subtract), use ParticleSystem.BLENDMODE_FOO For all other blend modes, use Engine Constants.ALPHA_FOO blend modes
clip Plane
Gets or sets the active clipplane 1
clip Plane2
Gets or sets the active clipplane 2
clip Plane3
Gets or sets the active clipplane 3
clip Plane4
Gets or sets the active clipplane 4
clip Plane5
Gets or sets the active clipplane 5
clip Plane6
Gets or sets the active clipplane 6
color1
Random color of each particle after it has been emitted, between color1 and color2 vectors
color2
Random color of each particle after it has been emitted, between color1 and color2 vectors
color Dead
Color the particle will have at the end of its lifetime
custom Shader
This can help using your own shader to render the particle system. The according effect will be created
default Projection Matrix
Gets or sets a matrix to use to compute projection
dispose On Stop
Specifies whether the particle system will be disposed once it reaches the end of the animation.
do Not Serialize
Specifies if the particle system should be serialized
emit Rate
The maximum number of particles to emit per frame
emit Rate Control
Gets or sets whether emit rate control is enabled. When true, the GPU particle system limits the number of active particles to approximately emitRate * maxLifeTime (matching CPU particle behavior) and uses a circular buffer to recycle particle slots. When false (default), all dead particles are recycled immediately, which is the legacy GPU particle behavior. Changing the value takes effect on the next frame (the update and render effects are rebuilt automatically when their shader defines change; buffer allocation does not depend on it).
emitter
The emitter represents the Mesh or position we are attaching the particle system to.
end Sprite Cell ID
If using a spritesheet (isAnimationSheetEnabled) defines the last sprite cell to display
flow Map Strength
The strength of the flow map
force Depth Write
Forces the particle to write their depth information to the depth buffer. This can help preventing other draw calls to override the particles.
gravity
You can use gravity if you want to give an orientation to your particles.
id
The id of the Particle system.
Readonlyis GPU
Indicates that the particle system is GPU based
is Local
Specifies if the particles are updated in emitter local space or world space.
layer Mask
The layer mask we are rendering the particles through.
limit Velocity Damping
Gets or sets a value indicating the damping to apply if the limit velocity factor is reached
manual Emit Count
If you want to launch only a few particles at once, that can be done, as well.
max Angular Speed
Maximum angular speed of emitting particles (Z-axis rotation for each particle).
Readonlymax Attractors
Maximum number of attractors for this GPU particle system instance.
Determined at construction time via the maxAttractors option (default 8).
Limited by the fixed-size uniform arrays in the update shaders.
max Emit Power
Maximum power of emitting particles.
max Initial Rotation
Gets or sets the maximal initial rotation in radians.
max Life Time
Maximum life time of emitting particles.
max Scale X
Maximum scale of emitting particles on X axis.
max Scale Y
Maximum scale of emitting particles on Y axis.
max Size
Maximum Size of emitting particles.
metadata
Gets or sets an object used to store user defined information for the particle system
min Angular Speed
Minimum angular speed of emitting particles (Z-axis rotation for each particle).
min Emit Power
Minimum power of emitting particles.
min Initial Rotation
Gets or sets the minimal initial rotation in radians.
min Life Time
Minimum life time of emitting particles.
min Scale X
Minimum scale of emitting particles on X axis.
min Scale Y
Minimum scale of emitting particles on Y axis.
min Size
Minimum Size of emitting particles.
name
The friendly name of the Particle system.
noise Strength
Gets or sets the strength to apply to the noise value (default is (10, 10, 10))
on Animation End
Callback triggered when the particle animation is ending.
on Dispose Observable
An event triggered when the system is disposed.
on Started Observable
An event triggered when the system is started
on Stopped Observable
An event triggered when the system is stopped
particle Emitter Type
The particle emitter type defines the emitter used by the particle system. It can be for example box, sphere, or cone...
particle Texture
The texture used to render each particle. (this can be a spritesheet)
prevent Auto Start
By default particle system starts as soon as they are created. This prevents the automatic start to happen and let you decide when to start emitting particles.
pre Warm Cycles
Gets or sets a value indicating how many cycles (or frames) must be executed before first rendering (this value has to be set before starting the system). Default is 0
pre Warm Step Offset
Gets or sets a value indicating the time step multiplier to use in pre-warm mode (default is 1)
rendering Group Id
The rendering group used by the Particle system to chose when to render.
snippet Id
Snippet ID if the particle system was created from the snippet server
sprite Cell Change Speed
If using a spritesheet (isAnimationSheetEnabled) defines the speed of the sprite loop (default is 1 meaning the animation will play once during the entire particle lifetime)
sprite Cell Height
If using a spritesheet (isAnimationSheetEnabled), defines the sprite cell height to use
sprite Cell Loop
If using a spritesheet (isAnimationSheetEnabled), defines wether the sprite animation is looping
sprite Cell Width
If using a spritesheet (isAnimationSheetEnabled), defines the sprite cell width to use
sprite Random Start Cell
This allows the system to random pick the start cell ID between startSpriteCellID and endSpriteCellID
start Delay
Defines the delay in milliseconds before starting the system (0 by default)
start Sprite Cell ID
If using a spritesheet (isAnimationSheetEnabled) defines the first sprite cell to display
texture Mask
An optional mask to filter some colors out of the texture, or filter a part of the alpha channel
translation Pivot
Gets or sets a Vector2 used to move the pivot (by default (0,0))
unique Id
Gets or sets the unique id of the particle system
update In Animate
Indicates that the update of particles is done in the animate function (and not in render). Default: false
update Speed
The overall motion speed (0.01 is default update speed, faster updates = faster animation)
world Offset
Gets or sets a world offset applied to all particles
StaticBLENDMODE_ ADD
Add current color and particle color multiplied by particle’s alpha
StaticBLENDMODE_ MULTIPLY
Multiply current color with particle color
StaticBLENDMODE_ MULTIPLYADD
Multiply current color with particle color then add current color and particle color multiplied by particle’s alpha
StaticBLENDMODE_ ONEONE
Source color is added to the destination color without alpha affecting the result. Great for additive glow effects (fire, magic, lasers)
StaticBLENDMODE_ STANDARD
Blend current color and particle color using particle’s alpha. Same as Constants.ALPHA_COMBINE, the go-to for transparency. 100% alpha means source, 0% alpha means background. Glass, UI fade, smoke
StaticBLENDMODE_ SUBTRACT
Subtracts source (particle) from destination (current color), leading to darker results
- NOTE: Init as -1 so we can properly map all modes to Engine Const's (otherwise ALPHA_SUBTRACT will conflict with BLENDMODE_MULTIPLY since both use 3)
Accessors
_ is Animation Sheet Enabled
-
set _isAnimationSheetEnabled(value: boolean): void
Parameters
- value: boolean
Returns void
active Particle Count
-
get activeParticleCount(): number
-
set activeParticleCount(value: number): void
Parameters
- value: number
Returns void
attractors
-
The list of attractors used to change the direction of the particles in the system. Please note that this is a copy of the internal array. If you want to modify it, please use the addAttractor and removeAttractor methods.
Returns Attractor[]
billboard Mode
-
get billboardMode(): number
Gets or sets the billboard mode to use when isBillboardBased = true. Value can be: ParticleSystem.BILLBOARDMODE_ALL, ParticleSystem.BILLBOARDMODE_Y, ParticleSystem.BILLBOARDMODE_STRETCHED, ParticleSystem.PARTICLES_BILLBOARDMODE_STRETCHED_LOCAL
Returns number
-
set billboardMode(value: number): void
Gets or sets the billboard mode to use when isBillboardBased = true. Value can be: ParticleSystem.BILLBOARDMODE_ALL, ParticleSystem.BILLBOARDMODE_Y, ParticleSystem.BILLBOARDMODE_STRETCHED
Parameters
- value: number
Returns void
direction1
direction2
flow Map
-
get flowMap(): any
Gets or sets the current flow map
Returns any
-
set flowMap(value: any): void
Parameters
- value: any
Returns void
image Processing Configuration
-
Gets the image processing configuration used either in this material.
Returns Nullable<ImageProcessingConfiguration>
-
Sets the Default image processing configuration used either in the this material.
If sets to null, the scene one is in use.
Parameters
- value: Nullable<ImageProcessingConfiguration>
Returns void
index Buffer
-
Gets the index buffer used by the particle system (null for GPU particle systems)
Returns Nullable<DataBuffer>
is Animation Sheet Enabled
-
get isAnimationSheetEnabled(): boolean
Gets or sets whether an animation sprite sheet is enabled or not on the particle system
Returns boolean
-
set isAnimationSheetEnabled(value: boolean): void
Gets or sets a boolean indicating if a spritesheet is used to animate the particles texture
Parameters
- value: boolean
Returns void
is Billboard Based
-
get isBillboardBased(): boolean
Gets or sets a boolean indicating if the particles must be rendered as billboard or aligned with the direction
Returns boolean
-
set isBillboardBased(value: boolean): void
Gets or sets a boolean indicating if the particles must be rendered as billboard or aligned with the direction
Parameters
- value: boolean
Returns void
is Node Generated
-
get isNodeGenerated(): boolean
Returns true if the particle system was generated by a node particle system set
Returns boolean
max Active Particle Count
-
get maxActiveParticleCount(): number
Gets or set the number of active particles The value cannot be greater than "capacity" (if it is, it will be limited to "capacity").
Returns number
-
set maxActiveParticleCount(value: number): void
Parameters
- value: number
Returns void
max Emit Box
-
Maximum box point around our emitter. Our emitter is the center of particles source, but if you want your particles to emit from more than one point, then you can tell it to do so. This only works when particleEmitterTyps is a BoxParticleEmitter
Returns Vector3
-
Parameters
- value: Vector3
Returns void
min Emit Box
-
Minimum box point around our emitter. Our emitter is the center of particles source, but if you want your particles to emit from more than one point, then you can tell it to do so. This only works when particleEmitterTyps is a BoxParticleEmitter
Returns Vector3
-
Parameters
- value: Vector3
Returns void
noise Texture
-
Gets or sets a texture used to add random noise to particle positions
Returns Nullable<ProceduralTexture>
-
Gets or sets a texture used to add random noise to particle positions
Parameters
- value: Nullable<ProceduralTexture>
Returns void
on Before Draw Particles Observable
-
Observable that will be called just before the particles are drawn
Returns Observable<Nullable<Effect>>
target Stop Duration
-
get targetStopDuration(): number
The amount of time the particle system is running (depends of the overall update speed).
Returns number
-
set targetStopDuration(value: number): void
The amount of time the particle system is running (depends of the overall update speed).
Parameters
- value: number
Returns void
use Logarithmic Depth
-
get useLogarithmicDepth(): boolean
Gets or sets a boolean enabling the use of logarithmic depth buffers, which is good for wide depth buffers.
Returns boolean
-
set useLogarithmicDepth(value: boolean): void
Gets or sets a boolean enabling the use of logarithmic depth buffers, which is good for wide depth buffers.
Parameters
- value: boolean
Returns void
use Ramp Gradients
-
get useRampGradients(): boolean
Not supported by GPUParticleSystem Gets or sets a boolean indicating that ramp gradients must be used
Returns boolean
-
set useRampGradients(value: boolean): void
Gets or sets a boolean indicating that ramp gradients must be used
Parameters
- value: boolean
Returns void
vertex Buffers
-
Gets the vertex buffers used by the particle system Should be called after render() has been called for the current frame so that the buffers returned are the ones that have been updated in the current frame (there's a ping-pong between two sets of buffers - for a given frame, one set is used as the source and the other as the destination)
Returns Immutable<{ [key: string]: VertexBuffer }>
vertex Shader Name
-
get vertexShaderName(): string
Gets the name of the particle vertex shader
Returns string
StaticIs Supported
-
get IsSupported(): boolean
Gets a boolean indicating if the GPU particles can be rendered on current browser
Returns boolean
Methods
add Alpha Remap Gradient
add Angular Speed Gradient
-
Adds a new angular speed gradient
Parameters
- gradient: number
defines the gradient to use (between 0 and 1)
- factor: number
defines the angular speed to affect to the specified gradient
Optionalfactor2: numberdefines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from
Returns GPUParticleSystem
the current particle system
- gradient: number
add Attractor
-
Add an attractor to the particle system. Attractors are used to change the direction of the particles in the system.
Parameters
- attractor: Attractor
The attractor to add to the particle system
Returns void
- attractor: Attractor
add Color Gradient
-
Adds a new color gradient
Parameters
- gradient: number
defines the gradient to use (between 0 and 1)
- color1: Color4
defines the color to affect to the specified gradient
Optionalcolor2: Color4defines an optional second color to be used to produce a random color per particle at the gradient (lerped with color1 using a per-particle random value)
Returns GPUParticleSystem
the current particle system
- gradient: number
add Color Remap Gradient
add Drag Gradient
-
Adds a new drag gradient
Parameters
- gradient: number
defines the gradient to use (between 0 and 1)
- factor: number
defines the drag value to affect to the specified gradient
Optionalfactor2: numberdefines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from
Returns GPUParticleSystem
the current particle system
- gradient: number
add Emit Rate Gradient
-
Adds a new emit rate gradient (please note that this will only work if you set the targetStopDuration property)
Parameters
- gradient: number
defines the gradient to use (between 0 and 1)
- factor: number
defines the emit rate value to affect to the specified gradient
Optionalfactor2: numberdefines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from
Returns this
the current particle system
- gradient: number
add Life Time Gradient
-
Adds a new life time gradient (please note that this will only work if you set the targetStopDuration property)
Parameters
- gradient: number
defines the gradient to use (between 0 and 1)
- factor: number
defines the life time factor to affect to the specified gradient
Optionalfactor2: numberdefines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from
Returns IParticleSystem
the current particle system
- gradient: number
add Limit Velocity Gradient
-
Adds a new limit velocity gradient
Parameters
- gradient: number
defines the gradient to use (between 0 and 1)
- factor: number
defines the limit velocity value to affect to the specified gradient
Optionalfactor2: numberdefines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from
Returns GPUParticleSystem
the current particle system
- gradient: number
add Ramp Gradient
add Size Gradient
-
Adds a new size gradient
Parameters
- gradient: number
defines the gradient to use (between 0 and 1)
- factor: number
defines the size factor to affect to the specified gradient
Optionalfactor2: numberdefines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from
Returns GPUParticleSystem
the current particle system
- gradient: number
add Start Size Gradient
-
Adds a new start size gradient (please note that this will only work if you set the targetStopDuration property)
Parameters
- gradient: number
defines the gradient to use (between 0 and 1)
- factor: number
defines the start size factor to affect to the specified gradient
Optionalfactor2: numberdefines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from
Returns IParticleSystem
the current particle system
- gradient: number
add Velocity Gradient
-
Adds a new velocity gradient
Parameters
- gradient: number
defines the gradient to use (between 0 and 1)
- factor: number
defines the velocity to affect to the specified gradient
Optionalfactor2: numberdefines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from
Returns GPUParticleSystem
the current particle system
- gradient: number
animate
-
Animates the particle system for the current frame by emitting new particles and or animating the living ones.
Parameters
- preWarm: boolean = false
defines if we are in the pre-warmimg phase
Returns void
- preWarm: boolean = false
clone
-
Clones the particle system.
Parameters
- name: string
The name of the cloned object
- newEmitter: any
The new emitter to use
- cloneTexture: boolean = false
Also clone the textures if true
Returns GPUParticleSystem
the cloned particle system
- name: string
create Box Emitter
-
createBoxEmitter(
direction1: Vector3,
direction2: Vector3,
minEmitBox: Vector3,
maxEmitBox: Vector3,
): BoxParticleEmitterCreates a Box Emitter for the particle system. (emits between direction1 and direction2 from within the box defined by minEmitBox and maxEmitBox)
Parameters
- direction1: Vector3
Particles are emitted between the direction1 and direction2 from within the box
- direction2: Vector3
Particles are emitted between the direction1 and direction2 from within the box
- minEmitBox: Vector3
Particles are emitted from the box between minEmitBox and maxEmitBox
- maxEmitBox: Vector3
Particles are emitted from the box between minEmitBox and maxEmitBox
Returns BoxParticleEmitter
the emitter
- direction1: Vector3
create Cone Emitter
-
Creates a Cone Emitter for the particle system (emits from the cone to the particle position)
Parameters
- radius: number = 1
The radius of the cone to emit from
- angle: number = ...
The base angle of the cone
Returns ConeParticleEmitter
the emitter
- radius: number = 1
create Cylinder Emitter
-
createCylinderEmitter(
radius?: number,
height?: number,
radiusRange?: number,
directionRandomizer?: number,
): CylinderParticleEmitterCreates a Cylinder Emitter for the particle system (emits from the cylinder to the particle position)
Parameters
- radius: number = 1
The radius of the emission cylinder
- height: number = 1
The height of the emission cylinder
- radiusRange: number = 1
The range of emission [0-1] 0 Surface only, 1 Entire Radius
- directionRandomizer: number = 0
How much to randomize the particle direction [0-1]
Returns CylinderParticleEmitter
the emitter
- radius: number = 1
create Directed Cone Emitter
-
createDirectedConeEmitter(
radius?: number,
angle?: number,
direction1?: Vector3,
direction2?: Vector3,
): ConeDirectedParticleEmitterCreates a Directed Cone Emitter for the particle system (emits between direction1 and direction2)
Parameters
- radius: number = 1
The radius of the cone to emit from
- angle: number = ...
The base angle of the cone
- direction1: Vector3 = ...
Particles are emitted between the direction1 and direction2 from within the cone
- direction2: Vector3 = ...
Particles are emitted between the direction1 and direction2 from within the cone
Returns ConeDirectedParticleEmitter
the emitter
- radius: number = 1
create Directed Cylinder Emitter
-
createDirectedCylinderEmitter(
radius?: number,
height?: number,
radiusRange?: number,
direction1?: Vector3,
direction2?: Vector3,
): CylinderDirectedParticleEmitterCreates a Directed Cylinder Emitter for the particle system (emits between direction1 and direction2)
Parameters
- radius: number = 1
The radius of the cylinder to emit from
- height: number = 1
The height of the emission cylinder
- radiusRange: number = 1
the range of the emission cylinder [0-1] 0 Surface only, 1 Entire Radius (1 by default)
- direction1: Vector3 = ...
Particles are emitted between the direction1 and direction2 from within the cylinder
- direction2: Vector3 = ...
Particles are emitted between the direction1 and direction2 from within the cylinder
Returns CylinderDirectedParticleEmitter
the emitter
- radius: number = 1
create Directed Sphere Emitter
-
createDirectedSphereEmitter(
radius?: number,
direction1?: Vector3,
direction2?: Vector3,
): SphereDirectedParticleEmitterCreates a Directed Sphere Emitter for the particle system (emits between direction1 and direction2)
Parameters
Returns SphereDirectedParticleEmitter
the emitter
create Hemispheric Emitter
-
Creates a Hemisphere Emitter for the particle system (emits along the hemisphere radius)
Parameters
- radius: number = 1
The radius of the hemisphere to emit from
- radiusRange: number = 1
The range of the hemisphere to emit from [0-1] 0 Surface Only, 1 Entire Radius
Returns HemisphericParticleEmitter
the emitter
- radius: number = 1
create Mesh Emitter
-
Creates a Mesh Emitter for the particle system (emits from the surface of a mesh)
Parameters
- mesh: Nullable<AbstractMesh> = null
The mesh to use as the emitter source
Returns MeshParticleEmitter
the emitter
- mesh: Nullable<AbstractMesh> = null
create Point Emitter
-
Creates a Point Emitter for the particle system (emits directly from the emitter position)
Parameters
Returns PointParticleEmitter
the emitter
create Sphere Emitter
-
Creates a Sphere Emitter for the particle system (emits along the sphere radius)
Parameters
- radius: number = 1
The radius of the sphere to emit from
- radiusRange: number = 1
The range of the sphere to emit from [0-1] 0 Surface Only, 1 Entire Radius
Returns SphereParticleEmitter
the emitter
- radius: number = 1
dispose
-
Disposes the particle system and free the associated resources
Parameters
- disposeTexture: boolean = true
defines if the particule texture must be disposed as well (true by default)
Returns void
- disposeTexture: boolean = true
fill Defines
-
Fill the defines array according to the current settings of the particle system
Parameters
- defines: string[]
Array to be updated
- blendMode: number = 0
blend mode to take into account when updating the array
- fillImageProcessing: boolean = true
fills the image processing defines
Returns void
- defines: string[]
fill Uniforms Attributes And Sampler Names
-
fillUniformsAttributesAndSamplerNames(
uniforms: string[],
attributes: string[],
samplers: string[],
): voidFill the uniforms, attributes and samplers arrays according to the current settings of the particle system
Parameters
- uniforms: string[]
Uniforms array to fill
- attributes: string[]
Attributes array to fill
- samplers: string[]
Samplers array to fill
Returns void
- uniforms: string[]
force Refresh Gradients
-
Force the system to rebuild all gradients that need to be resync.
This is the live-edit entry point both Inspectors call from their gradient onChange handlers, so a value-only edit must preserve the running simulation: every family whose lookup texture can be re-baked in place is updated without touching the particle buffers. Only a STRUCTURAL change — a family that has no texture to re-bake yet, one that was emptied, or a color2 row-layout flip — rebuilds the pool.
An ABSENT family is not a structural change: it has nothing to resync, and counting it as one would reset the pool on every call (the destruction this method exists to avoid). Absence has two spellings — see _gradientFamilyNeedsResync.
Returns void
get Active Count
-
Gets the number of particles active at the same time.
Returns number
The number of active particles.
get Alpha Remap Gradients
-
Gets the current list of alpha remap gradients. You must use addAlphaRemapGradient and removeAlphaRemapGradient to update this list
Returns Nullable<FactorGradient[]>
the list of alpha remap gradients
get Angular Speed Gradients
-
Gets the current list of angular speed gradients. You must use addAngularSpeedGradient and removeAngularSpeedGradient to update this list
Returns Nullable<FactorGradient[]>
the list of angular speed gradients
get Capacity
-
Gets the maximum number of particles active at the same time.
Returns number
The max number of active particles.
get Class Name
-
Returns the string "GPUParticleSystem"
Returns string
a string containing the class name
get Color Gradients
-
Gets the current list of color gradients. You must use addColorGradient and removeColorGradient to update this list
Returns Nullable<ColorGradient[]>
the list of color gradients
get Color Remap Gradients
-
Gets the current list of color remap gradients. You must use addColorRemapGradient and removeColorRemapGradient to update this list
Returns Nullable<FactorGradient[]>
the list of color remap gradients
get Custom Effect
get Drag Gradients
-
Gets the current list of drag gradients. You must use addDragGradient and removeDragGradient to update this list
Returns Nullable<FactorGradient[]>
the list of drag gradients
get Emit Rate Gradients
-
Gets the current list of emit rate gradients. You must use addEmitRateGradient and removeEmitRateGradient to update this list
Returns Nullable<FactorGradient[]>
the list of emit rate gradients
get Life Time Gradients
-
Gets the current list of life time gradients. You must use addLifeTimeGradient and removeLifeTimeGradient to update this list
Returns Nullable<FactorGradient[]>
the list of life time gradients
get Limit Velocity Gradients
-
Gets the current list of limit velocity gradients. You must use addLimitVelocityGradient and removeLimitVelocityGradient to update this list
Returns Nullable<FactorGradient[]>
the list of limit velocity gradients
get Ramp Gradients
get Scene
get Size Gradients
-
Gets the current list of size gradients. You must use addSizeGradient and removeSizeGradient to update this list
Returns Nullable<FactorGradient[]>
the list of size gradients
get Start Size Gradients
-
Gets the current list of start size gradients. You must use addStartSizeGradient and removeStartSizeGradient to update this list
Returns Nullable<FactorGradient[]>
the list of start size gradients
get Velocity Gradients
-
Gets the current list of velocity gradients. You must use addVelocityGradient and removeVelocityGradient to update this list
Returns Nullable<FactorGradient[]>
the list of velocity gradients
is Ready
-
Is this system ready to be used/rendered
Returns boolean
true if the system is ready
is Started
-
Gets if the system has been started. (Note: this will still be true after stop is called)
Returns boolean
True if it has been started, otherwise false.
is Stopped
-
Gets if the system has been stopped. (Note: rendering is still happening but the system is frozen)
Returns boolean
True if it has been stopped, otherwise false.
is Stopping
-
Gets a boolean indicating that the system is stopping
Returns boolean
true if the system is currently stopping
rebuild
-
Rebuilds the particle system
Returns void
remove Alpha Remap Gradient
remove Angular Speed Gradient
-
Remove a specific angular speed gradient
Parameters
- gradient: number
defines the gradient to remove
Returns GPUParticleSystem
the current particle system
- gradient: number
remove Attractor
-
Removes an attractor from the particle system. Attractors are used to change the direction of the particles in the system.
Parameters
- attractor: Attractor
The attractor to remove from the particle system
Returns void
- attractor: Attractor
remove Color Gradient
-
Remove a specific color gradient
Parameters
- gradient: number
defines the gradient to remove
Returns GPUParticleSystem
the current particle system
- gradient: number
remove Color Remap Gradient
remove Drag Gradient
-
Remove a specific drag gradient
Parameters
- gradient: number
defines the gradient to remove
Returns GPUParticleSystem
the current particle system
- gradient: number
remove Emit Rate Gradient
-
Remove a specific emit rate gradient
Parameters
- gradient: number
defines the gradient to remove
Returns this
the current particle system
- gradient: number
remove Life Time Gradient
-
Remove a specific life time gradient
Parameters
- gradient: number
defines the gradient to remove
Returns IParticleSystem
the current particle system
- gradient: number
remove Limit Velocity Gradient
-
Remove a specific limit velocity gradient
Parameters
- gradient: number
defines the gradient to remove
Returns GPUParticleSystem
the current particle system
- gradient: number
remove Ramp Gradient
remove Size Gradient
-
Remove a specific size gradient
Parameters
- gradient: number
defines the gradient to remove
Returns GPUParticleSystem
the current particle system
- gradient: number
remove Start Size Gradient
-
Remove a specific start size gradient
Parameters
- gradient: number
defines the gradient to remove
Returns IParticleSystem
the current particle system
- gradient: number
remove Velocity Gradient
-
Remove a specific velocity gradient
Parameters
- gradient: number
defines the gradient to remove
Returns GPUParticleSystem
the current particle system
- gradient: number
render
-
Renders the particle system in its current state
Parameters
- preWarm: boolean = false
defines if the system should only update the particles but not render them
- forceUpdateOnly: boolean = false
if true, force to only update the particles and never display them (meaning, even if preWarm=false, when forceUpdateOnly=true the particles won't be displayed)
Returns number
the current number of particles
- preWarm: boolean = false
reset
-
Remove all active particles
Returns void
reset Draw Cache
-
Resets the draw wrappers cache
Returns void
serialize
-
Serializes the particle system to a JSON object
Parameters
- serializeTexture: boolean = false
defines if the texture must be serialized as well
Returns any
the JSON object
- serializeTexture: boolean = false
set Custom Effect
start
-
Starts the particle system and begins to emit
Parameters
- delay: number = ...
defines the delay in milliseconds before starting the system (this.startDelay by default)
Returns void
- delay: number = ...
stop
-
Stops the particle system.
Returns void
Staticfrom Particle System
-
fromParticleSystem(
source: ParticleSystem,
sceneOrEngine: Scene | AbstractEngine,
options?: Partial<
{
capacity: number;
emitRateControl: boolean;
maxAttractors: number;
randomTextureSize: number;
},
>,
): GPUParticleSystemCreates a new GPUParticleSystem from an existing CPU ParticleSystem, copying all shared properties. Features that are not supported on the GPU (sub-emitters, custom
startDirectionFunction/startPositionFunction,customShader, ramp/remap gradients) are logged as warnings and skipped. Flow maps are converted: the CPUFlowMapimage data is uploaded to a newRawTexturewhich is assigned to the result.Note: a custom
updateFunctionon the source cannot be detected (the property is always assigned to a default) and has no equivalent on the GPU path, so any custom per-frame update logic will be silently dropped.Textures (particleTexture, noiseTexture) are shared by reference between the source and the result. All other mutable state (colors, vectors, emitter type, gradients, attractors) is cloned so that the two systems can be modified independently after the call.
Note: unlike the GPUParticleSystem constructor,
emitRateControldefaults totruehere so that changes toemitRateon the converted system behave the same as on the CPU source. Pass{ emitRateControl: false }explicitly to opt out.Parameters
- source: ParticleSystem
The CPU ParticleSystem to convert
- sceneOrEngine: Scene | AbstractEngine
The scene or engine the new GPU particle system belongs to
Optionaloptions: Partial<
{
capacity: number;
emitRateControl: boolean;
maxAttractors: number;
randomTextureSize: number;
},
>Optional options forwarded to the new GPU particle system (capacity, randomTextureSize, emitRateControl, maxAttractors).
capacitydefaults to the source capacity andemitRateControldefaults totrue.
Returns GPUParticleSystem
A new GPUParticleSystem with shared properties copied from the source
- source: ParticleSystem
StaticParse
-
Parse(
parsedParticleSystem: any,
sceneOrEngine: Scene | AbstractEngine,
rootUrl: string,
doNotStart?: boolean,
capacity?: number,
): GPUParticleSystemParses a JSON object to create a GPU particle system.
Parameters
- parsedParticleSystem: any
The JSON object to parse
- sceneOrEngine: Scene | AbstractEngine
The scene or the engine to create the particle system in
- rootUrl: string
The root url to use to load external dependencies like texture
- doNotStart: boolean = false
Ignore the preventAutoStart attribute and does not start
Optionalcapacity: numberdefines the system capacity (if null or undefined the sotred capacity will be used)
Returns GPUParticleSystem
the parsed GPU particle system
- parsedParticleSystem: any
This represents a GPU particle system in Babylon This is the fastest particle system in Babylon as it uses the GPU to update the individual particle data
See
https://www.babylonjs-playground.com/#PU4WYI#4