Download the code:
wavelet.turbulence.tar.gz
This code is released under the GNU Public License
Copyright 2008 Theodore Kim and Nils Thuerey
Overview
This code is a reference implementation of our paper Wavelet Turbulence for Fluid Simulation. The code is intended as a pedagogical example, so clarity has been given preference over performance. Optimizations that inhibit readability have been removed, so the running times experienced will be longer than those reported in the paper.
Installation
We have successfully built this code on Windows (Cygwin), Linux, and Mac OSX. Their respective Makefiles are named Makefile.cygwin, Makefile.linux, and Makefile.mac. Choose the one appropriate for your platform. We have made an effort to remove dependencies on external libraries, so aside from some commonly available libraries (zlib, libpng), you should not need to download and install anything special in order to successfully compile.
Rendering
Preview PNG images are automatically saved of the underlying simulation (./original.preview) and the turbulence-amplified simulation (./amplified.preview). You must have PBRT installed in order to render the final images. A Perl script (render.pl) and example scene (scene.pbrt) are provided in the ./render directory. Output to POV-Ray DF3 density files are also supported by the code, but we have not provided an example scene due to time constraints.
Example
As an example, the following should build, run, and render a simulation under Cygwin.
gunzip wavelet.turbulence.tar.gz
tar -xvf wavelet.turbulence.tar
cd wavelet_turbulence
make -fMakefile.cygwin
./FLUID_3D
cd render
perl render.pl 0 200
The final EXR files will be in the ./render directory.
Additional Comments:
- Instead of Wavelet Noise, it is also possible to use Ansiotropic Noise. We have provided the code to generate such a tile. To generate the tile, build noiseFFT using Makefile.FFT and execute noiseFFT. You will need FFTW in order to build successfully. Then at the end of the WTURBULENCE constructor, comment out the noise.wavelets line and uncomment the noise.fft line in order to use this alternate approach.
- Two timestepping functions are provided in WTURBULENCE. stepTurbulenceReadable is a more readable version which does not perform the texture distortion correction. stepTurbulenceFull performs the full algorithm and also tries to parallelize the computation using OpenMP in Linux and OSX (Cygwin does not currently support OpenMP).
- The removed optimizations are primarily unrollings of the loops in WAVELET_NOISE.h. For better performance, explicitly unroll these loops.
- If you get the error "Aborted (core dumped)", it means you do not have enough memory to run the code. You can try decreasing the size of the simulation by decreasing the value of amplify in main(). Conversely, if your system has tons of memory, you can run even larger simulations by increasing the value.