Overview:
This project uses particle systems to simulate a scene with leaves and/or snow falling from the sky. Each leaf or snowflake is a particle in a system and each particle has a life span and a velocity. Particle systems are a useful and easy concept to grasp. They can be used to create other animations such as fire, smoke, rain, and flowing water.
There are 3 different particle systems: red leaves, yellow leaves, and snow. Each particle has a life and dies when it reaches the bottom or side of the boundary. When a particle dies it gets regenerated in a random position at the top of the boundary box. Each particle has a velocity to determine how fast the particle falls. A wind element is also another factor that determines which way the particles fall in the x-direction. Wind can be adjust by the user.
The leaves were generated using text mapping and masking. I created the masks using Adobe Photoshop. Using OpenGL blend functions I was able to display the image with a transparent background. The snow was generated using the blending function in a different fashion.
Each particle is generated in a random position and with a random velocity. When the wind is on, the particles get generated more to the left if the wind is blowing right and vice versa. When changing to another particle system (such as changing from red leaves to snow), a particle in the first particle system does not get regenerated when it dies.
Controls:
H - help menu
Q - quit program
W - turn wind on/off
1 - Change to fall scenery
2 - Change to winter scenery
3 - Generate red leaves only
4 - Generate yellow leaves only
5 - Generate both red and yellow leaves
6 - Generate snow only
7 - Generate leaves and snow
Screenshots:
Scene showing red particles only
Scene showing the background change from fall to winter
Scene showing all particle systems
Scene showing background change from winter to fall
Download:
Executable and necessary bitmaps
Resources:
nehe.gamedev.net - Used for learning about particle systems and masking/blending/texture mapping
OpenGL: A primer - Used for learning about general OpenGL functions