2018-12-16
Firefly
Introduction
- Implementing an interactive particle system with OpenGL and C++.
- The particle system simulate a swarm of fireflies attracted by a point light, while every individual of them is doing some kind of random motion.
- Using modern Core-Profile mode of OpenGL.
Details
- The player will control a flying camera in a 3D simple scene(mainly composed of a skybox and a mountain-like mesh), and all the fireflies will be attracted by the point where the camera is located.
- Two scenes are provided, one low poly and another realistic.
- At most 400 fireflies are supported and each of them can emit 200 second-level particles.
- Every single firefly act as a light source, which will illuminate the mountain-like mesh. Some optimizations have been done for better performance.
- Bloom effect is implemented to make fireflies shiny.
Illustration
Screenshot1.jpg Screenshot2.jpg Screenshot3.jpgUser Guide
The game.h
and game.cpp
in the ControllerCode
folder is the overall controller of the game. Its job includes instantiating the camera, compiling the shaders, initializing the resource pool and the frame buffer. Its Update function will call the particle_generator's Update function.
The particle_generator.h
and particle_generator.cpp
controll the particle system, including every particle's life and their motion as a firefly.
The four given files in the Shaders
folder is the shaders that i used to implement the Bloom Post-Processing Effect.
More information and the whole project: here
Release Version of this project and an video demo can be found: here
- Use mouse to look around. Press W, S, A, D to move around.
- Press R to cancel the attraction to the swarm and press E to attract them again.
- Press C to clear all the fireflies in the scene.
- Press P to stop time and press O to resume.
- Press Q to switch to another scene(which is more realistic), and in that scene press T to emit second-level particles.
NOTE: OpenGL, GLEW, GLFW, assimp, irrKlang support are required. I have tested the project on my two PCs but still I can not guarantee that it will work perfectly on any PC as expected. If it can not run well, please have a glance at the video demo.