Options
All
  • Public
  • Public/Protected
  • All
Menu

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

Hierarchy

Implements

Index

Constructors

Properties

Accessors

Methods

Constructors

  • Instantiates 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; randomTextureSize: number }>

      The options used to create the system

    • sceneOrEngine: Scene | ThinEngine

      The scene the particle system belongs to or the engine to use if no scene

    • Optional customEffect: Nullable<Effect>

      a custom effect used to change the way particles are rendered by default

    • Optional isAnimationSheetEnabled: boolean

      Must be true if using a spritesheet to animate the particles texture

    Returns GPUParticleSystem

Properties

animations: Animation[]

List of animations used by the particle system.

beginAnimationFrom: number

Gets or sets the frame to start the animation from when beginAnimationOnStart is true

beginAnimationLoop: boolean

Gets or sets a boolean indicating if animations must loop when beginAnimationOnStart is true

beginAnimationOnStart: boolean

Gets or sets a boolean indicating that hosted animations (in the system.animations array) must be started when system.start() is called

beginAnimationTo: number

Gets or sets the frame to end the animation on when beginAnimationOnStart is true

blendMode: number

Blend mode use to render the particle, it can be either ParticleSystem.BLENDMODE_ONEONE or ParticleSystem.BLENDMODE_STANDARD.

clipPlane: Nullable<Plane>

Gets or sets the active clipplane 1

clipPlane2: Nullable<Plane>

Gets or sets the active clipplane 2

clipPlane3: Nullable<Plane>

Gets or sets the active clipplane 3

clipPlane4: Nullable<Plane>

Gets or sets the active clipplane 4

clipPlane5: Nullable<Plane>

Gets or sets the active clipplane 5

clipPlane6: Nullable<Plane>

Gets or sets the active clipplane 6

color1: Color4

Random color of each particle after it has been emitted, between color1 and color2 vectors

color2: Color4

Random color of each particle after it has been emitted, between color1 and color2 vectors

colorDead: Color4

Color the particle will have at the end of its lifetime

customShader: any

This can help using your own shader to render the particle system. The according effect will be created

defaultProjectionMatrix: Matrix

Gets or sets a matrix to use to compute projection

disposeOnStop: boolean

Specifies whether the particle system will be disposed once it reaches the end of the animation.

emitRate: number

The maximum number of particles to emit per frame

The emitter represents the Mesh or position we are attaching the particle system to.

endSpriteCellID: number

If using a spritesheet (isAnimationSheetEnabled) defines the last sprite cell to display

forceDepthWrite: boolean

Forces the particle to write their depth information to the depth buffer. This can help preventing other draw calls to override the particles.

gravity: Vector3

You can use gravity if you want to give an orientation to your particles.

id: string

The id of the Particle system.

isGPU: true = true

Indicates that the particle system is GPU based

isLocal: boolean

Specifies if the particles are updated in emitter local space or world space.

layerMask: number

The layer mask we are rendering the particles through.

limitVelocityDamping: number

Gets or sets a value indicating the damping to apply if the limit velocity factor is reached

manualEmitCount: number

If you want to launch only a few particles at once, that can be done, as well.

maxAngularSpeed: number

Maximum angular speed of emitting particles (Z-axis rotation for each particle).

maxEmitPower: number

Maximum power of emitting particles.

maxInitialRotation: number

Gets or sets the maximal initial rotation in radians.

maxLifeTime: number

Maximum life time of emitting particles.

maxScaleX: number

Maximum scale of emitting particles on X axis.

maxScaleY: number

Maximum scale of emitting particles on Y axis.

maxSize: number

Maximum Size of emitting particles.

minAngularSpeed: number

Minimum angular speed of emitting particles (Z-axis rotation for each particle).

minEmitPower: number

Minimum power of emitting particles.

minInitialRotation: number

Gets or sets the minimal initial rotation in radians.

minLifeTime: number

Minimum life time of emitting particles.

minScaleX: number

Minimum scale of emitting particles on X axis.

minScaleY: number

Minimum scale of emitting particles on Y axis.

minSize: number

Minimum Size of emitting particles.

name: string

The friendly name of the Particle system.

noiseStrength: Vector3

Gets or sets the strength to apply to the noise value (default is (10, 10, 10))

onAnimationEnd: Nullable<(() => void)>

Callback triggered when the particle animation is ending.

onDisposeObservable: Observable<IParticleSystem>

An event triggered when the system is disposed.

onStoppedObservable: Observable<IParticleSystem>

An event triggered when the system is stopped

particleEmitterType: IParticleEmitterType

The particle emitter type defines the emitter used by the particle system. It can be for example box, sphere, or cone...

particleTexture: Nullable<BaseTexture>

The texture used to render each particle. (this can be a spritesheet)

preWarmCycles: number

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

preWarmStepOffset: number

Gets or sets a value indicating the time step multiplier to use in pre-warm mode (default is 1)

preventAutoStart: boolean

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.

renderingGroupId: number

The rendering group used by the Particle system to chose when to render.

snippetId: string

Snippet ID if the particle system was created from the snippet server

