A GPU-first powder sandbox built in C++20 with OpenGL 4.3 compute shaders.
1000 x 1000 simulation grid, real-time materials, and a multiphase compute pipeline for sand, water, smoke, fire, and heat.
Powder Game is an experimental real-time simulation project focused on a fully GPU-driven architecture.
- Tech stack:
C++20,OpenGL 4.3+, compute shaders - Design goal: rich multi-material interactions without CPU readback in the frame loop
- Scope: sand, water, smoke, fire, heat, and cross-material coupling
- Platform support: Linux and Windows 11 (standalone package flow included)
This project focuses on one goal: keep the simulation on the GPU and maintain interactive performance while layering multiple coupled systems.
Sandwith Verlet-style motion + conflict-resolved movementWatervia D2Q9 LBM at full resolutionSmokestable-fluid style solver at quarter resolutionFirereaction-diffusion + half-res heat coupling- Cross-material coupling passes (fire/heat/smoke/water/sand)
- No CPU readback in the frame loop
- Active-tile culling pass to skip heavy work in idle regions
- Tuned texture formats (smoke density in
R8) to reduce bandwidth - Windows packaging script for standalone
.exeoutput
1: Sand brush2: Water brush3: Solid brush4: Erase brush5: Smoke brush6: Fire brush[/]: Brush radius down/upLeft Mouse: PaintEsc: Quit
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -j
./build/powder_gameNotes:
- OpenGL
4.3+is required. - Dependencies are auto-fetched by CMake if not available as system packages.
Build and package a Win11 x64 zip:
./build-win11.shOutput:
dist/win11/PowderGame-win11-x64.zip
Per-frame compute flow:
- Spawn/input pass
- Sand pass (prepare, desired, resolve, commit)
- Water LBM pass + pressure extraction
- Smoke pass (advect, vorticity, project)
- Fire + heat passes
- Coupling passes
- Composite render
src/: C++ app and GL utilitiesshaders/: compute + render shadersPLAN.md: architecture and milestone planbuild-win11.sh: Win11 standalone packaging
Milestones 1-7 are implemented from PLAN.md.
Current focus areas:
- simulation tuning and visual polish
- deeper active-tile compaction strategies (indirect-dispatch path)
- GPU-first orchestration
- SoA-friendly texture layout
- explicit memory barriers between passes
- ping-pong resources for solver stability