← Pixel Dreamer Studio

Particles look black or dark

The material is lit by the scene. Sparks and magic do not need that.

A new StandardMaterial3D has shading_mode on Per-Pixel, so the scene's lights decide how bright each particle is. In a dark scene, or with the sun behind the particles, they turned black in our test, because the side of a particle you see faces the camera, away from that light. For sparks, fire and magic, set shading_mode to Unshaded (Shading, Shading Mode in the Inspector): the particles then show exactly the color you set.

Two fountains of small square particles on a pale blue background. The left ones are a dull dark blue. The right ones are bright light blue
The script below in Godot 4.7 with the Compatibility renderer, with the sun behind the particles. Left: Shading Mode left at Per-Pixel. Right: the script as written, Unshaded.

The code

Attach this to a GPUParticles3D for a fountain of light blue sparks. The shading_mode line is the fix.

extends GPUParticles3D
## Magic sparks that keep their color in a dark scene, or with the sun behind them.
## A new StandardMaterial3D is lit by the lights in the scene. Unshaded ignores them.


func _ready() -> void:
	amount = 30
	lifetime = 1.5
	var m := ParticleProcessMaterial.new()
	m.direction = Vector3.UP
	m.spread = 30.0
	m.initial_velocity_min = 0.8
	m.initial_velocity_max = 1.4
	m.gravity = Vector3(0, -0.5, 0)
	process_material = m
	var mat := StandardMaterial3D.new()
	mat.shading_mode = BaseMaterial3D.SHADING_MODE_UNSHADED  # the fix: the color you set is the color you see
	mat.billboard_mode = BaseMaterial3D.BILLBOARD_PARTICLES
	mat.albedo_color = Color(0.4, 0.8, 1.0)
	var q := QuadMesh.new()
	q.size = Vector2(0.1, 0.1)
	q.material = mat
	draw_pass_1 = q

What we measured

One particle that does not move, in the middle of the screen, set to the color 0.40/0.80/1.00 (red/green/blue from 0 to 1). We read the color in the middle of it, with a sun light in different places. Two runs gave the same numbers.

Smoke that should take the light

Smoke and dust look better lit by the scene, so Unshaded is not always what you want. Keep Per-Pixel and turn on backlight_enabled with a backlight color: light from behind then comes through the particle. With the sun behind and backlight at 0.6 grey, the particle read 0.31/0.64/0.80 instead of black. It works in the Compatibility renderer too.

What to change

Sparks that also glow: glowing particles. Particles that do not show at all: GPUParticles3D not showing. Soft smoke on the ground: soft particles with Proximity Fade.

Tested in Godot 4.7 with the Compatibility renderer.

More how-tos: When particles do not show up