FLIP/PIC fluids
Hybrid fluid method: particles carry mass and velocity, a grid solves pressure, and FLIP-style delta transfer gives splashy, low-dissipation liquid motion.
Also known as FLIP, PIC, PIC/FLIP
In the family Simulation & animation, hybrid particle-grid fluids
Where it runs
Built inOfficial add-onPluginNone foundNot researched
| Engine | Support | How |
|---|---|---|
| three.js r187 | None found | |
| Babylon.js 9.38.0 | None found | |
| Godot 4.7 | None found | |
| Unity | None found | |
| Unreal 5.7 | Official add-on | Enable Niagara Fluids plugin > Grid 3D FLIP Liquid emitter templates docs |
| Blender 5.2 | Built in | Physics Properties > Fluid > Type = Domain, Domain Type = Liquid > Liquid > Simulation Method = FLIP or APIC docs FLIP and APIC; the solver is Mantaflow. |
| WebGPU W3C | None found | |
| Metal | None found |
How it works
Each step: transfer particle velocities to a staggered MAC grid, add gravity, enforce boundary conditions, project the velocity field to be divergence-free with a pressure solve (PCG or multigrid), then transfer back. PIC copies the new grid velocity to particles, which is stable but very viscous. FLIP transfers only the change in grid velocity, preserving detail but noisy. Production solvers blend them (for example 95-99% FLIP). Particles are advected with the grid velocity, and re-seeded to keep about 8 per fluid cell. Sand and granular media can be modelled by adding a friction-based yield model on top. The surface is extracted from particles via a level-set or anisotropic kernel.
When to choose it
Reach for it when
- water simulation looks too damped and viscous
- splashy liquid with lots of detail and particles
- pure grid fluid loses small scale motion
- simulate liquid pouring and splashing for vfx
Choose it when you want film-quality liquids with energetic splashes and little numerical dissipation. Prefer Smoothed Particle Hydrodynamics (fluids) or Position Based Fluids for realtime GPU liquids, Material Point Method (snow) when you also need elastoplastic solids (snow, sand, mud) in the same solver, and Stable Fluids for smoke on a pure grid.
Field marks
- FLIP noise: high-frequency velocity jitter and splash 'fizz' when blend ratio is too high
- Volume drift or loss without particle-count-per-cell maintenance and volume correction
- Thin features below the grid resolution are lost or turn into clumps
- Pressure solve with free-surface and solid boundaries is sensitive to bad Neumann/Dirichlet setups
Presets
FLIP/PIC Fluids — damped PIC grid transfer (left) vs energetic FLIP velocity-delta blend (right)
{
"P_FLIP_RATIO": 0.95,
"P_GRID_RES": 10,
"P_WAVE_AMP": 1,
"P_SPLIT": 0.48
}Show GLSL (131 lines)
const float P_FLIP_RATIO = 0.95; // P FLIP Blend Beta [0.0, 1.0, 0.02]
const float P_GRID_RES = 10.0; // P MAC Grid Cells [6.0, 18.0, 1.0]
const float P_WAVE_AMP = 1.0; // P Splash Energy [0.3, 1.8, 0.05]
const float P_SPLIT = 0.48; // P PIC / FLIP Split [0.0, 1.0, 0.02]
vec2 hash21(float p) {
vec3 p3 = fract(vec3(p) * vec3(0.1031, 0.1030, 0.0973));
p3 += dot(p3, p3.yzx + 33.33);
return fract((p3.xx + p3.yz) * p3.zy);
}
// Divergence-free MAC grid velocity field u(x,y) = curl(psi)
vec2 macVelocity(vec2 p, float t, float flipBeta) {
float k = 4.2;
float vx = cos(p.y * k + t * 1.4) * sin(p.x * 3.1 - t * 0.9);
float vy = -sin(p.y * k + t * 1.4) * cos(p.x * 3.1 - t * 0.9) * 0.72;
// FLIP preserves fine high-frequency sub-grid vorticity that PIC diffuses away
float sub = flipBeta * 0.55;
vx += sub * sin(p.y * 11.5 - t * 2.8) * cos(p.x * 9.2 + t * 1.9);
vy += sub * cos(p.y * 11.5 - t * 2.8) * sin(p.x * 9.2 + t * 1.9);
return vec2(vx, vy);
}
float sdArrow(vec2 p, vec2 a, vec2 b) {
vec2 pa = p - a;
vec2 ba = b - a;
float h = clamp(dot(pa, ba) / max(dot(ba, ba), 1e-5), 0.0, 1.0);
return length(pa - ba * h);
}
vec3 aces(vec3 x) {
x = max(x, 0.0);
return (x * (2.51 * x + 0.03)) / (x * (2.43 * x + 0.59) + 0.14);
}
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;
float px = 1.0 / max(iResolution.y, 1.0);
float screenX = fragCoord.x / max(iResolution.x, 1.0);
float split = clamp(P_SPLIT, 0.0, 1.0);
bool isFlip = screenX >= split;
float beta = isFlip ? clamp(P_FLIP_RATIO, 0.0, 1.0) : 0.04;
float res = clamp(floor(P_GRID_RES + 0.5), 6.0, 18.0);
float amp = clamp(P_WAVE_AMP, 0.2, 2.0);
float t = iTime;
vec3 col = mix(vec3(0.022, 0.032, 0.052), vec3(0.052, 0.072, 0.112), smoothstep(-0.5, 0.5, uv.y));
// Tank domain
vec2 tankBox = abs(uv) - vec2(0.68, 0.39);
float dTank = length(max(tankBox, 0.0)) + min(max(tankBox.x, tankBox.y), 0.0);
float inTank = step(dTank, 0.0);
// Background staggered MAC pressure/velocity grid
vec2 cellUV = uv * res;
vec2 cellId = floor(cellUV);
vec2 cellF = fract(cellUV) - 0.5;
vec2 cellCenter = (cellId + 0.5) / res;
float gridLine = smoothstep(0.045, 0.01, min(abs(cellF.x - 0.5), abs(cellF.y - 0.5)));
gridLine = max(gridLine, smoothstep(0.045, 0.01, min(abs(cellF.x + 0.5), abs(cellF.y + 0.5))));
col += vec3(0.045, 0.075, 0.125) * gridLine * inTank;
// Draw MAC velocity vectors inside each grid cell
vec2 vCell = macVelocity(cellCenter, t, beta);
float vMag = length(vCell);
vec2 arrowEnd = (vCell / max(vMag, 1e-4)) * min(vMag * 0.24, 0.38);
float dArr = sdArrow(cellF, -arrowEnd * 0.35, arrowEnd);
col += mix(vec3(0.14, 0.38, 0.62), vec3(0.28, 0.85, 0.92), clamp(vMag * 0.7, 0.0, 1.0)) *
smoothstep(0.055, 0.015, dArr) * 0.42 * inTank;
// Evaluate 36 Lagrangian fluid particles transferring velocity with MAC grid
float fluidField = 0.0;
float speedSum = 0.0;
float minP = 1e5;
float splashMask = 0.0;
for (int i = 0; i < 36; i++) {
float fi = float(i);
vec2 h = hash21(fi * 13.7 + 1.9);
float colI = mod(fi, 9.0);
float rowI = floor(fi / 9.0);
// Base wave + PIC viscous damping vs FLIP ballistic cresting
float bx = (colI - 4.0) * 0.142 + 0.05 * sin(t * 1.4 + rowI * 0.8);
float crest = sin(bx * 4.2 - t * 2.1) * 0.095 * amp * (0.35 + 0.65 * beta);
float by = -0.27 + rowI * 0.102 + crest;
// FLIP retains sharp sub-grid spray arcs above the wave crest
vec2 vLocal = macVelocity(vec2(bx, by), t, beta);
float lift = (rowI > 2.5) ? (beta * 0.115 * amp * pow(max(0.5 + 0.5 * sin(t * 2.4 + fi * 1.3), 0.0), 2.0)) : 0.0;
vec2 pPos = vec2(bx, by + lift) + vLocal * (0.022 + 0.055 * beta) * amp;
pPos.x = clamp(pPos.x, -0.63, 0.63);
pPos.y = clamp(pPos.y, -0.35, 0.34);
float d = length(uv - pPos);
minP = min(minP, d);
float rK = 0.135;
if (d < rK) {
float q = 1.0 - d / rK;
float w = q * q * q;
fluidField += w;
speedSum += w * (length(vLocal) + lift * 6.0);
}
if (rowI > 2.5 && beta > 0.3) {
splashMask = max(splashMask, smoothstep(0.024, 0.008, d) * beta);
}
}
float mask = smoothstep(0.42, 0.58, fluidField) * inTank;
if (mask > 0.005) {
float avgSpd = speedSum / max(fluidField, 1e-4);
vec3 picCol = mix(vec3(0.08, 0.28, 0.56), vec3(0.22, 0.52, 0.74), clamp(avgSpd * 0.5, 0.0, 1.0));
vec3 flipCol = mix(vec3(0.05, 0.42, 0.78), vec3(0.18, 0.92, 0.88), clamp(avgSpd * 0.65, 0.0, 1.0));
flipCol = mix(flipCol, vec3(0.95, 0.98, 1.0), smoothstep(1.1, 2.0, avgSpd) * 0.65);
vec3 water = mix(picCol, flipCol, beta);
float edgeFoam = smoothstep(0.75, 0.44, fluidField);
water += vec3(0.85, 0.96, 1.0) * edgeFoam * (0.18 + 0.38 * beta);
col = mix(col, water, mask * 0.88);
}
// Particle dots + ballistic FLIP spray droplets
col = mix(col, vec3(0.88, 0.96, 1.0), smoothstep(0.015, 0.006, minP) * 0.72 * inTank);
col += vec3(0.82, 0.97, 1.0) * splashMask * 0.75 * inTank;
// Border and split bar
col = mix(col, vec3(0.68, 0.84, 0.98), smoothstep(0.009, 0.002, abs(dTank)) * 0.85);
col = mix(col, vec3(0.95, 0.97, 1.0), smoothstep(0.0035, 0.0008, abs(screenX - split)));
fragColor = vec4(pow(clamp(aces(col), 0.0, 1.0), vec3(1.0 / 2.2)), 1.0);
}Attribution: MIT — written for this index.
Measured GPU weight & timing
| Preset | GPU | Weight / p50 / p95 | Method |
|---|---|---|---|
| flip-pic-fluids-live | Tesla T4 1920x1080 | 44.7× baseline (heavy) · 1.39 ms / 1.44 ms | opengl-timer-query · 36 frames · GPU Weight Atlas · Colab T4 sweep |
| flip-pic-fluids-live | NVIDIA L4 1920x1080 | 44.0× baseline (heavy) · 0.699 ms / 0.704 ms · 2.0× faster on L4 | opengl-timer-query · Cross-architecture validation |
| flip-pic-fluids-live | NVIDIA A100-SXM4-40GB 1920x1080 | 31.0× baseline (heavy) · 0.893 ms / 0.893 ms · 1.6× faster on A100 | opengl-timer-query · Cross-architecture validation |
Lineage
From the citation graph (Crossref reference lists): its primary source cites Smoothed Particle Hydrodynamics (fluids), Stable Fluids, Fast-Sweeping Eikonal Coastal Wave Refraction & Ray-Tube Shoaling; cited by Ihmsen Unified Spray, Foam, and Bubble Whitewater Simulation, Material Point Method (snow).
Crosses
- Oblique-clipped planar reflections on sloshing FLIP fluid pools: A sloshing FLIP fluid tank or tidal basin combines lively splashes and surface ripples with razor-sharp, full-resolution planar reflections warped cleanly by the evolving liquid surface normals.
Sources
- primaryYongning Zhu, Robert Bridson (2005). Animating sand as a fluid. ACM Transactions on Graphics.Verified via crossref · 2026-11-29doi:10.1145/1073204.1073298
- tutorialMatthias Müller. Ten Minute Physics. matthias-research.github.io.Verified via live page · 2026-11-29