For the purpose of this project, we had two main goals in mind: to correctly and cleanly implement a real-time, particle-based fluid simulation as outlined in the 2013 paper Position Based Fluids by Matthias Müller and Miles Macklin. To achieve the goal of real-time simulation, we exploited the parallel processing power of the GPU as much as possible, either through the use of OpenGL for direct rendering, or OpenCL for generalized parallel computation.
For the most part, every major feature outlined by Müller and Macklin was implemented in our simulator:
- Particle incompressibility
- Simulated surface tension using an artificial pressure term
- Vorticity confinement to mitigate numerical dissipation issues
- XSPH viscosity
- All major components of the simulation were implemented as OpenCL kernels, allowing the code to run directly on the GPU
- As a potential improvement over the fast nearest-neighbor finding method employed by Müller and Macklin (Green 2008), we implemented the parallel counting sort technique as described in FAST FIXED-RADIUS NEAREST NEIGHBORS: INTERACTIVE MILLION-PARTICLE FLUIDS by Hoetzlein/NVIDIA (2013)
- The bounds of the simulation can be dynamically changed at runtime according to a number of predefined animation patterns, such as sine wave, sawtooth wave, and one-shot compression. This allows us to create a number of novel fluid motion effects like crashing waves, etc. with ease on-the-fly
- Xcode 6.1 (tested under OSX 10.9.5 on model "MacBookPro11,1")
- openFrameworks, community contributed
- A great, generalized C++ framework for creative coding and experimentation
- ofxMSAOpenCL, Memo Akten
- A openFrameworks addon wrapper that removes much of the boilerplate code associated with OpenCL
- Position Based Fluids
- Matthias Müller and Miles Macklin (2013)
- Position Based Fluids, SIGGRAPH 2013 slides
- Matthias Müller and Miles Macklin
- Particle-based Fluid Simulation based Fluid Simulation
- Simon Green (2008)
- FAST FIXED-RADIUS NEAREST NEIGHBORS: INTERACTIVE MILLION-PARTICLE FLUIDS
- Rama C. Hoetzlein, Graphics Devtech, NVIDIA (2013)
- OpenCL Parallel Prefix Sum (aka Scan) Example
- Apple Inc. Updated: 2009-09-23
- Point sprites as spheres in OpenGL3.3
- Movania Muhammad Mobeen (2011)
- Scaling point sprites with distance
- Allocating Local Memory
- Matt Scarpino (2014)
- OpenCL Sorting
- Eric Bainville, June 2011
A graphics card that supports OpenCL v1.1+ and OpenGL 3+ (a.k.a. "modern OpenGL")
-
Xcode 6.x
-
OSX 10.9 and higher, although it might compile on older versions. Unfortunately, we are unable to test for compatibility on older versions of OSX.
-
Visual Studio 2012 Professional (although the Basic edition may suffice)
-
The necessary OpenCL runtime/SDK provided by the manufacturer of the the graphics card/devices:
-
For Intel cards and chipsets:
- Download the latest Intel graphics drivers
- Download the free edition of OpenCL™ Code Builder with Intel® INDE
(formerly Intel® SDK for OpenCL™ Applications). This is needed for
OpenCL.lib
for Visual Studio to link against. If it is installed correctly, you should see the environment variableINTELOCLSDKROOT
defined underSystem > Advanced System Settings > Environment Variable > System variables
-
For Nvidia cards and chipsets:
- TODO
-
For AMD cards and chipsets:
- TODO
-
For ATI cards and chipsets:
- TODO
-