Particle Fireworks System
Real-time particle system editor and fireworks simulator
Overview
A real-time particle system editor and fireworks simulator built in C++ with OpenGL. The application features a physics-driven particle engine that supports gravity, aerodynamic drag, wind forces, and attractor/repeller fields, with both Euler and 2nd-order Runge-Kutta numerical integration methods. Users can interactively tweak simulation parameters, including spawn rates, lifespans, colors, scales, and forces, through an ImGui control panel and see the results update in real time.
Fireworks System
The fireworks mode simulates rockets with a full lifecycle state machine: rockets launch upward, detect apex via velocity thresholds, then explode into rings of color-matched sparks distributed across the XZ plane. Each rocket can chain up to three consecutive explosions, and sparks interact with gravity, drag, and ground-plane collisions with energy loss on bounce. A jitter system adds controlled randomness to position, velocity, color, and scale at spawn time, giving the effects a natural, organic feel.
Particle Simulation
Each particle carries a 12-element state vector packing position, velocity, accumulated forces, mass, and time-to-live into a single flat array, and the integrator steps the entire vector forward each frame. Forces are accumulated per-particle each tick. Drag is computed from air density, a drag coefficient, cross-sectional area, and the squared velocity magnitude, while attractors and repellers apply distance-based directional forces.
Explosions use a Fibonacci sphere distribution across three concentric velocity layers to scatter sparks evenly in 3D rather than clumping them on a flat ring. The rendering pipeline interpolates each particle’s color, alpha, and scale between start and end values based on remaining lifetime.