Log inGet started
▣
module · drop-in viewer
asset⌬ modulemoduleprimary: init.luau·part ofpackage fluidSurface.package·originates fromworld 07158574-5…

fluidSurface

Screen-space fluid surfaces for GPU particle sims. Attach a named compute buffer of particle records (`fluidSurface.attach`) and the engine renders it as a continuous liquid every frame: splat passes rasterize every particle as a velocity-stretched billboard into depth / thicknes…

by◐lumi·posted 4mo ago
What it does

fluidSurface

Screen-space fluid surfaces for GPU particle sims. Attach a named compute buffer of particle records (fluidSurface.attach) and the engine renders it as a continuous liquid every frame: splat passes rasterize every particle as a velocity-stretched billboard into depth / thickness / color buffers, a separable narrow-range filter fuses particles into a smooth surface while keeping silhouettes crisp, and a post-process composite shades the result with scene-color refraction, Beer–Lambert absorption from the per-pixel liquid color, Fresnel sky pickup, sun specular, and a foam layer — depth-tested against the scene. Everything runs at a configurable fraction of the screen resolution and the particle data never leaves the GPU, so hundreds of thousands of particles render as fluid in a few milliseconds. update patches count/radius/sun/shading live; detach frees every resource the surface owns.

Interface

What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.

conforms to

zero/source-extract/v2

module fluidSurface Screen-space fluid surfaces for GPU particle sims: splat-rasterized depth/thickness/color, narrow-range depth filtering, and an HDR refraction/absorption/reflection composite that mirrors the scene in the water. Attach a buffer of particle records and the engine renders it as a continuous liquid: water, slime or lava, shaded as the engine does or in a style a shading `response` names (toon, painted, flat tones with a foam outline). require systems/fluidSurface/modules/fluidSurface

rtName(name: string, which: string) → string

argtypedescription
namestring
whichstring

bufferName(b: any) → string

The splat passes name the particle store the engine reads. A buffer handle carries the name it was created under, which is what a caller holding one passes here.

argtypedescription
bany

ensurePasses( ) → void

resolvePass(colored: boolean, foam: boolean) → any

argtypedescription
coloredboolean
foamboolean

compositeShader( ) → any

packParams(list: any) → void

The sixteen numbers a response is handed, from what a surface states: four `vec4`s `a`, `b`, `c`, `d`. Each table in `list` (up to four numbers, `{ r, g, b, a }` or `{ x, y, z, w }`) fills the next of the four, and each bare number the next of the sixteen; every number the list leaves out reads 0, so a colour of three numbers fills its `vec4`'s first three.

argtypedescription
listany

responseName(response: any, call: string) → string

The name a surface holds its `response` under: the text it names, or the guid of a resolved `.shaderModule` reference; "" for the engine's own shading.

argtypedescription
responseany
callstring

writeParams(composite: string, list: any) → void

argtypedescription
compositestring
listany

registerComposite(s: SurfaceState, includes: { [string]: string }?) → void

Register the surface's composite: the shader itself, or with `includes` the program in which the response stands in `fluid_physical`'s place.

argtypedescription
sSurfaceState
includes{ [string]: string }?

refuse(name: string, s: SurfaceState, reason: string) → void

A response that is not drawn: the surface draws the engine's own shading, and the reason is logged once for each response and reason.

argtypedescription
namestring
sSurfaceState
reasonstring

settleComposite(name: string, s: SurfaceState) → void

Bring the surface's composite up to what it names: the engine's own shading, or a program with its response in place, compiled again when the response, the composite or any module the program reaches is edited, and on every check while one of them has no token to go by.

argtypedescription
namestring
sSurfaceState

attach(name: string, spec: any) → any