spriteCellChangeSpeed: number

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)

spriteCellHeight: number

If using a spritesheet (isAnimationSheetEnabled), defines the sprite cell height to use

spriteCellLoop: boolean

If using a spritesheet (isAnimationSheetEnabled), defines wether the sprite animation is looping

spriteCellWidth: number

If using a spritesheet (isAnimationSheetEnabled), defines the sprite cell width to use

spriteRandomStartCell: boolean

This allows the system to random pick the start cell ID between startSpriteCellID and endSpriteCellID

startDelay: number

Defines the delay in milliseconds before starting the system (0 by default)

startSpriteCellID: number

If using a spritesheet (isAnimationSheetEnabled) defines the first sprite cell to display

targetStopDuration: number

The amount of time the particle system is running (depends of the overall update speed).

textureMask: Color4

An optional mask to filter some colors out of the texture, or filter a part of the alpha channel

translationPivot: Vector2

Gets or sets a Vector2 used to move the pivot (by default (0,0))

uniqueId: number

Gets or sets the unique id of the particle system

updateInAnimate: boolean

Indicates that the update of particles is done in the animate function (and not in render). Default: false

updateSpeed: number

The overall motion speed (0.01 is default update speed, faster updates = faster animation)

worldOffset: Vector3

Gets or sets a world offset applied to all particles

BLENDMODE_ADD: number

Add current color and particle color multiplied by particle’s alpha

BLENDMODE_MULTIPLY: number

Multiply current color with particle color

BLENDMODE_MULTIPLYADD: number

Multiply current color with particle color then add current color and particle color multiplied by particle’s alpha

BLENDMODE_ONEONE: number

Source color is added to the destination color without alpha affecting the result

BLENDMODE_STANDARD: number

Blend current color and particle color using particle’s alpha

Accessors

  • get activeParticleCount(): number
  • set activeParticleCount(value: number): void
  • Gets or set the number of active particles

    deprecated

    Please use maxActiveParticleCount instead.

    Returns number

  • Gets or set the number of active particles

    deprecated

    Please use maxActiveParticleCount instead.

    Parameters

    • value: number

    Returns void

  • get billboardMode(): 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

    Returns number

  • 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

  • Random direction of each particle after it has been emitted, between direction1 and direction2 vectors. This only works when particleEmitterTyps is a BoxParticleEmitter

    Returns Vector3

  • Random direction of each particle after it has been emitted, between direction1 and direction2 vectors. This only works when particleEmitterTyps is a BoxParticleEmitter

    Parameters

    Returns void

  • Random direction of each particle after it has been emitted, between direction1 and direction2 vectors. This only works when particleEmitterTyps is a BoxParticleEmitter

    Returns Vector3

  • Random direction of each particle after it has been emitted, between direction1 and direction2 vectors. This only works when particleEmitterTyps is a BoxParticleEmitter

    Parameters

    Returns void

  • 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

    Returns void

  • get isAnimationSheetEnabled(): boolean
  • set isAnimationSheetEnabled(value: boolean): void
  • Gets or sets whether an animation sprite sheet is enabled or not on the particle system

    Returns boolean

  • Gets or sets whether an animation sprite sheet is enabled or not on the particle system

    Parameters

    • value: boolean

    Returns void

  • get isBillboardBased(): 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

    Returns boolean

  • Gets or sets a boolean indicating if the particles must be rendered as billboard or aligned with the direction

    Parameters

    • value: boolean

    Returns void

  • get maxActiveParticleCount(): number
  • set maxActiveParticleCount(value: number): void
  • 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

  • Gets or set the number of active particles The value cannot be greater than "capacity" (if it is, it will be limited to "capacity").

    Parameters

    • value: number

    Returns void

  • 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

  • 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

    Parameters

    Returns void

  • 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

  • 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

    Parameters

    Returns void

  • get useLogarithmicDepth(): 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.

    Returns boolean

  • Gets or sets a boolean enabling the use of logarithmic depth buffers, which is good for wide depth buffers.

    Parameters

    • value: boolean

    Returns void

  • get useRampGradients(): boolean
  • set useRampGradients(value: boolean): void
  • 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 DeepImmutableObject<{}>

  • get vertexShaderName(): string
  • get IsSupported(): boolean
  • Gets a boolean indicating if the GPU particles can be rendered on current browser

    Returns boolean

