VolumeSequence.component
This package holds more than this page lists. See all of its files in its world.
README.md
VolumeSequence
Plays an open volume sequence through an entity's transform AABB.
The sequence is opened by a producer and named here — the same split the
Volume component makes between "what data to render" and "where it appears
in the world". Each tick the component advances the playhead and stands the
frame that is resident in the scene as a draw of the volume module, in both
play and edit mode, so the run animates while it is being authored. The frame
marches the draw for every view it draws, against that view's camera and its
depth, so geometry in front of the run hides it. Disabling the component takes
the draw down.
local Seq = require("@builtin::systems.volumetrics.volumeSequence")
Seq.open({ name = "plume", frames = paths, resident = 3, fps = 24 })
local id = entity.spawn("plume_entity").id
entity(id).localScale = { 8, 8, 8 }
entity(id).component.add("VolumeSequence", { sequenceName = "plume", density = 6.0 })
quality is the level the march takes stepSize and maxSteps at, as on
Volume: auto (the default) follows the device's quality tier and moves
with renderer.setQualityTier, and low, medium or high holds that level
on every device (the graphics-quality guide lists what each level draws).
scattering, anisotropy, flame, flameTemperature, shadowSteps and
lights light the run as they light a Volume: scattering above 0 lets the
scene's sun, ambient term and nearby lights light it with a shadow of its own,
and flame makes a density run's temperature channel glow along a blackbody
ramp, so a smoke or explosion cache reads lit and burning.
lightResponse names a .shaderModule that draws the run in a style instead
of the engine's own light (toon bands, a palette, a hard silhouette, flames in
flat bands), with up to sixteen numbers in lightResponseParams, as on
Volume; @builtin::systems.volumetrics.shaders.medium_light's README states
what a response defines.
fps and playing are pushed into the sequence when they change, so a
script calling seq:setFps() / seq:pause() between two ticks is left
standing until the authored value itself moves.
The component does not own the sequence: despawning the entity leaves the
ring allocated, and volumeSequence.close(name) is what frees it.
Sharing
The playhead, the rate and the ring belong to the sequence, so several
entities naming one run play the same frame from the same three textures:
the playhead advances once per engine frame however many components tick it,
and the rate is whichever component's fps moved last. Give each entity its
own run when they should play independently.
Each component stands a draw of its own, so a run beside a Volume, or two
runs, are all drawn, the nearer laid over the further.