A real-time 3D fluid simulation engine built in Rust using OpenGL Compute Shaders. This project was developed as a Bachelor's Thesis at the Budapest University of Technology and Economics (BME).
Author: Jakab Martin
Supervisor: Dr. Szécsi László
Thesis Link: Diplomaterv Portál
Modeling and understanding physical phenomena is a key area of computer graphics and engineering. Fluid simulation has seen many approaches, one of which is the vortex-based method. The advantage of this method is its ability to model complex flow phenomena with relatively low computational requirements, enabling real-time simulations.
This project implements a vortex particle method that handles:
- Fluid-Boundary Interaction: Two methods were introduced to handle the interaction between the fluid and solid objects.
- Remeshing/Particle Lifecycle: A system to maintain a uniform distribution of fluid particles using a lifecycle model known from particle systems.
- Real-time Visualization: High-performance rendering of the simulation results.
- Vortex Particle Method: Efficient simulation of fluid dynamics using vorticity.
- GPU Acceleration: Heavy physics calculations are offloaded to the GPU using OpenGL Compute Shaders (
.compfiles). - Rust & OpenGL: Written in Rust for safety and performance, leveraging the
glfwcrate for windowing and raw OpenGL bindings for rendering. - Interactive Camera: Navigate the 3D scene to view the simulation from any angle.
- Rust Toolchain: Install from rustup.rs.
- OpenGL 4.3+: Ensure your graphics drivers are up to date (Compute Shaders require OpenGL 4.3 or higher).
-
Clone the repository:
git clone https://github.com/your-username/vortex-method-program.git cd vortex-method-program -
Build and Run: It is highly recommended to run in release mode for smooth simulation performance:
cargo run --release
The simulation typically features a free-flying camera:
- W / A / S / D: Move Camera (Forward/Left/Backward/Right)
- Mouse: Orientation/Look
The project is structured into several key modules:
src/objects: Handles simulation entities likeParticles,ActiveVorticies, and boundary meshes.src/structures: Defines core data structures likeVortex,Particle, andCubeGeometry.resources/shaders: Contains the GLSL shaders.*.comp: Compute shaders for physics updates (vortex interaction, advection, etc.).*.vert/*.frag: Shaders for rendering the particles and meshes.
Copyright © BME Faculty of Electrical Engineering and Informatics.
Refer to the Thesis Page for more details.