← Pixel Dreamer Studio

Fire or dust over a whole building

Extents are half the size. Amount has to grow with the floor area.

Set emission_box_extents to half the building's size, because it is measured from the middle of the box. In our Godot 4.7 test, extents of 4 for a 4 m building spread the particles from -3.94 to 3.94 m, twice too wide; the script below, given the 4 m size, kept them between -1.96 and 1.96 m. It also sets amount from the floor area, so a 6 m building is as dense as a 2 m one instead of ten times thinner.

Left: flames floating around and beyond a building's roof. Right: flames only on the roof
Godot 4.7 with the Compatibility renderer, a 4 x 4 m building with fire on its roof. Left: emission_box_extents of 4. Right: the script with a size of 4.

The code

Attach this script to your GPUParticles3D, keep its ParticleProcessMaterial, put the node at the middle of the building's base or roof and set size to the building's full width, a thin height band, and its depth. per_square_metre is how many particles are alive at once on each square metre.

extends GPUParticles3D
## Covers a building's footprint with fire, dust or smoke at the same density for any building size.
## Attach to your GPUParticles3D, put the node at the middle of the building's base and set "size".

@export var size := Vector3(4.0, 0.3, 4.0):  ## full width, height and depth in metres
	set(v):
		size = v
		fit()
@export var per_square_metre := 3.0:  ## particles alive at once on each square metre
	set(v):
		per_square_metre = v
		fit()


func _ready() -> void:
	fit()


func fit() -> void:
	var pm := process_material as ParticleProcessMaterial
	if pm == null:
		return
	pm.emission_shape = ParticleProcessMaterial.EMISSION_SHAPE_BOX
	pm.emission_box_extents = size * 0.5  # extents are half the size, measured from the middle
	amount = maxi(1, roundi(per_square_metre * size.x * size.z))

What we measured

Particles that do not move, seen from straight above with an orthographic camera, so every one stays where it was emitted. We measured how far left and right they reached, and counted the lit pixels for the density. Two runs gave the same numbers.

Why the density drops

amount is the number of particles alive at the same time, not a number per square metre. Spread the same 12 over a footprint 9 times bigger and each square metre gets about a ninth of them. The script multiplies per_square_metre by the width and the depth, so the fire looks the same on a hut and on a warehouse.

What to change

Ready-made building effects to try it with: City Builder VFX Demo for Godot 4 has 3 presets, Scaffold Dust, Build Complete Gold and a retro PSX Building Fire, each a single scene you drop at the base of a building.

Tested in Godot 4.7 with the Compatibility renderer.

Ready-made: City Builder & Construction VFX has 31 presets, including foundation, upgrade, demolish, chimney smoke, coins, zones and 8 PSX versions.

More how-tos: Fire, smoke and explosions