rlguy / FLIPViscosity3D

A basic free-surface liquid FLIP fluid simulator with viscosity
MIT License
129 stars 20 forks source link
animation fluid-solver simulation viscosity

FLIPViscosity3D

This program is a basic free-surface liquid FLIP fluid simulator with viscosity. The fluid simulation program exports the simulation particle positions as a sequence of .OBJ or .PLY meshes containing only vertices. The particles can then be meshed and rendered in a separate program.

This program implements the following methods for the variational pressure solver and the variational viscosity solver:

Much of the simulation method was adapted from code available from Christopher Batty's GitHub page and also code available from my GridFluidSim3D project.

Gallery

The following images were generated from particle data output by the program and rendered using Blender.

alt tag alt tag

alt tag alt tag

An animation of a buckling honey simulation can be viewed here.

Features

Below is a list of features implemented in the simulator.

Dependencies

Everything required to run this program is included in the repository. A compiler that supports C++11 is required to build the program.

Installation

This program uses the CMake utility to generate the appropriate solution, project, or Makefiles for your system. A Makefile is also provided.

Sample triangle meshes are located in the sample_meshes directory.

The default simulation will drop a mass of fluid in the shape of the Stanford Bunny inside of a spherical container.

alt tag

Rendering in Blender

An example script for how to import the particle meshes into Blender for rendering is located here. This script will import a .obj mesh sequence into Blender and update the mesh data on a frame change. The sequence can be rendered in Blender 3.1 or later by converting the object to a Point Cloud using the Geometry Nodes Mesh to Points Node.

Usage: load the script into the Blender text editor, edit the MESH_CACHE_PATH variable to point to the directory containing the simulation meshes, and press the 'Run Script' button.