Code Monkey home page Code Monkey logo

libwethair's Introduction

libWetHair

libWetHair is an open source project for the physical simulation of liquid and wet hairs. It has been compiled and tested on Mac OS X (with both Intel and Apple M1 chips), Ubuntu Linux, Windows, 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.

Dependencies

libWetHair has several dependencies and by default it will fetch them through CMake's FetchContent. Please make sure your internet is smooth before the first time of configuration.

Alternatively, if preferring a package manager, one can turn on the switch LIBWETHAIR_FIND_DEPENDENCIES, which will have cmake to find those dependencies through a package manager.

Compilation

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

To compile libWetHair, you'll need CMake or CMake-GUI (https://cmake.org).

For CMake:

  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. Optionally, you may use cmake to generate project files corresponding to different IDEs. For example, on Windows you may use cmake -G "Visual Studio 17 2022" -A x64 to generate a project for Visual Studio 2022 using x64 architecture.
  4. type make to compile the code. For speeding up the compilation process you may use make -j.

Similar (or more convenient) configuration can be done in CMake-GUI.

In addition, to configure for the demo on Windows, you'll need to have fxc.exe contained in one of the directories specified through your system's PATH environment variable. This executable is usually under your installation directory for Windows SDK (e.g., for Windows 10, it's in a directory named with a specific SDK version under C:\Program Files (x86)\Windows Kits\10\bin).

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.

USAGE:

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

Where:

-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 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.

Contact

Please contact the author ([email protected]) 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}, }

libwethair's People

Contributors

nepluno avatar plattfot avatar skoch9 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

libwethair's Issues

Problem setting up codebase

Hi!
I'm trying to follow the installation instructions. I install all the dependencies (on a windows platform, making sure they're all for 32bit applications), the cmake GUI configures and generates the solution with no problem. When I try to build the solution however I get linking errors stemming from the GLEW library...

in TwoDSceneRenderer.obj:
"unresolved external symbol __imp__glewBindBufferARB in TwoDSceneRenderer<2>::initializeOpenGLRenderer" (x4) for each similar call in the same function

and

in main.obj:
"unresolved external symbol __imp__glewInit@0 referenced in function "void __cdecl initializeOpenGLandGLUT(int,char * *)" (?initializeOpenGLandGLUT@@YAXHPAPAD@Z)"

"unresolved external symbol __imp__glewGetErrorString@4 referenced in function "void __cdecl initializeOpenGLandGLUT(int,char * *)" (?initializeOpenGLandGLUT@@YAXHPAPAD@Z)"

I'm making sure i'm including the header files in these files, though that doesn't change anything it seems. I'm wondering what version of GLEW you used? Mine is 2.1.0, maybe it's a dependency issue? I'd be curious to know anything you can tell me about these types of problems!

Application was unable to start correctly (0xc000007b). Click OK to close the application

Hi, me again!
The code seems to build without any errors bet when it comes to running it, as soon as the console pops up I get an error saying "application was unable to start correctly 0xc000007b). Click OK to close the application"

Again, I can't help but feel it's because I'm using outdated libraries or that there are dependency prroblems. Is there any way (and I know this is asking a lot considering this project ended 3 years ago) that you could post the version number of the libraries not provided with the code? Even better (and maybe easier for you) could you post the precompiled library binaries you used ?

Also I'm on windows 10. Is that the same with you?
Thanks
Otman

Stability and memory issues

Hi,

Apologize for creating an empty issue at first. Accidentally hit enter when creating the subject and that turns out publish the whole issue. 🤦

I've been playing around with libWetHair (I wrote a houdini plugin for it, unfortunately proprietary at the moment). And I noticed that certain scenarios will cause the hair solver to explode. That in term can cause the dripping stage to go out of control and generate hundreds of gigabytes of data causing my machine to ram out or hit swap and hang.

I would like to add some way to either detect this and just abort or avoid things exploding in the first place. I've started reading the Stable Constrained Dynamics paper by Tournier et al. to get a better understanding of how the hair solver is setup. But I'm not sure exactly where in the code I should start looking. Any recommendations? And did you folks encounter any similar issues while developing libWetHair and ideas on how to fix it?

Thanks

Hi there just a small thing

It only compiles when you include cstring in /libWetHair/App/YImage.cpp
I'm new to coding and github so I wont make the commit myself just in case it's a problem with my system/ cpp install

Anyway thanks for the amazing research! :)

Stand alone library?

Hi,

I'm interested to use libWetHair, but the current state where it only constructs an executable is too limited for me. I would like to have a library that I can hook into. What gotchas is there if I where to move the Core part to a stand alone library?

The executable (App) would also use the library.

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.