Particle3D QML Type | Qt Quick 3D 6.4.1

- Qt 6.4
- Qt Quick 3D
- QML Types
- QtQuick3D.Particles3D
- Particle3D
- Qt Quick 3D | Commercial or GPLv3

# Particle3D QML Type

Abstract logical particle. More...

Import Statement: | import QtQuick3D.Particles3D
Since: | Qt 6.2

- List of all members, including inherited members

## Properties

- AlignMode : enumeration
- FadeType : enumeration
- SortMode : enumeration
- alignMode : AlignMode
- alignTargetPosition : vector3d
- color : color
- colorVariation : vector4d
- fadeInDuration : int
- fadeInEffect : FadeType
- fadeOutDuration : int
- fadeOutEffect : FadeType
- hasTransparency : bool
- maxAmount : int
- sortMode : SortMode
- unifiedColorVariation : bool

## Detailed Description

This element defines the common properties of the logical particles. Particle3D is an abstract base class of particles, use ModelParticle3D or SpriteParticle3D instead.

Note: Unlike the materials used with the models, particles default to being rendered with assuming semi-transparency, and so with blending enabled. This is the desired behavior most of the time due to particle textures, color (alpha) variations, fadings etc. If you don't need the blending, set the hasTransparency to `false` for possible performance gains.

## Property Documentation

AlignMode : enumeration

Defines the type of the alignment.

Constant | Description
--- | ---
`Particle3D.AlignNone` | No alignment. Particles rotation can be defined with particleRotation.
`Particle3D.AlignTowardsTarget` | Align the particles towards alignTargetPosition direction.
`Particle3D.AlignTowardsStartVelocity` | Align the particles towards their starting velocity direction.

FadeType : enumeration

Defines the type of the fading effect.

Constant | Description
--- | ---
`Particle3D.FadeNone` | No fading.
`Particle3D.FadeOpacity` | Fade the particle opacity from/to 0.0.
`Particle3D.FadeScale` | Fade the particle scale from/to 0.0.

SortMode : enumeration

Defines the sorting mode of the particle. The sorting mode determines the order in which the particles are drawn.

Constant | Description
--- | ---
`Particle3D.SortNone` | No sorting.
`Particle3D.SortNewest` | Sort based on particle lifetime, newest first.
`Particle3D.SortOldest` | Sort based on particle lifetime, oldest first.
`Particle3D.SortDistance` | Sort based on distance to the camera, farthest first.

alignMode : AlignMode

This property defines the align mode used for the particles. Particle alignment means the direction that particles face.

Note: When the SpriteParticle3D billboard property is set to `true`, alignMode does not have an effect.

The default value is `Particle3D.AlignNone`.

See also alignTargetPosition.

alignTargetPosition : vector3d

This property defines the position particles are aligned to. This property has effect only when the alignMode is set to `Particle3D.AlignTowardsTarget`.

See also alignMode.

color : color

This property defines the base color that is used for colorizing the particles.

The default value is `"#FFFFFF"` (white).

colorVariation : vector4d

This property defines the color variation that is used for colorizing the particles. The values are in RGBA order and each value should be between 0.0 (no variation) and 1.0 (full variation).

For example, to create particles which will have translucent red colors between `#ff0000` and `#e50000`, with 40% to 60% opacity:

     ModelParticle3D {
         ...
         color: "#7fff0000"
         colorVariation: Qt.vector4d(0.1, 0.0, 0.0, 0.2)
     }

The default value is `(0, 0, 0, 0)` (no variation).

See also unifiedColorVariation.

fadeInDuration : int

This property defines the duration in milliseconds for the fading in effect.

Note: The fading durations are part of the particles lifeSpan. So e.g. if `lifeSpan` is 3000, `fadeInDuration` is 500 and `fadeOutDuration` is 500, the fully visible time of the particle is 2000ms.

The default value is `250`.

See also fadeInEffect and fadeOutDuration.

fadeInEffect : FadeType

This property defines the fading effect used when the particles appear.

The default value is `Particle3D.FadeOpacity`.

See also fadeInDuration and fadeOutEffect.

fadeOutDuration : int

This property defines the duration in milliseconds for the fading out effect.

The default value is `250`.

See also fadeOutEffect and fadeInDuration.

fadeOutEffect : FadeType

This property defines the fading effect used when the particles reach their lifeSpan and disappear.

The default value is `Particle3D.FadeOpacity`.

See also fadeOutDuration and fadeInEffect.

hasTransparency : bool

This property defines if the particle has any transparency and should be blended with the background. Usually this should be true, like when the particle color doesn't have full alpha, texture contains semi-transparent pixels or particles opacity is faded in or out. Setting this to false can be an optimization in specific cases.

The default value is `true`.

See also color, fadeInEffect, and fadeOutEffect.

maxAmount : int

This property defines the maximum amount of particles that can exist at the same time. You can use particlesUsed for debugging how efficiently the allocated particles are used. If the maxAmount is too small, particles are reused before they reach the end of their lifeSpan. If the maxAmount is too big, unnecessary memory is allocated for the particles.

Note: Changing the maxAmount resets all the particles in the particle system.

The default value is `100`.

sortMode : SortMode

This property defines the sort mode used for the particles.

The default value is `Particle3D.SortNone`.

unifiedColorVariation : bool

This property defines if the colorVariation should be applied uniformly for all the color channels. This means that all variations are applied with the same random amount.

For example, to create particles which will have yellow colors between `#ffff00` and `#7f7f00`, so that the values of `R` and `G` color channels are always the same:

     ModelParticle3D {
         ...
         color: "#ffff00"
         colorVariation: Qt.vector4d(0.5, 0.5, 0.0, 0.0)
         unifiedColorVariation: true
     }

The default value is `false`.

See also colorVariation.