webphysics-avbd-engine
Skill by ara.so — Daily 2026 Skills collection.
What It Does
webphysics is an experimental WebGPU-accelerated rigid-body and soft-body physics engine implementing the AVBD (Augmented Vertex Block Descent) solver from Giles et al. (2025). It runs entirely on the GPU using WebGPU compute shaders and supports:
- Rigid-body simulation with contacts, friction, and joints
- GPU broad-phase collision detection via LBVH (Linear BVH)
- Narrow-phase manifold generation with warm-start persistence
- Graph-coloring-based parallel body solves
- Springs and soft-body constraints
- Body sleeping/diagnostics
Browser support: Chrome only (requires WebGPU). This is an experimental proof-of-concept, not a production library.
Installation & Setup
The dev server typically starts at http://localhost:5173 (Vite-based).
Project Structure
Core API Usage
Initializing the Physics Engine
Adding Rigid Bodies
Stepping the Simulation
Reading Body State for Rendering
Adding Joints / Constraints
Adding Springs (Soft Bodies)
AVBD Pipeline Reference
The solver follows Algorithm 1 from the AVBD paper:
Key files per stage:
Configuration Patterns
Solver Parameters
Tuning Stability
- Increase
substeps(e.g., 20) for stiff stacks or fast-moving bodies - Increase
iterationsfor better constraint convergence - Use
mass: 0for static bodies (never moves, acts as infinite mass) - Lower
stiffnessvalues for softer, more stable joints - Set
restitution: 0+ highfrictionfor non-bouncy stacking
Common Patterns
Stack of Boxes
Pendulum Chain with Distance Joints
Integrate with Three.js Rendering
Troubleshooting
WebGPU Not Available
- Only Chrome 113+ supports WebGPU by default
- Enable via
chrome://flags/#enable-unsafe-webgpuon older versions - Firefox/Safari do not currently support WebGPU
Simulation Explodes / Bodies Flying Off
- Reduce timestep or increase
substeps - Lower joint
stiffnessvalues - Ensure static bodies have
mass: 0 - Check that
halfExtentsare positive and non-zero
Bodies Sinking Through Ground
- Increase
iterations(try 15–20) - Increase
substeps - Check collision shape sizing matches visual mesh
Performance Issues
- This is a Chrome-only WebGPU project; GPU driver issues can cause slowdowns
- Reduce body count or iteration count
- Check
chrome://gputo ensure hardware acceleration is active
Build Errors
Limitations & Roadmap Notes
- Chrome only — no Firefox/Safari support yet
- Not a drop-in npm package; must clone and integrate manually
- Double-buffered position updates (for same-color conflict safety) not yet implemented — current path uses in-place colored body solve in
avbdState.ts - Experimental API — breaking changes expected
- No TypeScript type declarations exported for external use yet


