Class reference

ParticleProcessMaterial

Inherits Material

Holds a particle configuration for GPUParticles2D or GPUParticles3D nodes.

Description

ParticleProcessMaterial defines particle properties and behavior. It is used in the process_material of the GPUParticles2D and GPUParticles3D nodes. Some of this material's properties are applied to each particle when emitted, while others can have a CurveTexture or a GradientTexture1D applied to vary numerical or color values over the lifetime of the particle.

Properties

Texture2D angular_velocity_curve

Each particle's angular velocity (rotation speed) will vary along this CurveTexture over its lifetime.

float anim_speed_max = 0.0

Maximum particle animation speed. Animation speed of 1 means that the particles will make full 0 to 1 offset cycle during lifetime, 2 means 2 cycles etc. With animation speed greater than 1, remember to enable CanvasItemMaterial.particles_anim_loop property if you want the animation to repeat.

float damping_max = 0.0

The maximum rate at which particles lose velocity. For example value of 100 means that the particle will go from 100 velocity to 0 in 1 second.

Vector3 direction = Vector3(1, 0, 0)

Unit vector specifying the particles' emission direction.

Texture2D directional_velocity_curve

A curve that specifies the velocity along each of the axes of the particle system along its lifetime. Note: Animated velocities will not be affected by damping, use velocity_limit_curve instead.

Texture2D emission_normal_texture

Particle velocity and rotation will be set by sampling this texture at the same point as the emission_point_texture. Used only in EMISSION_SHAPE_DIRECTED_POINTS. Can be created automatically from mesh or node by selecting "Create Emission Points from Mesh/Node" under the "Particles" tool in the toolbar.

Texture2D emission_point_texture

Particles will be emitted at positions determined by sampling this texture at a random position. Used with EMISSION_SHAPE_POINTS and EMISSION_SHAPE_DIRECTED_POINTS. Can be created automatically from mesh or node by selecting "Create Emission Points from Mesh/Node" under the "Particles" tool in the toolbar.

float emission_ring_cone_angle

The angle of the cone when using the emitter EMISSION_SHAPE_RING. The default angle of 90 degrees results in a ring, while an angle of 0 degrees results in a cone. Intermediate values will result in a ring where one end is larger than the other. Note: Depending on emission_ring_height, the angle may be clamped if the ring's end is reached to form a perfect cone.

int emission_shape = 0

Particles will be emitted inside this region.

Vector3 gravity = Vector3(0, -9.8, 0)

Gravity applied to every particle.

float hue_variation_max = 0.0

Maximum initial hue variation applied to each particle. It will shift the particle color's hue.

float initial_velocity_max = 0.0

Maximum initial velocity magnitude for each particle. Direction comes from direction and spread.

float lifetime_randomness = 0.0

Particle lifetime randomness ratio. The equation for the lifetime of a particle is lifetime * (1.0 - randf() * lifetime_randomness). For example, a lifetime_randomness of 0.4 scales the lifetime between 0.6 to 1.0 of its original value.

float linear_accel_max = 0.0

Maximum linear acceleration applied to each particle in the direction of motion.

float orbit_velocity_max = 0.0

Maximum orbital velocity applied to each particle. Makes the particles circle around origin. Specified in number of full rotations around origin per second. Note: Animated velocities will not be affected by damping, use velocity_limit_curve instead.

bool particle_flag_align_y = false

Align Y axis of particle with the direction of its velocity.

bool particle_flag_damping_as_friction = false

Changes the behavior of the damping properties from a linear deceleration to a deceleration based on speed percentage.

bool particle_flag_disable_z = false

If true, particles will not move on the z axis.

bool particle_flag_rotate_y = false

If true, particles rotate around Y axis by angle_min.

float radial_accel_max = 0.0

Maximum radial acceleration applied to each particle. Makes particle accelerate away from the origin or towards it if negative.

float radial_velocity_max = 0.0

