Builtin Library
readme.md
fluidSim
A grid-based fluid solver running entirely on the compute substrate.
fluid.module is the API: create a simulation over a world-space box, add
sources and forces, and step it. The five .computeShader assets beside it are
the solver — advection, emitter injection, divergence, a Jacobi pressure solve,
and projection.
The density field is a 3D texture, so volumetric rendering consumes it directly with no read-back.
local fluid = require("@builtin::systems.fluidSim.fluid")
local sim = fluid.create({
resolution = { 64, 64, 64 },
bounds = { min = { -2, 0, -2 }, max = { 2, 4, 2 } },
})
-- Each step, emit and advance.
sim:addSource({ position = { 0, 0.4, 0 }, radius = 0.08, density = 4, temperature = 30 })
sim:step(dt)
Emitters last one step, so a continuous plume re-adds its source each frame — which is also what lets emission follow a moving object.