three-particle-gpgpu
Installation
SKILL.md
GPGPU Particle Simulation with FBO Ping-Pong
What this builds
A production-grade GPU-computed particle simulation using Three.js's GPUComputationRenderer. All particle state (position, velocity, life, color) lives in floating-point textures on the GPU. Simulation shaders run as full-screen fragment passes that read the previous frame's texture and write the next frame's state (ping-pong). The CPU never touches per-particle data, allowing 100k-1M+ particles at 60fps.
- FBO ping-pong architecture: simulation runs entirely on the GPU via render-to-texture
- GPUComputationRenderer manages texture variables, dependencies, and double-buffering
- Position and velocity stored as RGBA float textures (x, y, z, w per texel = per particle)
- Curl noise flow field for organic, divergence-free particle motion
- Attractor/repulsor forces (point, line, mesh surface) with configurable strength and falloff
- Mouse/pointer interaction injected as a uniform-driven force emitter
- Particle rendering via Points with a vertex shader that samples the position texture
- Configurable particle lifecycle (birth, death, respawn) via the life/age channel
- Proper disposal of all GPU resources (render targets, textures, materials)