← Pixel Dreamer Studio

Steam that turns to black smoke when the food burns

Two emitters and amount_ratio, so only the new puffs change.

Setting a new color on the steam's process_material also recolors the steam already in the air: in our Godot 4.7 test, the whole column had turned dark 0.3 seconds later (618 white pixels before, 0 after). Changing amount is worse, it restarts the emitter and every puff vanished on the next frame. Use two emitters, white steam and dark smoke, and move amount_ratio from one to the other. The steam already rising finished its life as steam while the new puffs came out black.

Three dark pots on a counter: white steam over the left one, white and black puffs mixed over the middle one, a black smoke cloud over the right one
Godot 4.7 with the Compatibility renderer. The same script with burn at 0.0, 0.5 and 1.0, left to right.

The code

Put this Node3D on top of your pot and set burn from your cooking timer: 0.0 while the food cooks, 1.0 once it is burnt. It builds both emitters in _ready(), with no texture files. Each pot gets its own emitters, so burning one pot leaves the others alone, as in the picture above.

extends Node3D
## Steam over a pot that turns grey, then black, as the food burns.
## Put this node on top of the pot and set "burn" from your cooking timer: 0.0 = cooking, 1.0 = burnt.
## Two emitters, white steam and dark smoke, so puffs already in the air keep their color.

@export_range(0.0, 1.0) var burn := 0.0:
	set(v):
		burn = clampf(v, 0.0, 1.0)
		_apply()

var _steam: GPUParticles3D
var _smoke: GPUParticles3D


func _ready() -> void:
	_steam = _emitter(32, 1.6, 0.9, 0.5, Color(1.0, 1.0, 1.0, 0.6))
	_smoke = _emitter(32, 2.4, 0.6, 0.8, Color(0.08, 0.07, 0.06, 0.9))
	_apply()


func _apply() -> void:
	if not _steam:
		return
	# amount_ratio emits fewer of the emitter's particles without restarting it,
	# so the puffs already in the air finish their life as they are
	_steam.amount_ratio = 1.0 - burn
	_smoke.amount_ratio = burn


func _emitter(amount: int, life: float, speed: float, size: float, color: Color) -> GPUParticles3D:
	var fx := GPUParticles3D.new()
	fx.amount = amount
	fx.lifetime = life
	fx.visibility_aabb = AABB(Vector3(-2, -0.5, -2), Vector3(4, 5, 4))
	var p := ParticleProcessMaterial.new()
	p.emission_shape = ParticleProcessMaterial.EMISSION_SHAPE_SPHERE
	p.emission_sphere_radius = 0.2
	p.direction = Vector3.UP
	p.spread = 10.0
	p.initial_velocity_min = speed * 0.8
	p.initial_velocity_max = speed * 1.2
	p.gravity = Vector3.ZERO
	p.color = color
	p.color_ramp = _fade()
	p.scale_curve = _grow()
	fx.process_material = p
	fx.draw_pass_1 = _quad(size)
	add_child(fx)
	return fx


func _fade() -> GradientTexture1D:
	var g := Gradient.new()
	g.offsets = PackedFloat32Array([0.0, 0.2, 1.0])
	g.colors = PackedColorArray([Color(1, 1, 1, 0), Color(1, 1, 1, 1), Color(1, 1, 1, 0)])
	var t := GradientTexture1D.new()
	t.gradient = g
	return t


func _grow() -> CurveTexture:
	var c := Curve.new()
	c.add_point(Vector2(0.0, 0.4))
	c.add_point(Vector2(1.0, 1.0))
	var t := CurveTexture.new()
	t.curve = c
	return t


func _quad(size: float) -> QuadMesh:
	var g := Gradient.new()
	g.colors = PackedColorArray([Color(1, 1, 1, 1), Color(1, 1, 1, 0)])
	var soft := GradientTexture2D.new()
	soft.gradient = g
	soft.fill = GradientTexture2D.FILL_RADIAL
	soft.fill_from = Vector2(0.5, 0.5)
	soft.fill_to = Vector2(1.0, 0.5)
	var mat := StandardMaterial3D.new()
	mat.shading_mode = BaseMaterial3D.SHADING_MODE_UNSHADED
	mat.transparency = BaseMaterial3D.TRANSPARENCY_ALPHA
	mat.billboard_mode = BaseMaterial3D.BILLBOARD_PARTICLES
	mat.vertex_color_use_as_albedo = true  # without this the color and the fade above are ignored
	mat.albedo_texture = soft
	var q := QuadMesh.new()
	q.size = Vector2(size, size)
	q.material = mat
	return q

What we measured

A mid-grey background (0.45). In each frame we counted white pixels (average of red, green and blue above 0.6) and dark pixels (below 0.3), checking every second pixel in each direction. The puffs are random, so a second run gave slightly different counts with the same pattern.

Why amount_ratio and not color

As the test shows, the color in a ParticleProcessMaterial is applied to every living particle, not stored when each particle is born. That is why the old puffs changed. amount_ratio only says how many of the emitter's particles to use. Changing it does not restart the emitter, so the puffs already out keep going, and each emitter keeps one color, so nothing in the air ever changes color.

What to change

Ready-made kitchen effects: Cooking & Kitchen VFX for Godot 4 has 23 presets, including Pot Boil, Pan Sizzle, Burnt Smoke, Pan Fire and a Fire Extinguisher, each in Stylized and Retro PSX.

Tested in Godot 4.7 with the Compatibility renderer.

Ready-made: Cooking & Kitchen VFX for Godot 4 has 23 ready-made kitchen effects, including Pot Boil, Pan Sizzle, Burnt Smoke, Pan Fire and a Fire Extinguisher, in Stylized and Retro PSX looks.

More how-tos for Cooking & Kitchen VFX for Godot 4: Make a cooking timer fire once, on time · A countdown that never shows 0 while time is left

More how-tos: Fire, smoke and explosions