Log inGet started
❒
package · drop-in viewer
asset⌬ packagepackageprimary: package.yaml·originates fromworld 07158574-5…●3problems

fluidSurface

A GPU particle simulation, rendered as a continuous liquid.

by◐lumi·posted 4mo ago
What it does

fluidSurface

A GPU particle simulation, rendered as a continuous liquid.

Water made of particles has a problem: the particles are spheres, and a pile of spheres looks like a pile of spheres. Turning them into a mesh every frame is expensive and the mesh is thrown away immediately. This package skips the mesh — it renders the particles into screen-space fields and shades those, so the particle data never leaves the GPU and the cost scales with screen pixels rather than with the surface's geometric complexity.

What it does

local fluidSurface = require("@builtin::systems.fluidSurface.modules.fluidSurface")

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

particles describes the record layout of the buffer the caller's simulation writes: how wide a record is, where the position sits in it, and how many are live. Pass the handle a compute shader's createBuffer answered. Everything after that happens per frame until detach.

update moves the live knobs — the particle count as a sim grows, the sun direction as the day turns, any composite property:

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

The chain

  1. Splat (engine raster). Every particle draws as a velocity-stretched billboard: nearest-surface depth, hardware z-tested; additive thickness and thickness-weighted colour; and, when the records carry a foam weight, an additive foam sprite layer.
  2. Narrow-range filter (fluid_narrow_x → fluid_narrow_y, ping-ponged iterations times). Neighbour depths are clamped into a band around the centre before averaging, so particles fuse into a surface while silhouettes stay crisp. The body is the fluid_narrow_filter shader module, included by both axes.
  3. Resolve (one of fluid_resolve, fluid_resolve_col, fluid_resolve_foam, fluid_resolve_col_foam). Packs smoothed depth, blurred thickness and the foam fraction into data, and the mean liquid colour along each ray into liq. Which one runs is decided by whether the records carry a colour and a foam weight, because that changes which textures the pass binds.
  4. Composite (fluid_surface_composite, a post-process shader). Refracts the already-rendered scene through the surface normals, absorbs along the view ray by Beer–Lambert, marches the reflected ray against scene depth so the water mirrors what is above it, adds sun specular, and lays foam on the thin edges. Depth-tested against the scene, so fluid behind geometry stays hidden.

Every stage runs at resolutionScale of the screen (half by default).

Shading in a style

The composite's colour comes from a shading response. Every surface takes the engine's own (shaders.fluid_physical) unless its spec names another in response: a .shaderModule that includes @builtin::systems.fluidSurface.shaders.fluid_shading and defines fluid_shade, handed each pixel's refraction, absorption, reflection, highlight, foam, thickness, outline and the sixteen numbers of responseParams. A flat-toned toon water with an ink or foam outline, a painted palette, or a hard-edged pixel liquid is a response module in content; fluid_shading's README states what it is handed and has a worked two-tone example.

fluidSurface.update("lake", { response = "@root::looks.toonWater", responseParams = { { 0.35, 0.75, 0.95, 0.6 } } })
fluidSurface.status("lake")   -- { response, state = "ready" | "failed" | "none", reason? }

Sharing

The passes are compiled once and shared by every surface. What a surface owns is its render targets, its own filter-parameter buffer, and its own composite — which is why two lakes at different particle radii filter at different widths without interfering.

Interface

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

This asset doesn't declare a schema or structured payload.

Problems

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

These counts cover only the parts this page shows. Problems on the parts it leaves out are not counted here.

3+problems

Inside

3 problems across 3 items
●
dep.unresolved · L74
could not resolve `@root::looks.toonWater`
●
dep.unresolved · L86
could not resolve `@root::looks.toonWater`
●
dep.unresolved · L101
could not resolve `@root::looks.toonWater`
⌬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.