← Pixel Dreamer Studio

Particles all disappear at once

Lifetime Randomness gives each particle its own, shorter life.

Every particle in a GPUParticles3D lives for exactly lifetime seconds. In a burst they are all born in the same frame, so they all go in the same frame too. Set lifetime_randomness on the ParticleProcessMaterial: at 0.7, each particle lives between 30% and 100% of the lifetime, and the burst thins out instead of popping off.

Two bursts of small orange squares. The left burst is dense, the right one has far fewer squares left
The script below in Godot 4.7 with the Compatibility renderer, 1.3 seconds after both bursts started. Left: Lifetime Randomness 0. Right: the script as written, 0.7. An orthographic camera.

The code

Attach this to a GPUParticles3D for a burst of embers that thins out over time. Call restart() to play it again. The lifetime_randomness line is the fix.

extends GPUParticles3D
## A one-shot burst of embers that thins out over time instead of
## vanishing in a single frame. Call restart() to play it again.


func _ready() -> void:
	amount = 60
	lifetime = 1.6
	one_shot = true
	explosiveness = 1.0
	var m := ParticleProcessMaterial.new()
	m.lifetime_randomness = 0.7  # the fix: each one lives between 30% and 100% of lifetime
	m.direction = Vector3.UP
	m.spread = 70.0
	m.initial_velocity_min = 1.5
	m.initial_velocity_max = 3.5
	m.gravity = Vector3(0, -3, 0)
	m.damping_min = 1.0
	m.damping_max = 2.0
	process_material = m
	var mat := StandardMaterial3D.new()
	mat.shading_mode = BaseMaterial3D.SHADING_MODE_UNSHADED
	mat.billboard_mode = BaseMaterial3D.BILLBOARD_PARTICLES
	mat.albedo_color = Color(1.0, 0.6, 0.2)
	var q := QuadMesh.new()
	q.size = Vector2(0.08, 0.08)
	q.material = mat
	draw_pass_1 = q
	emitting = true

What we measured

We started a burst of 60 particles with a 1.6 second lifetime and counted the lit points on screen, every second pixel, at set times after the start. Two runs of each, after one warm-up run.

Nothing was missing at 0.45 seconds, just under 30% of the lifetime, and the last particles lived close to the full 1.6 seconds.

Lifetime is now the longest life

With Lifetime Randomness on, lifetime is how long the longest-lived particles last, not the average. If the burst now feels too short, raise the lifetime rather than lowering the randomness.

What to change

Fading each particle as it goes: particle color ramp not working. One burst for an explosion: explosion particles in one burst.

Tested in Godot 4.7 with the Compatibility renderer.

More how-tos: Fire, smoke and explosions