Day - Night Cycle Simulator

Responsive image
Created by
Zachary Weisman
Class
CPE 471
Professor
Dr. Zoe Wood

Day - Night Cycle Simulator is a simple program that emulates sky lighting, and weather through a continuous 24-hour period. The simulator displays a forest scene in which the user can move around using the mouse and keyboard, and can observe the colors change in the sky as the sun rises and sets. Additionally, as the suns position in the sky changes, the color of the light changes in order to further emulate atmospheric light scattering. Lastly, if the user presses 'X', they will notice a gust of wind comes through and sways the trees side to side, until the wind settles out. This project expanded on gradient shading, real-time shading, phong illumination, model transformation, hierarchical modeling, the use of material properties, and animation over time.

Implementation

Notes

My goal with this project was to create a realistic sky scene, with some ground elements to further enhance the light coming from the sun.

  • The simulator uses a light scattering scheme that uses four different colors throughout the sky to create a gradient that changes with the suns position in the sky.
  • At night, the scene doesn't get completely dark, but rather the engine simulates lunar reflectance.
  • The sky is generated using a skydome - a large sphere that surrounds the scene, onto which the sky colors are projected.

Lighting is done using the Phong Bi-Directional Lighting Model, and takes advantage of material properties to give the trees and the sun their reflectance.

  • Each tree position is generated randomly at program start-up time.
  • When wind is encountered, each tree will sway from different angles, but all in the same direction.
...

Sunrise on the map.

...

Later in the morning. Note the change in sky, and sun colors.

...

Just before noon.

...

Late afternoon.

...

Sunset.

...

The sun has set and the moon is rising.

...

Note the bluish tint that the moon casts over the trees.

...

The moon is setting, and the sun is beginning to light the scene just before it peaks over the horizon.

  • Sky / Atmospheric Renderng - A website with plenty of resources pertaining to atmospheric rendering
  • gamedev.net - An excellent community of aspiring game developers.
  • CPE 471 - Cal Poly San Luis Obispo

Areas for Future Improvement

Given more time to devote to this project, there were other features I would have implemented, and plan to do so in the future:

Sky Mapping
Rather than using a 3D model to represent celestial bodies, I want to have the sun, moon, and stars render on the sky dome itself. This would reduce memory use by the program because there would be fewer vertices to render.
Cel-Shading
Cel, or Toon shading is a is a type of non-photorealistic rendering designed to make 3-D computer graphics appear to be flat by using less shading color instead of a shade gradient or tints and shades. I think this method of shading would have made a cool world that would resemble something like the game Borderlands
Shadow Mapping
Implementing shadows in the simulator would really improve the realism of it overall, as well as reinforce the accuracy of the lighting model.