Maximum radial velocity applied to each particle. Makes particles move away from the velocity_pivot, or toward it if negative. Note: Animated velocities will not be affected by damping, use velocity_limit_curve instead.

float radial_velocity_min = 0.0

Minimum radial velocity applied to each particle. Makes particles move away from the velocity_pivot, or toward it if negative. Note: Animated velocities will not be affected by damping, use velocity_limit_curve instead.

float scale_max = 1.0

Maximum initial scale applied to each particle.

float spread = 45.0

Each particle's initial direction range from +spread to -spread degrees.

int sub_emitter_amount_at_collision

The amount of particles to spawn from the subemitter node when a collision occurs. When combined with COLLISION_HIDE_ON_CONTACT on the main particles material, this can be used to achieve effects such as raindrops hitting the ground. Note: This value shouldn't exceed GPUParticles2D.amount or GPUParticles3D.amount defined on the subemitter node (not the main node), relative to the subemitter's particle lifetime. If the number of particles is exceeded, no new particles will spawn from the subemitter until enough particles have expired.

int sub_emitter_amount_at_end

The amount of particles to spawn from the subemitter node when the particle expires. Note: This value shouldn't exceed GPUParticles2D.amount or GPUParticles3D.amount defined on the subemitter node (not the main node), relative to the subemitter's particle lifetime. If the number of particles is exceeded, no new particles will spawn from the subemitter until enough particles have expired.

int sub_emitter_amount_at_start

The amount of particles to spawn from the subemitter node when the particle spawns. Note: This value shouldn't exceed GPUParticles2D.amount or GPUParticles3D.amount defined on the subemitter node (not the main node), relative to the subemitter's particle lifetime. If the number of particles is exceeded, no new particles will spawn from the subemitter until enough particles have expired.

float sub_emitter_frequency

The frequency at which particles should be emitted from the subemitter node. One particle will be spawned every sub_emitter_frequency seconds. Note: This value shouldn't exceed GPUParticles2D.amount or GPUParticles3D.amount defined on the subemitter node (not the main node), relative to the subemitter's particle lifetime. If the number of particles is exceeded, no new particles will spawn from the subemitter until enough particles have expired.

bool sub_emitter_keep_velocity = false

If true, the subemitter inherits the parent particle's velocity when it spawns.

Texture2D tangential_accel_curve

Each particle's tangential acceleration will vary along this CurveTexture.

float tangential_accel_max = 0.0

Maximum tangential acceleration applied to each particle. Tangential acceleration is perpendicular to the particle's velocity giving the particles a swirling motion.

bool turbulence_enabled = false

If true, enables turbulence for the particle system. Turbulence can be used to vary particle movement according to its position (based on a 3D noise pattern). In 3D, GPUParticlesAttractorVectorField3D with NoiseTexture3D can be used as an alternative to turbulence that works in world space and with multiple particle systems reacting in the same way. Note: Enabling turbulence has a high performance cost on the GPU. Only enable turbulence on a few particle systems at once at most, and consider disabling it when targeting mobile/web platforms.

Texture2D turbulence_influence_over_life

Each particle's amount of turbulence will be influenced along this CurveTexture over its life time.

float turbulence_noise_scale = 9.0

This value controls the overall scale/frequency of the turbulence noise pattern. A small scale will result in smaller features with more detail while a high scale will result in smoother noise with larger features.

Vector3 turbulence_noise_speed = Vector3(0, 0, 0)

A scrolling velocity for the turbulence field. This sets a directional trend for the pattern to move in over time. The default value of Vector3(0, 0, 0) turns off the scrolling.

float turbulence_noise_speed_random = 0.2

The in-place rate of change of the turbulence field. This defines how quickly the noise pattern varies over time. A value of 0.0 will result in a fixed pattern.

float turbulence_noise_strength = 1.0

The turbulence noise strength. Increasing this will result in a stronger, more contrasting, flow pattern.

Texture2D velocity_limit_curve

A CurveTexture that defines the maximum velocity of a particle during its lifetime.

Vector3 velocity_pivot = Vector3(0, 0, 0)

