Cross-platform GPU multiphysics simulation
/!\ This library is still under heavy development and is still missing many features.
The goal of nexus is to essentially be "rapier on the GPU". It aims to be a cross-platform GPU-accelerated multiphysics engine, running compute shaders via WebGPU. Shaders are written in Rust using Rust-GPU and compiled to SPIR-V.
Nexus is organized into independent physics modules, each available in 2D and 3D:
- nexus_rbd - Rigid-body dynamics: colliders (boxes, balls, convex shapes, trimeshes, heightfields), joints (ball, fixed, prismatic, revolute), contact resolution.
Nexus uses cargo gpu to compile its Rust-GPU shaders to SPIR-V during
the build. You must install it before building, otherwise the shader compilation step will fail:
cargo install cargo-gpu --version 0.10.0-alpha.1
cargo gpu install # Install the toolchain needed by cargo-gpuFor building running on the browser:
rustup target add wasm32-unknown-unknown
cargo install wasm-server-runnerWebGpu might not be enabled on your browser:
- It is often already enabled by default on Windows and Macos major browsers.
- On Firefox, go to
about:configthen setdom.webgpu.enabledtotrue. - On chromium, go to
chrome://flagsthen setUnsafe WebGPU SupporttoEnabled. Keep in mind that, on Ubuntu, we observed WebGPU performances to be significantly worse on chromium compared to Firefox. - Safari is currently not supported by Nexus.
The example binaries launch a viewer window with all available demos. Use the --release flag for good performance,
as debug builds of GPU physics code will be very slow.
# Run natively
cargo run --release --bin all_examples3
cargo run --release --bin all_examples2
# Run on the browser
cargo run --release --bin all_examples3 --target wasm32-unknown-unknown
cargo run --release --bin all_examples2 --target wasm32-unknown-unknownThe 3D engine and viewer are also available from Python as the nexus3d module
(PyO3 + maturin), mirroring the Rust API closely. See
crates/nexus_python3d/README.md for building
instructions and a full set of example scripts (rigid bodies, joints, and
URDF/MJCF robots).
MIT OR Apache-2.0
