Gravity Simulation
Choose simulation
mode
An N-body gravity simulation that runs directly in the browser. Choose WebAssembly for broad compatibility, or WebGPU for full GPU-accelerated performance.
CPU · WebAssembly
WASM
Gravity physics compiled from Rust to WebAssembly and executed on the CPU. Compatible with all modern browsers — no special GPU required.
5,000 particles
Rust + macroquad
CPU scalar
Open simulation →
GPU · WebGPU Compute
WebGPU
Physics and rendering run entirely on the GPU via WGSL compute shaders. Significantly higher performance. Requires a recent Chrome or Edge with WebGPU enabled.
⚠️ Your browser may not support WebGPU
5,000 particles
WGSL compute shader
GPU resident
Open simulation →