Development
Developers who wish to contribute to Fluids v.3 are encouraged to study the Wishlist below.
Some of these projects might be suitable for masters or Ph.D. projects for graduate students in computer science, mechanical engineering, or physics. I am available to provide suggestions and guidance on implementation, but unfortunately don’t have time to contribute additional code myself right now.
Fluids v.3. is release under an Attribute-ZLib license. You may create derivative works for commerical or open source projects. However, public acknowledgement is required. See license details here.
I welcome and encourage developers to give back to the community by sending any major improvements back for future release. If you implement something on the wishlist, let me know! At the very least, I’d like to hear what you’re working on and see or post some visual results in the gallery.
Build Notes
Files necessary for building in Visual Studio 2010 are available in download section.
You will need to install the correct CUDA Toolkit, GPU Computing SDK, and GPU Graphics Driver for your system. Here are the tools which I installed for testing:
- C++: MS Visual Studio 2010, SP1
- CUDA Toolkit, version 4.2, 64-bit
- GPU Computing SDK, version 4.2
- NVCC compiler 4.2, v0.2.1221
- CG Toolkit, version 2.2, 2010
- GPU System: GeForce GTX460M
- GPU Graphics Driver: ver 301.27
- CUDA Compute capability: 2.1
- CPU System: Sager NP8690, Core i7 640M, 2.8 ghz
It might be possible to rebuild with earlier Compute capability, or with earlier CUDA Toolkits and SDKs. I have not tested for the earliest possible compute level that Fluids v.3 might support. You’re on your own, but welcome to try.
Fluids v.3 also makes use of a few third-party libraries for basic graphics and reading XML files. Libraries for VS2010 rebuild are included in the fluids_v3_lib download.
Please refer to the original library pages for more details:
CUDA – http://www.nvidia.com/object/cuda_home_new.html
OpenGL – http://www.opengl.org/
FreeGlut – http://freeglut.sourceforge.net/
TinyXML – http://www.grinninglizard.com/tinyxml/index.html
Glee – http://elf-stone.com/glee.php
Wishlist
The following wishlist represents desirable features for Fluid v.3, which I just don’t have time to work on.
1. Fluid Surface rendering (difficulty: advanced) – Fluids v.3 does not yet render the surfaces as a mesh. The ideal method would be based on this paper:
Efficient High-Quality Volume Rendering of SPH Data, Fraedrich et al., Oct 2010
Using this method, the SPH particles would be rapidly rasterized into a 3D volume texture by using the geometry shader to expand each particle into a set of small triangular slices. The final 3D volume is then polygonized into a mesh using a CUDA-based Marching Cubes.
By performing all steps on the GPU, this could be done interactively.
2. Efficient Shared Memory SPH (difficulty: medium) – Ideally, proper use of GPU shared memory should enable a 20-40x performance gain, but requires a different approach.
A shared memory solution based on this paper, Interactive SPH Simulation and Rendering on the GPU, has already been implemented into Fluids v.3. See the function computePressureGroup (in file fluid_system_kern.cu). This method has been tested and produces correct results in Fluids v.3, use the F or G key to change simulation algorithm, but it produces results 4x slower instead. The challenge is to determine why, on a hardware level, the shared memory solution is not performing as expected.
3. Incompressible PCISPH (difficulty: advanced) – A recent theoretical advance in smooth particle hydrodynamics, called PCISPH, allows for more accurate incompressible fluids. This should also increase efficiency by another 5-10x performance gain. The method is based on the paper Predictive-Corrective Incompressible SPH, by Solenthaler and Pajarola.
4. Rigid Body Interaction (difficulty: advance) – Fluids v.3 does not yet support interaction with rigid bodies. My intention was to integrate this with Bullet physics, but i never got around to it. The approach requires either particle-triangle boundary tests, or transforming each rigid mesh object into a set of particles which are then inserted into the simulation.
5. Secondary Particles (difficulty: easy) – One of the main goals of Fluids v.3 is to bridge the gap between game physics and motion picture production. For realistic images, motion pictures use secondary spray particles which are emitted from the primary particles. This should be relatively easy to add to Fluids v.3 by emitting secondary particles when the velocity is high and the density is low in the primary particles. The secondary particles would be advanced using a simple GPU-based integrator, and due to their short lifetime they do not need to interact with one another like the primary particles.
6. Hardware Analysis (difficulty: easy) – Performance tests on Fluids v.3. were done on an NVIDIA GeForce GTX 460M which is rated at 518 Gflops with 192 cores. The most recent card is the GeForce GTX 680, which is rated at 3090 Gflops with 1536 cores. This means that simulations shown here with 4 million particles at 1/2 fps should be able to run 6-8x faster, or at 3 to 5 fps. Does this actually happen? How does the neighborhood search scale with GPU hardware? The goal is to determine the actual performance response due to changes in hardware for the neighborhood search algorithm used in Fluids v.3.
Development Overview:
Fluids v.3 represents a 6x to 10x performance gain over Fluids v.2, using identical hardware. By implementing PCISPH (3-5x gain), proper CUDA shared memory usage (20-30x gain), and switching to GTX 680 hardware with 1536 cores (6-8x gain), it should be possible to get a total net gain in performance between 20x-30x in addition to the current performance of Fluids v.3.
By adding interactive Fluid Surface rendering, Secondary Particles, and Deferred shading, the visual quality should be comparable to motion pictures. That is, with current hardware, it should be completely conceivable to interact with 2 million particle simulations at a high visual quality. The vision of Fluids v.3 is to move from sandbox faucet simulations into an era of large scale, real world, interactive fluid simulations.
In 2013, I will start a new job, and will be unable to continue work on Fluids v.3. I am therefore pleased to make this software open to the community to expand and improve it. See the page on Licensing for details.
I welcome suggestions and feedback. Please read the FAQ page before contacting me.
Leave a Reply to Torsten Späte Cancel reply