WebGPU 流体海洋
WebGPU-Ocean,matsuoka-601,2024 年

正在布展…
它是怎么做的
- 第 1 步MLS-MPM:粒子到网格(P2G)、网格更新、网格到粒子(G2P)全部在计算着色器中
- 第 2 步屏幕空间流体渲染:渲染粒子深度 → 双边滤波平滑 → 重建法线
- 第 3 步根据厚度缓冲计算吸收颜色与折射
- 第 4 步盒子尺寸可动态改变,制造波浪
复刻配方
一段技术配方,可以直接交给 AI 编程助手,也可以自己照着写。想指定技术栈、位置和性能预算,就把它加入实现方案。
Implement a particle-based fluid in WebGPU compute shaders using the MLS-MPM loop: scatter particle mass and momentum to a grid with atomics, update grid velocities with gravity and boundary conditions, then gather back to particles. Render particles as sphere sprites into a depth texture, smooth it with a separable bilateral filter, and reconstruct normals from the smoothed depth. Also render additive thickness and use it for Beer-Lambert absorption while refracting the background by the normal. Let the user resize the container walls over time to slosh the water.


