MotionMiddleweight
Fluid simulation
Ink and smoke that swirl with the cursor.
Ink, smoke and water that swirl in response to the cursor: the effect every agency site has shipped once. The simulation runs on the graphics card in a grid. Bigger grids look better and run slower.
- Breaks when
- resolution vs fps3D fluids need WebGPU
- Also called
- Stable Fluids, SPH, FLIP fluid, WebGL fluid
Prompts
Cursor fluid, done properly
A WebGL2 Stable Fluids implementation (PavelDoGreat style) with separate velocity (RG16F), dye (RGBA16F), pressure and divergence textures at sim resolution 256 and dye resolution 1024: advection, curl and vorticity confinement (strength 30), 20 Jacobi pressure iterations, and pointer splats with force from cursor velocity. Dye in two brand colors on a paper background (not black). Pause when off-screen; halve resolutions on mobile.
Fluid drives a mesh
Use the fluid’s velocity texture as a displacement and normal source for a plane in Three.js (sample it in the vertex shader), so the cursor makes waves in a surface with lighting. Explain how to keep the sim and the render at different resolutions.
SPH particles in 2D
A 2D SPH fluid in Canvas 2D with 1,500 particles: spatial hash grid, density and pressure (Tait equation), viscosity, gravity, and a screen-space metaball render (blurred additive then thresholded). Keep it under 8 ms per frame and expose stiffness and rest density in a small panel.
Related
Resources · 1
- WebGL Fluid SimulationThe cursor-fluid everyone forks. Stable Fluids in one file.PavelDoGreatGitHub · code · demoAug 30, 2026