Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/simbleau/nbody-wasm-sim

An N-body WebAssembly simulation using Web GPU
https://github.com/simbleau/nbody-wasm-sim

rust rust-lang simulation wasm webassembly webgpu wgpu wgpu-rs

Last synced: about 2 months ago
JSON representation

An N-body WebAssembly simulation using Web GPU

Awesome Lists containing this project

README

        

GPU N-body WASM Simulation


+

+

Click here to demo the simulation.


Authors: [@seabassjh](https://github.com/seabassjh), [@simbleau](https://github.com/simblau)

---

## 📖 Overview
This repository is a 2D N-body simulation of a dynamical system of bodies, under the influence of physical forces such as gravity. The simulation is written completely in Rust with WebGPU and WGSL shading, exported to WebAssembly. We deploy the demo with GitHub Actions.

🔸 Simulations like these are common in astrophysics and are used to understand the evolution of large-scale universal structures.

---

# 🚀 Serve Locally
## Dependencies
- [Rust](https://www.rust-lang.org/)
- [trunk](https://trunkrs.dev/) (`cargo install trunk`)
- [wasm32-unkown-unknown](https://yew.rs/docs/getting-started/introduction#install-webassembly-target) (`rustup target add wasm32-unknown-unknown`)
## Serve
- Run: `trunk serve`
- Preview: [`http://localhost:8080/`](http://localhost:8080/)

![Screenshot](https://user-images.githubusercontent.com/48108917/183275653-a2ee4f9c-a982-482e-8405-bd124d4bbcf5.png)

---

## 📁 Directories

- [__`assets`__](./assets/): directory contains textures and shaders.
- [__`src`__](./src/): directory contains the rust source code.

---

## 🔏 License
This project is dual-licensed under both [Apache 2.0](LICENSE-APACHE) and [MIT](LICENSE-MIT) licenses.