A collection of repos from TUM to run fluid simulations and ML experiments in PhiFlow then visualise results in Blender.
Our overall goal is to convert .NPZ
files into volumetric .VDB
now supported in Blender. The following steps are only valid for Linux, namely Ubuntu. It is recommended to use VSCode to build mantaflow
binaries.
-
Install
PhiFlow
and run experimentspip install phiflow dash
. This experiment was tasted with Phiflow 2.2.5 (which is included in folderPhiFlow
) -
Run a PhiFlow simulation. For example, run
TUM.py
using Python3. The results will be saved in.NPZ
format. -
Install
mantaflow
dependencies:- CMake, etc.:
sudo apt-get install cmake g++ git python3-dev
- NumPy:
sudo apt install python3-numpy
- OpenVDB:
sudo apt-get install libopenvdb-dev
NB: On Windows, one should consider using the prebuilt libraries from here. - TBB: Download deb files for libtbb2 and libtbb-dev and install using
sudo apt install ./<path_to_deb>
NB: TBB went through a massive change to morph into oneTBB. Remark that TBB (version <2020) is required here, not OneTBB (version >2021).
- CMake, etc.:
-
Build
mantaflow
from source with CMake options-DNUMPY
,-DOPENVDB
, and-DTBB
enabled.NB: Remember to
Delete Cache and Reconfigure
if CMake options are not taken into account. Also, you might get warnings for some deprecated TBB headers. Ignore them ! -
Now let's convert the
.NPZ
files from step 2 into.VDB
. Simple, just locate the manta2vdb.py scene definition script and run the command./path/to/manta path/to/manta2vdb.py -d path/to/scene/data -res 128 64 192
NB: It is advised to run the above command from the location of themanta2vdb.py
script. -
Open Blender, press
Shift + A
, thenVolumes
, thenimport OpenVDB
to load your volumetric scene files. To make awesome renderings, follow Nils Thuerey's video. That's all folks, ENJOY !
The files you will encouter in this repository have been updated to work on my WSL setup. Here are the links to the original repositories:
- PhiFlow: https://github.com/tum-pbs/PhiFlow
- Mantaflow: https://github.com/thunil/mantaflow
- MantaFlow to Blender: https://github.com/intergalactic-mammoth/phiflow2blender
- Blender (optional): https://www.blender.org
That's it. Thanks to the original creators :)