Fluids simulator

Fluids simulator

Fluids simulator with blobby modeling (metaballs) and spring mechanics. Advanced graphics course final project, NCSU.

Animated metaball fluid melding and deforming in the simulator.

Overview

Metaball fluids with marching cubes

I combined blobby modeling (metaballs) with spring-based physics to generate a fluid surface mesh that melds and deforms in real time.

Metaball surface from the simulator.

The Mesh Algorithm

Metaballs with marching cubes

Metaballs, also called blobby objects, are implicit isosurfaces that meld together as they approach one another. I polygonize them into a renderable mesh with marching cubes, then apply all sorts of fun rendering and physics techniques.

Particle physics visualized in the simulator.

The Physics

Spring mechanics

A particle system governed by a network of springs, that push and pull on one another, make a tunable sandbox-style physics playground.

Rendered fluid from the simulator.

Code

Implementation

I implemented this from scratch in WebGL 1.0, everything from rendering and shading to the physics and interface. Check out my GitHub repository and run it in your browser!

Simulator with many particles forming a fluid.

Sandbox

A mathematical playground

Play with shading techniques and physics variables to create your own liquids, or crash your browser with particles.