lucascompython/particle-simulation-2d
2D Particle Simulation
This project is built with Zig
, SDL3
, Dawn
/ Wgpu-Native
and ImGui
.
This project is a rewrite of this project that used Raylib and performed all the calculations on the CPU.
I'm making this project with the goal of learning modern graphics programming and the differences between graphics library stacks.
A 3D version of this simulation that uses Rust
+ Winit
+ Wgpu
+ Egui
, can be found here.
https://github.com/user-attachments/assets/5b5efdc1-bf9a-4533-bed4-976d08e197d7
The simulation can run on different methods, such as:
I wanted to add another GPU method, namely Transform Feedback since it is (I think) pretty the most performant method for this simulation that can run on WebGL, but I've found it difficult to implement in wgpu
. Here is a discussion about it. Still looking into it!
This project has the following build dependencies:
dear_bindings
and fetching the dependencies of Dawn
wgpu-native
C
/C++
code with LTO
enabled and not conflict with the Zig
/Rust
compilersSDL3
and Dawn
SDL3
and Dawn
git clone https://github.com/lucascompython/particle-simulation-2d.git
cd particle-simulation-2d
zig build make-deps # Will fetch the submodules and build the dependencies (SDL3, ImGui, Dawn, Wgpu-Native)
zig build run
# OR
zig build run -Doptimize=ReleaseFast # for release build