Firework Simulator Ian Meeder CPE 474

Intro

Sorry about the video, the capture software I was using is pretty much garbage.

This is a really rudimentary procedural firework generator/simulator. I wanted to play around with particles, geometry shaders, and a C++ GUI framework and figured that fireworks could be simulated with tons and tons of particles.

Graphics Techniques

Particles

Every single bit of a firework is a particle. The inital launched firework is a particle, the heads of the trails are particles, the trail following the leading particle, it's all particles. By generating particles as they go, the head particles appear to be given tails. The tail appearance is achieved by the size of the trailed particled decreasing over time. The "Sparkle" fire work is similar to the normal firework except the size of the trails is dictated by a sin wave rather than a linear decrease. Lastly the "Shape" firework reads in the vertices of an obj file which dictate the velocity vector of the particles.

Billboarding

Each particle is a billboarded quad that constantly faces the camera. Rather than a texture passed in, each particle is drawn procedurally (i.e. color and size) in the shaders.

Geometry Shader

To create the quads, I pass the position of the particle into the geometry shader. From there I calculate the camera's up vector and right vector (the vector orthagonal to the up vector on the plane parallel to the camera) and generate the four points of the quad which is drawn as a triangle strip.

GUI

AntTweakBar

AntTweakBar is an older OpenGL versatile GUI framework. It's main intent is for the easy interface for users to directly manipulate variables. Since the fireworks are procedurally generated, this means that any hard-coded value I might normally use can be bound to an AntTweakBar field. It even has built in types such as color and vec3 to visually manipulate whole datatypes rather than the individual fields.

It is easily integrated with your favorte OpenGL frame as it has event handlers for GLFW, GLUT, SDL, etc.

You can find out more about AntTweakBar here.

Controls

Mouse Left-Click and Drag to Rotate
Shift + Mouse Left-Click and Drag to Dolly
Ctrl + Mouse Left-Click and Drag to Dolly
Space to Pause/Play the simulation

Code

You can find the code on GitHub.

Free Web Hosting