Attach a fluid surface: the named particle buffer renders as a continuous liquid every frame until `detach`. `particles` describes the record layout of an f32 buffer — pass the handle a compute shader's `createBuffer` answered, or the name it carries. Options: `radius` (world particle radius, required), `stretch` (velocity-stretch seconds, default 0.03), `resolutionScale` (fluid buffers as a fraction of screen resolution, default 0.5), `fov` (vertical degrees of the viewing camera for the smoothing footprint, default 60), `smoothing` (world-space smoothing width, default 2.5 radii), `band` (filter depth band, default 1.5 radii), `iterations` (filter passes, default 1), `foamRadius` (foam sprite radius as a multiple of `radius`, default 1.6), `maxRadiusPx` (cap on a splat's projected pixel radius so near-camera particles stay droplet-sized, default 48), `shading` (composite property overrides — absorption, deep color, f0, specular, foam tint, sky tint, sun direction, and the reflection march: `ssr_int` blend, `ssr_dist` world reach, `ssr_thick` hit tolerance), `response` (the shading response the surface is drawn with: a `.shaderModule` that includes `@builtin::systems.fluidSurface.shaders.fluid_shading` and defines `fluid_shade`, named by identity, guid, `@root::` or `@builtin::` path or by its resolved reference; omitted, the engine's own shading) and `responseParams` (the sixteen numbers the response reads as `s.params`, four `vec4`s `a`, `b`, `c`, `d`: each table in the list, a colour `{ r, g, b, a? }` or up to four numbers, fills the next of the four, and each bare number the next of the sixteen; a number it leaves out reads 0). foam? }) for downstream sampling, or nil if the name is taken.

argtypedescription
namestringSurface identity (one composite + RT set per name).
specany{ particles, radius, stretch?, resolutionScale?, fov?, smoothing?, iterations?, shading?, response?, responseParams? }.

examples

fluidSurface.attach("lake", { particles = { buffer = "sim", stride = 16, posOffset = 0, count = 400000, velOffset = 4, colorOffset = 13 }, radius = 0.35 })

update(name: string, patch: any) → void

Update a live surface: particle `count`, `radius`, `sunDir` (world direction, projected for the composite), any `shading` composite property, the shading `response` (`""` returns the surface to the engine's own shading) and its `responseParams`. Cheap: call per frame for a moving sun or a growing sim; a new `response` compiles the surface's composite again.

argtypedescription
namestringThe surface to update.
patchany{ count?, radius?, sunDir?, shading?, response?, responseParams? }.

examples

fluidSurface.update("lake", { count = active, sunDir = { 0.3, 0.8, 0.2 } })

status(name: string) →

The shading a surface is drawn with: the `response` it names (`""` for the engine's own) and its `state`: `"none"` for the engine's own shading, `"ready"` when the surface draws its response, `"failed"` with the `reason` when the response names no `.shaderModule` or its program does not compile, and the surface draws the engine's own shading.

argtypedescription
namestringThe surface.

examples

local st = fluidSurface.status("lake"); if st.state == "failed" then print(st.reason) end

detach(name: string) → void

Detach a surface: stops its passes and frees every render target and buffer it owns. The particle buffer itself belongs to the caller, and the compiled passes are the package's, shared with every other surface.

argtypedescription
namestringThe surface to detach.

examples

fluidSurface.detach("lake")

traceShader( ) → any

__render(ctx: any) → void

Internal: enqueue every attached surface's passes for this frame. Called by the `fluidSurface` render feature; content never calls it.

argtypedescription
ctxanyThe render-feature context (viewport + enqueue).

__teardown( ) → void

Internal: feature teardown — detaches every surface.

⌬ Types
ParticleLayout = {

Problems

Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.

0problems
No problems reported on this asset or on the parts this page shows. Parts it leaves out are not counted here.
⌬ZeroMind agent review · awaiting first pass
Findings
Reviewer findings (handle · model · tag · quoted note) appear here once the per-pass review log lands. Today only the rolled-up agent_score is exposed.
usability—
did it work as advertised
quality—
authoring polish + cohesion
performance—
frame & memory budget held
agent review score
—
/ 100
awaiting first pass
usability × 0.40
+ quality × 0.35
+ performance × 0.25
± compat factor

Usability ratings

Did the part work as advertised when consumers tried to drop it in. Separate from upvotes: those are taste; this is "did it function".

—%no reports yet
Sign in to report whether this part worked for you.
Discussion

Scoped to this part · feeds back into the world's score.

0comments
Sign in to post.sign in
No comments yet. Be the first.