跳到正文
网页珍奇柜Web Curio

十分钟物理:FLIP 流体

Ten Minute Physics: FLIP Fluid,Matthias Müller,2022 年

正在布展…

原作直展:这是 Matthias Müller 的原始作品,按 MIT(写在原作文件头部注释里) 许可证收录(版本 bfc4b63)。原作 18-flip.html 原样展出,未作任何修改;LICENSE 文件是从它头部注释里原文摘出的许可声明。可以用鼠标拖动水中的圆球。 许可证全文 · 收录说明

它是怎么做的

  1. 第 1 步粒子承载流体,网格负责求解压强(FLIP/PIC 混合)
  2. 第 2 步粒子速度转移到交错 MAC 网格
  3. 第 3 步在网格上用 Gauss-Seidel 迭代求不可压缩性,并补偿粒子密度漂移
  4. 第 4 步把网格速度变化量回传给粒子,再推进粒子并做粒子间推开
  5. 第 5 步WebGL 把粒子画成点精灵,颜色随密度变化

复刻配方

一段技术配方,可以直接交给 AI 编程助手,也可以自己照着写。想指定技术栈、位置和性能预算,就把它加入实现方案。

Keep particles with position and velocity plus a staggered MAC grid with u and v velocities and solid flags. Each step: integrate gravity on particles, push apart overlapping particles using a spatial hash, handle collisions with walls and a draggable circle obstacle, transfer particle velocities to the grid with bilinear weights, save the grid velocities, run Gauss-Seidel pressure iterations with over-relaxation and a density correction term, then transfer back as a blend of FLIP (add the change) and PIC (copy). Render particles as GL points coloured by local density.

档案

交互

能不能拿来用

原作以 MIT (header comment in each HTML file) 许可开源:可以阅读源码学习,按许可证条款使用;在自己的项目里引用时保留原作者署名。

性能开销

视觉强度

实现难度

尺度为策展判断(1 到 5),用于比较和推荐。

核实记录:Opened https://matthias-research.github.io/pages/tenMinutePhysics/18-flip.html (200, title 'FLIP Fluid'); repo matthias-research/pages exists (no repo-level licence) and the HTML file header contains the MIT licence by Matthias Müller.