A real-time 3D fire and fluid simulation powered by WebGPU compute shaders. Watch volumetric fire physics unfold in your browser with GPU-accelerated Navier-Stokes fluid dynamics.
- Real-Time 3D Simulation - Volumetric fire rendered at interactive framerates
- GPU Compute Shaders - Physics calculations run entirely on the GPU via WebGPU
- Fluid Dynamics - Navier-Stokes based advection, diffusion, and pressure solving
- Interactive Controls - Adjust simulation parameters in real-time
- Node.js 18+
- A browser with WebGPU support (Chrome 113+, Edge 113+, or Firefox Nightly)
# Clone the repository
git clone https://github.com/alexf/firesim.git
cd firesim
# Install dependencies
npm install
# Start development server
npm run devnpm run build
npm run previewRun deterministic stability checks (fuzz + visual regression):
npm run test:stabilityGenerate/update snapshot baselines:
npm run test:stability:updateThe app supports deterministic sweep mode via URL params:
deterministic=1- fixed simulation time stepsweep=1- enables readiness/status reporting for automationscene=<id>- initial scene presetgrid=<64|128|192|256>- initial grid sizesmoke=<0|1>- smoke togglemaxFrames=<n>- freeze afterndeterministic frames
Automation status/control hooks are available on window:
window.__FIRE_SIM_STATUS__window.__FIRE_SIM_CONTROL__
Detailed limits and edge-case notes are documented in STABILITY.md.
firesim/
├── components/
│ ├── FluidSimulation.tsx # Main control deck, world scene, presets, and fire runtime wiring
│ ├── fluid/
│ │ ├── assetSystem.ts # Scanned/procedural log asset loading
│ │ ├── debugConfig.ts # Quality, composition, and debug mode mappings
│ │ ├── fireVolumeSystem.ts # WebGPU render loop and adaptive quality logic
│ │ └── woodSystem.ts # Analytic wood SDF and burn-state helpers
│ └── TooltipLayer.tsx # Global tooltip surface for deck controls
├── tests/stability/ # Playwright fuzz + snapshot stability harness
├── webgpu.d.ts # Local WebGPU DOM typing surface for this project
├── App.tsx # Main application component
├── types.ts # TypeScript type definitions
└── index.css # Deck styling
- 3D Voxel Grid - The simulation runs on a 3D grid of voxels
- Compute Shaders - WGSL shaders handle advection, combustion, divergence, and pressure projection
- World + Volume Composition - A Three.js world canvas sits behind a transparent fire volume canvas
- Quality Modes -
realtimeuses half-resolution temporal upsampling, whileaccuraterenders the fire pass at full resolution
- React 19 - UI framework
- TypeScript - Type safety
- Vite - Build tool and dev server
- Lucide React - Icons
- WebGPU - GPU compute and rendering
MIT License - see LICENSE for details.
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request