Log inGet started
Package

plume.module

Newest version

This package holds more than this page lists. See all of its files in its world.

README.md

plume

Smoke and fire from a script: a chimney's smoke, steam, a smoulder, a black column over a big fire, smoke signals, a campfire, a torch, a bonfire, a building on fire and an explosion's fireball. A plume writes its smoke (density) and flames (temperature) into a 3D texture once for each frame the scene draws, and stands it in the scene through Volume:draw, where the scene's sun, ambient term and nearby point, spot and rect lights light the smoke with a shadow of its own, and the flames glow along a blackbody ramp. The Smoke and Fire components each hold one; use the module directly to drive a plume from a script you already have (a moving vehicle's exhaust, a scripted sequence).

local plume = require("@builtin::systems.volumetrics.plume")
local p = plume.create({ style = "campfire" })
local key = plume.drawKey("myFire")

-- every frame:
p:step(dt, { x, y, z })   -- the source, where it reads the scene's wind
p:draw(key, { x, y, z }, entity(id))

-- when done:
p:destroy()

Exports

  • plume.STYLES: every style by name, each with about, its size in metres, its climb, colour, flames and light.
  • plume.styles() -> { string }: the style names, sorted.
  • plume.LEVELS: the voxels across the box each quality level holds; the march takes the volume's levels (Volume.LEVELS).
  • plume.create(opts) -> Plume: style, height, radius, density, color, flame, smoke, speed, wind ({ x, z } metres the top drifts), sceneWind (how far the scene's wind carries it, default 1), seed, quality.
  • plume.drawKey(prefix, id?) -> string: a key for draw.
  • plume.optsOf(fields) -> opts: the options a Smoke or Fire component's fields state.
  • p:set(opts), p:step(dt, origin?) (with the source, the plume leans with the scene's wind there: Physics.wind), p:draw(key, origin, entity), p:withdraw(), p:ignite() (a burst again), p:ended(), p:stats(), p:destroy().