Skip to content
Branch: master
Go to file

Latest commit


Failed to load latest commit information.
Latest commit message
Commit time


libWetHair is an open source project for the physical simulation of liquid and wet hairs. It is cross-platform (Mac OS X, Linux, Windows, and more), and licensed under the Mozilla Public License v. 2.0.

We would like to hear from you if you appreciate this work.

It is the original implementation of paper A Multi-Scale Model for Simulating Liquid-Hair Interactions (refer to our project page for more details: ). This code base contains the following parts:

  • A liquid simulator implementing the affine-particle-in-cell method.
  • A hair simulator implementing the elastic rods model.
  • A reduced-liquid simulator for the simulation of flow on hairs.
  • Cohesion effects between the hairs
  • Coupling between the hairs and liquid, including dragging, capturing and dripping effect.


libWetHair depends on following libraries (some of them have been included in the code base, marked with an asterisk):

On Mac OS X or Linux-based systems, most of the dependencies are either included, or can be easily installed with Homebrew ( or the APT package handling utility. For Intel TBB, you may download and install from the link provided above.

On Windows you may need manually download and install some of them.


libWetHair has been tested with Clang (under Mac OS X), GCC 4.8+ (under Linux), and Microsoft Visual Studio (under Windows 10).

To compile libWetHair, you'll need CMake on Mac OS X or Linux, or CMake-GUI ( on Windows.

On Mac OS X or Linux:

  1. make a directory, say, build, with mkdir build, enter the build directory, type cmake ..
  2. Optionally you can adjust the options with ccmake .
  3. type make to compile the code. For speeding up the compilation process you may use make -j.

On Windows:

  1. open CMake-GUI, enter the correct directory for source code and build. Then click Configure, choose your installed version of the Microsoft Visual Studio.
  2. after configuration you may find several libraries not found, check the Advanced box and locate those missing libraries manually. Please make sure you have picked the libraries corresponding to the architecture you have selected (say, 32-bit libraries for x86, and 64-bit libraries for x64).
  3. click generate after fixing all missing variables to generate your Visual Studio solution.
  4. open the solution and compile the code.

Run the Demo

To run the demo of libWetHair, you may simply use the command line argument -s [scene_file] to specify the scene to be loaded. For example, you may type

./libWetHair -s assets/unit_tests/cylinder_2.xml

to run the simulation of the scene containing two hairs being cohesive to each other.

All the parameters can be modified offline in the scene description XML files. Some can be changed online in the user interface provided by the demo program.


./libWetHair [-j ] [-o ] [-d ] [-g ] [-p ] [-s ] [--] [--version] [-h]


-j , --initfile Binary file to load simulation state from for initialization

-o , --readableoutput readable file to save simulation state to; after getting the output here, you may do surface reconstruction and rendering with the Houdini .HIP file provided at by renaming the HIP file into the name of the folder storing all output files (please check the python scripts in the HIP file for details).

-d , --display Run the simulation with display enabled if 1, without if 0

-g , --generate Generate PNG if 1, not if 0

-p , --paused Begin the simulation paused if 1, running if 0

-s , --scene Simulation to run; an xml scene file

--, --ignore_rest Ignores the rest of the labeled arguments following this flag.

--version Displays version information and exits.

-h, --help Displays usage information and exits.


Please contact the author ( for questions and bug report, or consulting for the usage of this code base.

BibTex Citation

@article{Fei:2017:liquidhair, title={A Multi-Scale Model for Simulating Liquid-Hair Interactions}, author={Fei, Yun (Raymond) and Maia, Henrique Teles and Batty, Christopher and Zheng, Changxi and Grinspun, Eitan}, journal={ACM Trans. Graph.}, volume={36}, number={4}, year={2017}, doi={10.1145/3072959.3073630}, }


A Multi-Scale Model for Simulating Liquid-Hair Interactions





No releases published


You can’t perform that action at this time.