CPE 471 - Fall 2016
For my final project I created a scene that displays a nightly forest with a fire, in which the user can move freely with a first-person perspective.
The fire is rendered using a particle system. The particiles are moving upwards with a random velocity per particle, and are moved sideways by a wind velocity. Additionally each particle is moved by a Fractal Noise based on Perlin Noise. The original paper on Perlin Noise gives a very detailed description of Perlin Noise.
Each particle is textured using a alpha texture from a texture atlas containing 16 different textures. The texture is chosen dependent on the progress of the particles lifetime. In addition to that the size of the particles is scaled dependend on the distance of the camera position to the fire, so the fire looks always the same, no matter how far the user is away.
One of the key factors to make the scene look nightly is the lighting implementation. There are two different lights in the scene. One is a point light source at the location of the fire and the other is a spotlight that is bound to the users view direction and therefore gives the user the feeling of having a flashlight.
For both light sources the lighting is implemented as Phong shading, including a distance falloff, while the color of each fragment is mixed by its actual color and its color converted to greyscale dependend on the distance falloff. This simulates very well how the human perception works in a dark surrounding.
Additionally the light source in the fire can move around by a small value, to simulate the flickering light a fire would cause in the real world.
The scene is enclosed by a skybox displaying a night sky. This is implemented by using OpenGLs cubemap sampler, and is very crucial for the night "feeling" for the user. The cubemap is scaled far bigger than the area in which the user is able to move, so the user can never see the edge where the ground plane is colliding with the cubemap.
The user can use the WASD-Keys to move in the scene, Spacebar to jump and the mouse to look around.
The project can be found on github. The project is build using cmake and requires GLFW and GLEW.
Project base code was provided by Zoe Wood.
The Perlin Noise implementations that is used in my project.
The cubemapping tutorial I used.
A very good tutorial on spotlights in OpenGL.