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.jpg

User 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.

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 12,150评论 0 10
  • 今天写东西,没有想法,躺着发发呆,细数了下今天的日子,两点一线,圈在办公桌里,一动不动就是一天,虽然一天紧...
    我是虹哈阅读 1,098评论 0 0
  • 1.运动健身-keep 20m k4 hiit。 2.目标达成--2028 这两天总是会有三四个深度聊天的。暴露了...
    kidII阅读 1,280评论 0 1
  • 今晚看“人生如若初相见”,看到秦桑为易连恺出谋划策,除掉傅荣才。发现女人一旦用起心思,真的太厉害了。所以找聪明的女...
    江南无雪10阅读 2,695评论 0 0
  • 模板语法 插值 Vue 2 提供了 v-once 指令进行一次插值,替代了 Vue 1 的 {{ * msg }}...
    云之外阅读 3,826评论 0 3