Log inGet started
Package

fluidSim.package

Newest version

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

README.md

fluid

Creates and drives grid fluid simulations.

create allocates the grid; the returned handle carries addSource, addForce, step, velocityTexture, destroy, and densityTexture.

Cost and memory are set by resolution alone. A 64³ grid holds seven fields — four rgba16f and three r32f — and every field ping-pongs between two textures, because a kernel reads its input while writing a storage texture and one texture cannot be both in a single dispatch.

Advection samples velocity and density between voxels along its backtrace. Every other read is one texel fetch at a voxel, a neighbour past the grid read at the edge voxel, so the r32f pressure and divergence bind on a device that cannot filter 32-bit floats.

iterations sets how many Jacobi passes converge the pressure solve. Fewer leaves the fluid slightly compressible, which reads as damped, mushy motion.

A step is one compute list run (compute.list / compute.runList): the five kernels and every pressure iteration are registered once per simulation, as two lists for the two velocity textures a step can start from, and step queues the whole solver with one call. The params block is written only when a value in it changes, and the emitter buffer only when the step carries emitters.