A pivot point used to calculate radial and orbital velocity of particles.

Methods

Vector2 get_param(int param) const

Returns the minimum and maximum values of the given param as a vector. The x component of the returned vector corresponds to minimum and the y component corresponds to maximum.

float get_param_max(int param) const

Returns the maximum value range for the given parameter.

float get_param_min(int param) const

Returns the minimum value range for the given parameter.

bool get_particle_flag(int particle_flag) const

Returns true if the specified particle flag is enabled.

void set_param(int param, Vector2 value)

Sets the minimum and maximum values of the given param. The x component of the argument vector corresponds to minimum and the y component corresponds to maximum.

void set_param_max(int param, float value)

Sets the maximum value range for the given parameter.

void set_param_min(int param, float value)

Sets the minimum value range for the given parameter.

void set_particle_flag(int particle_flag, bool enable)

Sets the particle_flag to enable.

Signals

emission_shape_changed()

Emitted when this material's emission shape is changed in any way. This includes changes to emission_shape, emission_shape_scale, or emission_sphere_radius, and any other property that affects the emission shape's offset, size, scale, or orientation. Note: This signal is only emitted inside the editor for performance reasons.

Constants

PARAM_MAX = 18

Enum: Parameter

Represents the size of the Parameter enum.

PARTICLE_FLAG_DAMPING_AS_FRICTION = 3

Enum: ParticleFlags

PARTICLE_FLAG_MAX = 4

Enum: ParticleFlags

Represents the size of the ParticleFlags enum.

EMISSION_SHAPE_POINT = 0

Enum: EmissionShape

All particles will be emitted from a single point.

EMISSION_SHAPE_SPHERE = 1

Enum: EmissionShape

Particles will be emitted in the volume of a sphere.

EMISSION_SHAPE_SPHERE_SURFACE = 2

Enum: EmissionShape

Particles will be emitted on the surface of a sphere.

EMISSION_SHAPE_BOX = 3

Enum: EmissionShape

Particles will be emitted in the volume of a box.

EMISSION_SHAPE_RING = 6

Enum: EmissionShape

Particles will be emitted in a ring or cylinder.

EMISSION_SHAPE_MAX = 7

Enum: EmissionShape

Represents the size of the EmissionShape enum.

PARAM_TURB_VEL_INFLUENCE = 13

Enum: Parameter

Use with set_param_min() and set_param_max() to set the turbulence minimum und maximum influence on each particles velocity.

PARAM_TURB_INIT_DISPLACEMENT = 14

Enum: Parameter

Use with set_param_min() and set_param_max() to set the turbulence minimum and maximum displacement of the particles spawn position.

PARAM_TURB_INFLUENCE_OVER_LIFE = 12

Enum: Parameter

Use with set_param_texture() to set the turbulence influence over the particles life time.

SUB_EMITTER_DISABLED = 0

Enum: SubEmitterMode

SUB_EMITTER_CONSTANT = 1

Enum: SubEmitterMode

SUB_EMITTER_AT_END = 2

Enum: SubEmitterMode

SUB_EMITTER_AT_COLLISION = 3

Enum: SubEmitterMode

SUB_EMITTER_AT_START = 4

Enum: SubEmitterMode

SUB_EMITTER_MAX = 5

Enum: SubEmitterMode

Represents the size of the SubEmitterMode enum.

COLLISION_DISABLED = 0

Enum: CollisionMode

No collision for particles. Particles will go through GPUParticlesCollision3D nodes.

COLLISION_HIDE_ON_CONTACT = 2

Enum: CollisionMode

Hide particles instantly when colliding with a GPUParticlesCollision3D node. This can be combined with a subemitter that uses the COLLISION_RIGID collision mode to "replace" the parent particle with the subemitter on impact.

COLLISION_MAX = 3

Enum: CollisionMode

Represents the size of the CollisionMode enum.

Source revision 4f5b14abade2
Connection interrupted. Reload×

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please retry or reload the page.