Builtin Library
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 raymarches
the frame that is resident into the shared scene_volume_rt target, in both
play and edit mode, so the run animates while it is being authored.
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 })
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.
target is a render target, and a raymarch writes the whole of it — two
volumes visible at once (a sequence beside a Volume, or two sequences) need
a target name each, or the later write replaces the earlier one and only
one of them appears. Composite each target the way any volume render is
composited — see volume.compositeShaderSource().