CSESA Task Of Graphics Programming And Simulations Division.
Fluid Simulation written in C++ using Compute Shaders for running simulation on GPU using Vulkan Compute API.
This project implements a real-time fluid simulation using Vulkan compute shaders. The simulation leverages GPU acceleration for high performance and interactive visualization.
- GPU-accelerated fluid simulation using Vulkan Compute API
- Modular C++ codebase
- Interactive controls via mouse input
- Customizable simulation parameters
- C++17 compatible compiler
- Vulkan SDK (
vulkan-sdkpackage or LunarG Vulkan SDK) - GLFW
- GLM
- CMake (recommended)
- Linux (tested), but should be portable
-
Install dependencies:
sudo apt update sudo apt install vulkan-sdk libglfw3-dev libglm-dev cmake build-essential
-
Clone the repository:
git clone https://github.com/CSESA-IITI/Fluid-Simulation.git cd Fluid-Simulation -
Compile shaders:
cd Triton ./compile.sh cd ..
-
Build the project:
mkdir build cd build cmake .. make
Run the compiled binary from the build directory:
./FluidSimsrc/core/core.cpp
Main simulation logic, Vulkan resource management, and compute pipeline setup.src/shaders/
GLSL shader files for vertex, fragment, and compute stages.Triton/compile.sh
Script to compile GLSL shaders to SPIR-V.README.md
Project documentation.
- Vulkan context and device are initialized.
- Compute textures and synchronization objects are created for each frame in flight.
- Compute pipelines and descriptor sets are set up for simulation steps.
- Uniform buffers are updated each frame with simulation parameters and user input (mouse position/force).
- Compute shaders are dispatched in sequence to perform advection, diffusion, pressure calculation, and gradient subtraction.
- Results are written to GPU textures and visualized.
- Mouse input is captured to apply forces to the fluid.
- Simulation parameters (e.g., viscosity, density) can be adjusted in code.