Methods

  • 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

    Returns GPUParticleSystem

    the current particle system

  • 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

    Returns GPUParticleSystem

    the current particle system

  • 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

    Returns GPUParticleSystem

    the current particle system

  • 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

    Returns GPUParticleSystem

    the current particle system

  • 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

    Returns GPUParticleSystem

    the current particle system

  • 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

    Returns GPUParticleSystem

    the current particle system

  • animate(preWarm?: boolean): void
  • Animates the particle system for the current frame by emitting new particles and or animating the living ones.

    Parameters

    • Optional preWarm: boolean

      defines if we are in the pre-warmimg phase

    Returns void

  • Clones the particle system.

    Parameters

    • name: string

      The name of the cloned object

    • newEmitter: any

      The new emitter to use

    • Optional cloneTexture: boolean

      Also clone the textures if true

    Returns GPUParticleSystem

    the cloned particle system

  • Creates a Box Emitter for the particle system. (emits between direction1 and direction2 from withing 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

  • createCylinderEmitter(radius?: number, height?: number, radiusRange?: number, directionRandomizer?: number): CylinderParticleEmitter
  • Creates a Cylinder Emitter for the particle system (emits from the cylinder to the particle position)

    Parameters

    • Optional radius: number

      The radius of the emission cylinder

    • Optional height: number

      The height of the emission cylinder

    • Optional radiusRange: number

      The range of emission [0-1] 0 Surface only, 1 Entire Radius

    • Optional directionRandomizer: number

      How much to randomize the particle direction [0-1]

    Returns CylinderParticleEmitter

    the emitter

  • Creates a Directed Cylinder Emitter for the particle system (emits between direction1 and direction2)

    Parameters

    • Optional radius: number

      The radius of the cylinder to emit from

    • Optional height: number

      The height of the emission cylinder

    • Optional radiusRange: number

      the range of the emission cylinder [0-1] 0 Surface only, 1 Entire Radius (1 by default)

    • Optional direction1: Vector3

      Particles are emitted between the direction1 and direction2 from within the cylinder

    • Optional direction2: Vector3

      Particles are emitted between the direction1 and direction2 from within the cylinder

    Returns CylinderDirectedParticleEmitter

    the emitter

  • dispose(disposeTexture?: boolean): void
  • Disposes the particle system and free the associated resources

    Parameters

    • Optional disposeTexture: boolean

      defines if the particule texture must be disposed as well (true by default)

    Returns void

  • fillDefines(defines: string[], blendMode?: number): void
  • Fill the defines array according to the current settings of the particle system

    Parameters

    • defines: string[]

      Array to be updated

    • Optional blendMode: number

      blend mode to take into account when updating the array

    Returns void

  • fillUniformsAttributesAndSamplerNames(uniforms: string[], attributes: string[], samplers: string[]): void
  • Fill 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

  • forceRefreshGradients(): void
  • getActiveCount(): number
  • Gets the number of particles active at the same time.

    Returns number

    The number of active particles.

  • getCapacity(): number
  • Gets the maximum number of particles active at the same time.

    Returns number

    The max number of active particles.

  • getClassName(): string
  • Returns the string "GPUParticleSystem"

    Returns string

    a string containing the class name

  • Gets the custom effect used to render the particles

    Parameters

    • Optional blendMode: number

      Blend mode for which the effect should be retrieved

    Returns Nullable<Effect>

    The effect

  • isReady(): boolean
  • Is this system ready to be used/rendered

    Returns boolean

    true if the system is ready

  • isStarted(): boolean
  • 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.

  • isStopped(): boolean
  • 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.

  • isStopping(): boolean
  • Gets a boolean indicating that the system is stopping

    Returns boolean

    true if the system is currently stopping

  • rebuild(): void
  • Rebuilds the particle system

    Returns void

  • Not supported by GPUParticleSystem

    Returns IParticleSystem

    the current particle system

  • Not supported by GPUParticleSystem

    Returns IParticleSystem

    the current particle system

  • Not supported by GPUParticleSystem

    Returns IParticleSystem

    the current particle system

  • render(preWarm?: boolean, forceUpdateOnly?: boolean): number
  • Renders the particle system in its current state

    Parameters

    • Optional preWarm: boolean

      defines if the system should only update the particles but not render them

    • Optional forceUpdateOnly: boolean

      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

  • reset(): void
  • Remove all active particles

    Returns void

  • resetDrawCache(): void
  • Resets the draw wrappers cache

    Returns void

  • serialize(serializeTexture?: boolean): any
  • Serializes the particle system to a JSON object

    Parameters

    • Optional serializeTexture: boolean

      defines if the texture must be serialized as well

    Returns any

    the JSON object

  • Sets the custom effect used to render the particles

    Parameters

    • effect: Nullable<Effect>

      The effect to set

    • Optional blendMode: number

      Blend mode for which the effect should be set

    Returns void

  • start(delay?: number): void
  • Starts the particle system and begins to emit

    Parameters

    • Optional delay: number

      defines the delay in milliseconds before starting the system (this.startDelay by default)

    Returns void

  • stop(): void
  • Stops the particle system.

    Returns void

  • Parses a JSON object to create a GPU particle system.

    Parameters

    • parsedParticleSystem: any

      The JSON object to parse

    • sceneOrEngine: Scene | ThinEngine

      The scene or the engine to create the particle system in

    • rootUrl: string

      The root url to use to load external dependencies like texture

    • Optional doNotStart: boolean

      Ignore the preventAutoStart attribute and does not start

    • Optional capacity: number

      defines the system capacity (if null or undefined the sotred capacity will be used)

    Returns GPUParticleSystem

    the parsed GPU particle system

Legend

  • Constructor
  • Property
  • Method
  • Accessor
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Property
  • Method
  • Static method

Settings

Theme