Skip to content

lucascompython/particle-simulation-3d

Repository files navigation

3D Particle Simulation

This project is built with Rust, Winit, Wgpu and Egui.

Its heavily inspired by this project.

I'm making this project with the goal of learning modern graphics programming and the differences between graphics library stacks.

A 2D version of this simulation that uses Zig + SDL3 + Dawn / Wgpu-Native + ImGui can be found here.

This project initially used this template but I migrated to eframe using the eframe template.

Demo

particle-simulation-3d-demo.mp4

Simulation Methods

The simulation can run on different methods, such as:

  • CPU - Works everywhere but has limited performance
  • GPU (Compute Shaders) - Only works on native and WebGpu (no WebGl support) but has much better performance

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!

Build Locally

For release builds this project uses a xtask like build-script, that has a cargo alias defined as release. See usage below:

Build Release

cargo release --help

Native Development

cargo run

Web Development

trunk serve

And go to http://127.0.0.1:8080/index.html#dev The #dev is to skip the cache assets/sw.js provides.

TODO:

  • Improve performance, especiall startup time
  • Add more settings and values to tinker with in the simulation
  • Add 2D version, basically rewrite this. Decided to pursue this with a different stack and in a separate repository.
  • Make CI work nicely
  • Add more color profiles
  • Improve binary size
  • Update to wgpu 25
  • Add mobile support, with touch controls

About

3D Particle Simulation

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published