Game Development Community

The Repopulation - Day/Night Transition Shots

by J.C. Smith · 12/29/2008 (12:25 pm) · 2 comments

Not a whole lot to write in this entry. Spent some time over the past couple of days improving the day/night transitions in The Repopulation. Some screenshots below:

71.18.167.9/daynighttransitionsnew.jpg

#1
12/29/2008 (2:14 pm)
I love the day night transition. It was so hard to get it set up with TGE that I kind of put it on a back burner for my new project in the TGEA. From the screen shots your game feels inviting, like there is something going on to influence the player to explore -- looking great.
#2
12/30/2008 (6:56 am)
It's a lot easier to work with in TGEA, thats for sure. The base of it is the old TGEDayNight code from Josh Ritter which determines the sun and moon position, and determines different color values for the sun and sky based on the time of day (as well as weather patterns).

The main changes were to create a UseSunlight material setting that allows materials to be affected (or unaffected) by Sunlight and defaulted it to being on. If its active, then it simply multiplies the diffuse color by the sunlight color before doing any other calculations in the pixel shader. It's a simple addition and provides reasonable results. The main problem with this approach is that shadows baked onto your interiors or terrain with lightmaps will not move with the sun. Most of this code is merged now merged into the 1.7.1 MMOKit now, though there were some slight tweaks earlier this week which probably haven't appeared in there yet.

For Atlas or Legacy Terrain and water, you'd also have to make a slight tweak to your shaders to pass over the sunlights color to the shader and multiply it by the terrain or water color. The one unfortunate problem there is that you may have to boost those shaders up to PS1.4 or use a fallback shader. That code is already merged into the kit also.

We also created a few events that happen at various times of day, in the early morning, afternoon, mid-day, night, late night, etc. During those events we allow the sound, materials and lights to be activated, swapped or changed. Another simple change that has reasonable results. All of the billboards in town are using the same Billboard.dts file and we use setskinname to change to an on or off texture, each with different materials (the on texture with a glow, the off texture turned black). This code is not yet merged into the kit but its simple to do. I'd guess Xerves will probably merge it in eventually. For the most part we've merged most of our engine improvements into it over time, the only thigns we haven't merged in are game specific features such as are dynamic content systems.