Need help with gpu-fluid?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

tunabrain
430 Stars 33 Forks zlib License 6 Commits 1 Opened issues

Description

High performance OpenGL fluid solver in C++

Services available

!
?

Need anything else?

Contributors list

# 73,228
C++
Shell
Objecti...
4 commits
# 102,524
C++
C
Symfony
dnd
2 commits

Fluid

OpenGL GPU Fluid Solver

This project implements a 2D fluid solver completely on the GPU using OpenGL 4.3.

The solver features a marker-and-cell grid, vorticity confinement, fluid implicit particle, 3rd order Runge-Kutta advection, a conjugate gradient solver with incomplete Poisson preconditioner, and a heat diffusion/buoyancy model.

Videos rendered with this code:

  • http://www.youtube.com/watch?v=SzqYnjIR4n0
  • http://www.youtube.com/watch?v=vMB8elqhum0

Compilation

Compilation requires freeglut and a recent version of GLEW. The makefile in the repository should work on Windows (tested with MinGW) and Linux.

Usage

A recent GPU with fresh drivers is necessary to run this application. Support for OpenGL 4.3 core profile is required. Tested on a GTX480.

When run, the program will open a graphics window and display a preview of the current simulation progress. If the macro RECORD_FRAMES in Main.cpp is set, the program will save out the individual frames as pngs using lodepng.

Note that the window resolution is independent of the fluid resolution; they are controlled individually using the constants GWidth/GHeight for the graphics window and FWidth/FHeight for the fluid grid resolution in Main.cpp. This is to allow for fluid resolutions much larger than the screen resolution. Frames will always be saved at the fluid resolution.

Code

Main.cpp controls the application setup and invokes the fluid solver. Fluid.cpp, along with all the shader files, performs all of the fluid related work. All the remaining files are utilities to deal with OpenGL.

Scene setup and inflows are controlled in Fluid::initScene and at the end of Fluid::update. These can be modified to get more interesting looking simulations.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.