FLIP Fluids is a modern fluid solver written for Blender. It’s quite new, and the results are impressive! The add-on is available for sale on the Blender marketplace, but it’s also available in source on Github. I ran into a few issues trying to build it, so I thought I’d document the final, working process here.
– Windows 10 x64
– Visual Studio 2017 (Version 15.7.3 at time of writing)
– A copy of the FLIP-Fluids git repository
– Cmake (I’ll be using the GUI, with version 3.12.1)
– Nvidia CUDA SDK 9.2 (That’s what I used, but the AMD APP SDK 3.0 should work too). Note that we just want OpenCL support, but Nvidia only provides it with their CUDA SDK
– A copy of Blender x64. I generally just grab one of the newest builds from graphicall.org
Open CMake-GUI to the repo’s root, and select “Visual Studio 15 2017 Win64”. It’s important that you selection the 64-bit generator! Point the “Where is the source code” path to the root of the git repo. Then, make a “Build” folder in the root folder and set “Where to build the binaries” to the newly created folder.
Click “Configure”. If your machine is like mine, OpenCL will not be found properly. Something along the lines of “WARNING: OpenCL was not found on your system.” Don’t worry, we can fix that.
In CMake-GUI, type “opencl” int he search field and check the “Advanced” checkbox. You should see a few fields, including “OpenCL_INCLUDE_DIR” and “OpenCL_LIBRARY”.
These two fields should be edited to point to the “include” folder (the folder that contains the “CL” folder) and the OpenCL.lib file iteself, respectively. Note that we are pointing to the 64-bit lib.
If the “Configure” step works, go ahead and click “Generate”, and then “Open Project”. Visual Studio should open
Visual Studio Setup and Compilation
In theory, we can just press “build” on a CMake-generated project and everything will work. In practice, and in this case, it doesn’t. Go ahead and run “Build -> Clean Solution” to start fresh.
The project-solution structure is quite simple: everything depends on the “objects” project. So let’s build that first. It should build with some code-style warnings. If it doesn’t, make sure Visual Studio is targeting 64-bit, and that your CMAKE OpenCL values are properly set.
The other three projects all depend on just the “objects” project. When trying to build it, I hit a “LNK 1107 invalid or corrupt file: cannot read at 0x358” error for “OpenCL.dll”. I think this is an error in the CMake script in the FLIP-fluids repo. Fortunately, the fix is easy. Right click the project (not the solution), go to “Linker -> Input”, and edit “Additional Dependencies”.
Edit the first entry that currently has “C:\Windows\System32\OpenCL.dll” and replace it with the filepath of the CMake “OpenCL_LIBRARY” path. Mine, for example, is at “C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\lib\x64\OpenCL.lib” Repeat this for all three projects
Try building the entire solution, it should work now!
Installing into Blender
Open the “build” folder inside the git repo’s root, and then the “bl_flip_fluids” folder. There should be three folders: “flip_fluids_addon”, “pyfluid”, and “test”. Zip the “flip_fluids_addon”. Save this zip file somewhere! It is the addon!
Now open Blender. Go to “File-User Preferences” and then to the “Add-ons” tab. Click the “Install Add-on from File…” at the bottom of the dialog, and browse to the newly created zip file. A new “Animation: FLIP Fluids” Add-on should appear; go ahead and enable it.
Now, create a simple scene of a box and a small sphere, just to make sure the Add-on works. Once the two have been created, select the cube (the domain) and click Bake. If there are errors, check the console window. Likely, the 32/64 bit-ness got mixed up somewhere along the way. One other issue I encountered was an error regarding “libblpyfluid.dll” while trying to bake. The only way I found to fix that was to edit “build\bl_flip_fluids\flip_fluids_addon\pyfluid\pyfluid.py” at line 47 (after the “Windows” switch”) and change it to “blpyfluid.dll” (remove the “lib” at the front of the string).
If it starts baking, then well done! FLIP fluids has been successfully compiled and added to your copy of Blender. Get simulating!