Geeking out from day to night.

Michaël Samyn, April 15, 2012

I’m rather proud of the very simple system I have created for simulating the time of day on the beach in Bientôt l’été.

There’s a half dome that represents the sky. But it’s very small. There’s a special camera inside that rotates around like the main camera but remains in the middle otherwise. This camera is simply rendered first and then the rest of the game world is rendered, in real size, on top of that.

This sky dome has a texture with gradient colors: night to dawn to day to evening to night horizontally, and sky to ground vertically.

The UV mapping is straight on. To change the time of day in the sky, I simply move the texture horizontally. I chose to do this because I noticed that the sky never changes color uniformly. There is a distinct difference in color between the part of the sky where the sun is and the opposite part. This is especially noticeable during and after sunset and sunrise.

At the same rate of moving the texture on the sky dome, I change the ambient light color (which represents the color of shadows in a 3D engine) and the color of the fog to match the color of the bottom of the texture (ground). And I change the color of the light and of the bright disc that represents the sun to the top color of the texture (sky). The eight source colors for this are sampled from the texture on the sky dome directly on startup and then blended according to time of day.

A great source of inspiration, by the way, was this wonderful description of light effects by Richard Yot.

In keeping with the sparse aesthetic style that I chose, the sky has no other features than these gradient tones. There’s a sun and a moon, but no clouds. Given the choice of colors, it’s not entirely clear whether we are seeing the sky, or just a very uniform cloud cover.

Next to the motion of the texture that corresponds to the time of day, there is also a movement of a transparency map, in the perpendicular direction, that corresponds to the position of the character on the beach. When he or she walks far enough, the sky opens up to reveal a sight of the planets and the stars that surround the space station. But that is stuff for another post!

Comments Off on Geeking out from day to night.

Comments are closed at this time.