GPUParticleSystem

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

  • GPUParticleSystem

Implements

Index

Constructors

constructor

  • 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<object>
    • scene: Scene

      The scene the particle system belongs to

    Returns GPUParticleSystem

Properties

activeParticleCount

activeParticleCount: number

Gets or set the number of active particles

animations

animations: Animation[]

List of animations used by the particle system.

blendMode

blendMode: number

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

color1

color1: Color4

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

color2

color2: Color4

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

colorDead

colorDead: Color4

Color the particle will have at the end of its lifetime.

direction1

direction1: Vector3

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

direction2

direction2: Vector3

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

emitRate

emitRate: number

The maximum number of particles to emit per frame until we reach the activeParticleCount value

emitter

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

forceDepthWrite

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

gravity: Vector3

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

id

id: string

The id of the Particle system.

layerMask

layerMask: number

The layer mask we are rendering the particles through.

maxAngularSpeed

maxAngularSpeed: number

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

maxEmitBox

maxEmitBox: 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

maxEmitPower

maxEmitPower: number

Maximum power of emitting particles.

maxLifeTime

maxLifeTime: number

Maximum life time of emitting particles.

maxSize

maxSize: number

Maximum Size of emitting particles.

minAngularSpeed

minAngularSpeed: number

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

minEmitBox

minEmitBox: 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

minEmitPower

minEmitPower: number

Minimum power of emitting particles.

minLifeTime

minLifeTime: number

Minimum life time of emitting particles.

minSize

minSize: number

Minimum Size of emitting particles.

name

name: string

The friendly name of the Particle system.

onDisposeObservable

onDisposeObservable: Observable<GPUParticleSystem>

An event triggered when the system is disposed.

particleEmitterType

particleEmitterType: Nullable<IParticleEmitterType>

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

particleTexture

particleTexture: Nullable<Texture>

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

renderingGroupId

renderingGroupId: number

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

targetStopDuration

targetStopDuration: number

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

updateSpeed

updateSpeed: number

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

Static IsSupported

IsSupported: boolean

Gets a boolean indicating if the GPU particles can be rendered on current browser

Methods

animate

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

    Returns void

clone

  • Clones the particle system.

    Parameters

    • name: string

      The name of the cloned object

    • newEmitter: any

      The new emitter to use

    Returns Nullable<GPUParticleSystem>

    the cloned particle system

dispose

  • 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

getCapacity

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

    Returns number

    The max number of active particles.

getClassName

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

    Returns string

    a string containing the class name

isReady

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

    Returns boolean

    true if the system is ready

isStarted

  • isStarted(): boolean
  • Gets Wether the system has been started.

    Returns boolean

    True if it has been started, otherwise false.

rebuild

  • rebuild(): void

render

  • render(): number
  • Renders the particle system in its current state.

    Returns number

    the current number of particles

reset

  • reset(): void

serialize

  • serialize(): any
  • Serializes the particle system to a JSON object.

    Returns any

    the JSON object

start

  • start(): void
  • Starts the particle system and begins to emit.

    Returns void

stop

  • stop(): void

Static Parse

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

    Parameters

    • parsedParticleSystem: any

      The JSON object to parse

    • scene: Scene

      The scene to create the particle system in

    • rootUrl: string

      The root url to use to load external dependencies like texture

    Returns GPUParticleSystem

    the parsed GPU particle system

Generated using TypeDoc