DOCS // pyrofx

Model-shaped emitters and obstacles

Use a model as an emitter surface or volume, or as an obstacle that gas flows around. OBJ, GLB and glTF shapes are supported.

Contents3 sections
  1. Shape settings
  2. Burning wreck
  3. Questions

Shape settings

Set shape = "mesh" and mesh to a model beside the spec. mesh_scale scales it and mesh_origin places its origin. mesh_emit = "surface" emits in a layer controlled by thickness_m; "volume" needs a closed model.

For an obstacle, hollow = true keeps a wall about two cells thick and leaves the inside open to gas. The report records each model file with its hash.

KeyDefaultMeaning
emitters.thickness_m0.0Half thickness of a disc or ring, or of the layer a mesh emits from at its surface. 0 picks a fifth of the radius for a disc, a quarter for a ring and one and a half cells for a mesh.
emitters.mesh""The model file for shape = "mesh": an .obj, .glb or .gltf beside the spec file or in a folder under it. Any triangles will do; they need not be closed.
emitters.mesh_scale1.0Metres for one unit of the model. Keys over time grow or shrink it.
emitters.mesh_origin"model"The point of the model that position_m places and rotation_deg turns about. model: the model's own origin. centre: the centre of the box around it. base: the centre of that box's underside, so position_m is where it stands.
emitters.mesh_emit"surface"surface: from a layer thickness_m to each side of the model's surface. volume: from all of its inside, which needs a closed model.
obstacles.mesh""The model file for shape = "mesh": an .obj, .glb or .gltf beside the spec file or in a folder under it. A closed model is solid all through. A surface with no inside, or a part thinner than a cell, is a wall one cell thick that gas cannot pass.
obstacles.mesh_scale1.0Metres for one unit of the model. Keys over time grow or shrink it, and it pushes the gas as it does.
obstacles.mesh_origin"model"The point of the model that position_m places and rotation_deg turns about. model: the model's own origin. centre: the centre of the box around it. base: the centre of that box's underside, so position_m is where it stands.
obstacles.hollowfalseKeeps only the surface of a mesh, as a wall about two cells thick, and leaves its inside open to gas: a barrel, a room, a pipe.

Burning wreck

The same hull shapes the solid obstacle and the fire on its skin. Your engine draws the visible model.

# A knocked-out tank on fire: flame on its hull and smoke that goes around it. Loops.
# The tank is a 3D model (models/wreck.obj, written by scripts/make_wreck.py) used twice: as the
# solid the gas flows around, and as the shape the fire sits on. In the game the engine draws the
# real model; the bake only needs its shape, and holds out the gas that is behind it.
[meta]
name = "burning_wreck"
notes = "A burning vehicle wreck from a 3D model, looping"

[domain]
size_m = [8, 6, 6]
voxel_m = 0.05
duration_s = 2.0

# The wreck as a solid, standing on the ground.
[[obstacles]]
shape = "mesh"
mesh = "models/wreck.obj"
mesh_origin = "base"
position_m = [0, 0, 0]

# The fire: the same model, burning from a layer at its surface. High lumpiness breaks it into
# patches, so the hull burns in places and not as one even skin.
[[emitters]]
shape = "mesh"
mesh = "models/wreck.obj"
mesh_origin = "base"
mesh_emit = "surface"
position_m = [0, 0, 0]
thickness_m = 0.1
start_s = 0.0
end_s = 1000
fuel = 1.2
temperature_k = 1400
smoke = 0.6
velocity_mps = 0.6
direction = "up"
jitter = 0.6
lumpiness = 1.0
lump_size_m = 0.7

# air_limit: at 0.88 fuel from so large a surface gathers faster than it burns and the fire is still
# growing 7 s in, so the loop pumps; at 0.6 it is steady within 1.5 s.
[solver]
air_limit = 0.6
burn_rate = 12
cooling = 2.5
soot = 1.0
smoke_fade = 3.0
drag = 1.5
swirl = 0.8
turbulence = 0.7
turbulence_size_m = 0.5

[look]
exposure = 1.9
smoke_density = 0.7

[export]
loop = true
loop_blend_frames = 12
warmup_s = 3.0

Questions

Which 3D model formats can pyrofx load for mesh emitters and obstacles?

pyrofx accepts .obj, .glb or .gltf files placed beside the spec file or in a subfolder under it.

How does pyrofx emit fire from a 3D model surface?

Set shape to mesh and mesh_emit to surface to emit from a layer controlled by thickness_m around the model skin.

How do you keep the inside of a mesh obstacle open to gas in pyrofx?

Set hollow to true on the obstacle so pyrofx keeps a wall about two cells thick and leaves the interior open.