Skip to content

About

A work-in-progress position based fluid simulator (PBF) made with OpenGL

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

11 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pbf-simulator

A 2D fluid simulator running entirely on the GPU with OpenGL compute shaders, built by ShaderGruppa at Hackerspace NTNU. The goal is a Position Based Fluids solver (Macklin & Müller, 2013), later extended toward multiphase and gas behaviour (Macklin et al., 2014).

Status: work in progress. The repository currently contains the compute-shader harness (window, GL context, shader loading, ping-pong SSBOs); the PBF solver itself is being built on top of it.

Requirements

  • A GPU and driver supporting OpenGL 4.6 (macOS is not supported — it stops at 4.1)
  • CMake ≥ 3.20 and a C++17 compiler
  • Ninja (recommended)
  • Git (GLFW is downloaded automatically at configure time; GLAD is vendored in external/)

Windows: MinGW-w64 (e.g. the one bundled with CLion). Linux: sudo apt install build-essential cmake ninja-build libgl1-mesa-dev xorg-dev

Build and run

git clone https://github.com/hackerspace-ntnu/pbf-simulator.git
cd pbf-simulator
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release
cmake --build build
cd build
./pbf-simulator        # pbf-simulator.exe on Windows

The build copies shaders/ next to the executable, and the program loads shaders by relative path. Always run it from the build directory.

CLion

Open the folder as a CMake project. In the run configuration, set Working directory to $CMakeCurrentBuildDir$.

Usage

  • The compute shader to run is set by shaderName in src/main.cpp.
  • A shader named foo_render.comp automatically gets a matching foo_update.comp run each frame on the ping-pong buffers, if one exists.
  • Hold the left mouse button and drag to rotate (for shaders that use uYaw / uPitch).

References

About

A work-in-progress position based fluid simulator (PBF) made with OpenGL

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages