Weather Effects

By Matthew Bague

Project Background

For my final project, I made weather effects for a scene. The scene has a lighthouse with a rotating light that the user can toggle on and off. The three weather affects I wanted to target were the following:

The user is also able to control the time of day using number keys 1 to 4 (which also correspond to a weather effect).

Controls

Light House

The lighthouse was handmade by me using VBOs and IBOs. The geometry for the lighthouse is made up with:

Also, all the lighthouse geometry and the ground are textured.

Light Beam Effect

The inspiration for the lighthouse and light beam came from The Legend of Zelda: The Wind Waker. If you've played the game, recall the lighthouse on Windfall Island. Below is a picture from in-game of the lighthouse with its light turned on.
Since OpenGL doesn't have a built-in function to make an actual beam of light, I had to "fake" it using geometry and modifying the alpha value. As the light beam gets farther from the source (the center of the lighthouse), notice how its intensity drops off. This was done by using the gl_FragCoord to determine the alpha value. Also, I made it so the light could be several colors.

Fog Effect

While there exists a glFog effect function, I had trouble getting it to work (also, this function is deprecated in later versions of OpenGL) so I decided to just do the work directly in the shaders. At the center, you'll notice that there really isn't a fog effect. That's because the function works based on how far the viewer is from the center. As you move farther from the center, the fog effect becomes more prevalent. See images below.

Rain Effect

The rain was made using a particle system that used instancing. Each particle is a billboarded slim rectangle and has its own properties, such as life, velocity, position, color, transparency, and so on. Particles are shot out from an emitter that I placed above the lighthouse (see image below on the right). The maximum number of particles I allowed in the system was 100000. Coincidentally, the rain and snow effects look very similar to the one used in Minecraft. When the particle system was turned on, I was getting around 30 FPS on my netbook, compared to the 150+ FPS I was getting when it was turned off. So it definitely takes a bit of processing power.

Snow Effect

The snow effect uses the same particle system as the rain effect. The only difference is that particles are white and billboarded squares. Also, I rotated the emitter so the snow blows to the side as if it was being pushed by the wind.

Resources

Contact

If you have any questions about my project, feel free to contact me. My contact info can be found on my website.